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

Historical Draw.Line

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

    Historical Draw.Line

    Hello,

    Currently my code is:

    Code:
    if ( .... )
    {Draw.Line(this, "Line"+CurrentBar....}
    And this draws a line every time said condition is fulfilled...

    How can I limit it to draw only the last 10 lines?

    I tried the code below but it only drew one line

    Code:
    private int history = 10;
    if ( .... )
    {Draw.Line(this, "Line"+history....}

    #2
    Hello KINGKODA,

    Thanks for your post.

    You have the right idea but just need to start at 0 and increment history as a counter.

    private int history = 0;

    if (your conditions)
    {
    Draw.Line(this, "myline"+history...)
    history ++; // increment counter
    if (history > 9)
    {
    history = 0; // reset after 10 drawn.
    }
    }

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Perfect!

      Thank you Paul

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by cre8able, Today, 03:20 PM
      0 responses
      2 views
      0 likes
      Last Post cre8able  
      Started by Fran888, 02-16-2024, 10:48 AM
      3 responses
      46 views
      0 likes
      Last Post Sam2515
      by Sam2515
       
      Started by martin70, 03-24-2023, 04:58 AM
      15 responses
      114 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by The_Sec, Today, 02:29 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by jeronymite, 04-12-2024, 04:26 PM
      2 responses
      31 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X