• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.HorizontalLine fails on 5, 6, 7 DaysBack

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

    Draw.HorizontalLine fails on 5, 6, 7 DaysBack

    Attached is a simple indicator to demonstrate a problem with Draw.HorizontalLine that causes it to fail only with particular DaysBack settings.

    To reproduce:
    1. Open a NinjaScript Output window.
    2. Connect to a data feed
    3. Create a 30 minute chart of ES 12-16 starting with DaysBack = 1.
    4. Add the gws\TroubleDrawHLine indicator, which should draw a horizontal red line at 2126.00.
    5. Open the Data Series and change DaysBack to 2 and hit Apply.
    6. Repeat for DaysBack 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ...

    The error occurs with DaysBack set to 5, 6, 7 and 12, 13, 14. Probably others as well, but I didn't check further.
    Attached Files

    #2
    Hello,

    I believe this would be because you are trying to draw from OnStateChange. This is noted that it will not work here as note #3: http://ninjatrader.com/support/helpG...hlightsub=Draw

    You would instead need to use OnBarUpdate and surround the code with a check for the state:

    Code:
    if(State == State.Historical)
    {
    	Draw.HorizontalLine(...);
    }
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Interesting that it works most of the time when called from OnStateChange, just seemingly not when DaysBack crosses a weekend.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by EnveousColnago, Yesterday, 05:43 PM
      7 responses
      36 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by PeterGolz, 01-17-2020, 10:42 AM
      11 responses
      73 views
      0 likes
      Last Post reubenlasky  
      Started by utilizator, Today, 11:36 AM
      0 responses
      6 views
      0 likes
      Last Post utilizator  
      Started by EnveousColnago, Today, 07:24 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by tornadoatc, Today, 10:31 AM
      0 responses
      4 views
      0 likes
      Last Post tornadoatc  
      Working...
      X