Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting text, needing to refresh NinjaScript

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

    #16
    Originally posted by NinjaTrader_Jim View Post
    Hello WalterSkinner,

    Looking at the code, the Draw.Text method in BarsInProgress == 1 is using CurrentBar with the tag, so each time there is a new secondary bar, this tag will change and a new drawing object will be placed.

    Following the recommendation from post #6, please consider using CurrentBars[0] with the tag instead, as CurrentBars[0] reflects the index of the primary data series and you want to have one drawing per primary bar.
    Thanks for your patience and help Jim, much appreciated.

    I gave that a shot a while back and it gave me the error below.

    When I try this:
    Code:
    Draw.Text(this, "deltaText"+CurrentBar[0], false, barDelta.ToString(), 0, High[0] + 2*plotVertPos*TickSize, 0, Brushes.Black, myFont2, TextAlignment.Center, Brushes.Black, null, 1);
    I get this error:
    Code:
    "cannot apply indexing with [] to an expression of type int"
    I've got to be doing something wrong.

    Since the primary data series is a range bar chart, and the second series is range based volumetric bars, I set the range of the volumetric bars equal to the range of the primary data series, hoping to make make it not matter which data series I was using to plot.

    Comment


      #17
      Hello WalterSkinner,

      You need to use CurrentBars[0].

      CurrentBar - https://ninjatrader.com/support/help...currentbar.htm

      CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm

      Please also see the complete Multi Time Frame and Instruments documentation. Giving this a good once over will help when working with Multi Time Frame/Multi Series scripts.

      Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

      Comment


        #18
        Originally posted by NinjaTrader_Jim View Post
        Hello WalterSkinner,

        You need to use CurrentBars[0].

        CurrentBar - https://ninjatrader.com/support/help...currentbar.htm

        CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm

        Please also see the complete Multi Time Frame and Instruments documentation. Giving this a good once over will help when working with Multi Time Frame/Multi Series scripts.

        Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

        Thank you so much that finally did it.

        You have the patience of a saint.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        628 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        359 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        562 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X