Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Problems with DrawLine

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problems with DrawLine

    Greetings

    I have an indicator that draws lines on the price pane and was working perfectly. Now for some reason the lines are not being drawn at all. I do not see any errors being logged in the log.

    The only possibility that may have contributed to this problem was the addition of 'DrawOnPricePanel = false' to another indicator that is completely unrelated to this one. However this flag was removed and the indicator was recompiled. The problem still persists.

    Several other indicators that also drew lines on the price pane are now unable to draw such lines.

    No changes to these price pane line drawing indicators were made.

    Please advise.

    Thanks in advance.

    #2
    Hi svrz, the DrawOnPricePanel will work per indicator and not globally.

    Do you see any errors in the Log tab returned for the indicators when you apply them?

    Are other normal plots from the indicator still working as expected?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you for the prompt reply, Bertrand.

      This is truly baffling as there are no errors shown in the log. The Print statements are being executed as expected and the output shows the correct sequences. Unfortunately for some reason no lines are drawn on the price pane.

      P.S. - Is there an ETA for NT 7 beta?

      Comment


        #4
        Check your other panels too then.

        It may be easier to just flip the code to drawing vertical lines so you don't have to search around for the line to confirm which panel the lines are coming up on.

        NT7 is slotted to beta in Q2 of 2009.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks, Josh.

          I just created a test script. First I used DrawHorizontalLine:

          Code:
          try
          {
          	DrawHorizontalLine("Test1", 6675, Color.Blue); 
          }
          catch(System.Exception e)
          {
          	Print(e.ToString());	
          }
          This is for current YM contract. It works.

          Then I tried this:

          Code:
          try
          {
          	if (CurrentBar == 218)
          		DrawLine("tag1", false, 10, 6675, 0, 6675, Color.LimeGreen, DashStyle.Dot, 2); 
          					
          }
          catch(System.Exception e)
          {
          	Print(e.ToString());	
          }
          218 is the number of the last bar on the chart (CurrentBar).

          This does not work. No exceptions are triggered.
          Last edited by svrz; 03-05-2009, 02:39 PM.

          Comment


            #6
            svrz,

            A try catch block would not be applicable in this scenario. Instead you want to put a print inside the if (CurrentBar == 218) statement.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              svrz,

              A try catch block would not be applicable in this scenario. Instead you want to put a print inside the if (CurrentBar == 218) statement.
              Thanks, Josh. The Print statement is invoked. I'm simply baffled why the lines are not being drawn.

              Comment


                #8
                Please just use DrawVerticalLine(): http://www.ninjatrader-support.com/H...ticalLine.html

                You are likely not seeing the line simply because you do not have your axis within that price range.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Josh

                  The problem is that these are trend lines. They were working perfectly fine previously. Now they don't for some reason. I suppose an uninstall and re-install of NT is in order because there are no reasons as to why this code should not work.

                  As a matter of a fact, I have send the script to a friend who has installed it on his computer and it works just fine.

                  Thanks again for your assistance.

                  Comment


                    #10
                    Then try uninstalling NT along with .NET and reinstall both. Remember to clear your internet browser cache.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Josh

                      I have not yet reinstalled NT and DotNet. However I took a screen shot of the anomaly for the purpose of one last attempt in determining the cause of the problem.

                      As the attached picture shows, all the lines that should be drawn on the price pane, for whatever the reason are drawn at the bottom of the volume pane.

                      Do you have any idea as to why this problem should occur when ABSOLUTELY NO CHANGES to the script was made between now and the last time it was functioning properly?

                      Thanks very much in advance.


                      Last edited by svrz; 03-07-2009, 01:34 PM.

                      Comment


                        #12
                        svrz,

                        If the lines are not drawn on the price panel this is indicative of not having a DrawOnPricePanel = true line in the Initialize() method. Please ensure this line is there.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Josh

                          I performed a search on all *.cs files in the Indicator folder. Only one unrelated indicator had DrawOnPricePanel set to false. For good measure, I commented out this statement and compiled. The results are the same. For whatever the reason, DrawLine no longer functions on the price panel.

                          Are there any Registry settings that I should be aware of? How about global settings or variables?

                          Thanks again for your assistance, Josh.

                          Comment


                            #14
                            svrz,

                            No, you do not need to check for false. All you need to do is add DrawOnPricePanel = true to the indicator that you want to have draw objects draw on the price panel.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Same issue

                              I just started seeing this issue as well. Only thing different is I upgrade NT to 6.5.1000.9.

                              Here the code I used to demonstrate the issue. No lines are drawn. No exception is thrown and nothing in the log. There are no other indicators and I didn't use a template when I opened the chart.

                              public class jtDrawLineProblem : Indicator
                              {
                              protected override void Initialize()
                              {
                              CalculateOnBarClose = true;
                              Overlay = true;
                              PriceTypeSupported = false;
                              DrawOnPricePanel = true;
                              }

                              protected override void OnBarUpdate()
                              {
                              try {
                              if (CurrentBar < 1) return;
                              DrawLine("test" + CurrentBar, 1, High[1], 0, High[0], Color.Blue, DashStyle.Solid, 2);
                              } catch (Exception ex){
                              Print(ex.ToString());
                              }
                              }

                              }



                              I have done this many times before so I know it did work at one time. I did try one of my older indicators and the line drawing stopped working in that one as well.
                              Last edited by j0hnth0m; 04-14-2009, 10:00 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by mjairg, 07-20-2023, 11:57 PM
                              3 responses
                              213 views
                              1 like
                              Last Post PaulMohn  
                              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                              4 responses
                              544 views
                              0 likes
                              Last Post PaulMohn  
                              Started by GLFX005, Today, 03:23 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post GLFX005
                              by GLFX005
                               
                              Started by XXtrader, Yesterday, 11:30 PM
                              2 responses
                              12 views
                              0 likes
                              Last Post XXtrader  
                              Started by Waxavi, Today, 02:10 AM
                              0 responses
                              7 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Working...
                              X