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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        48 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        69 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        36 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        59 views
        0 likes
        Last Post PaulMohn  
        Working...
        X