Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator works on time but not on tick or volume

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

    Indicator works on time but not on tick or volume

    I have been using Visual studio to try find this OnBarUpdate issue. I have a -1 index that is out of range.

    It works on minute charts but when I test on non time frame charts I get the error. The error is setting the plot

    MyPlot[0] = Bollinger(2, 14).Middle[0]


    The system is set to Calculate = Calculate.OnEachTick;

    f (BarsInProgress == 1 && CurrentBars[1] > 20 && IsFirstTickOfBar == true)
    {

    MyPlot[0] = Bollinger(2, 14).Middle[0];


    the 2 questions are the following

    1. On Currentbar is there a way to make sure you have enough CurrentBars to run?

    2. If this is set to Calculate.OnEachTick; do I get my logic at index 1 or index 0 because IsFirstTickOfBar == true;
    This plot is just a line.

    #2
    Hello ballboy11,

    Is MyPlot set to return a plot from the Values collection added with AddPlot()?

    Can you set other values to this series and print this value?

    If you call Print(Bollinger(2, 14).Middle[0]); does this print or error?

    This depends on the indexes being used.

    If you have a barsAgo value you are planning to use, you can ensure that CurrentBars[0] && CurrentBars[1] are both greater than that value.

    if (CurrentBars[0] > myBarsAgoValue && CurrentBars[1] > myBarsAgoValue)
    {
    Print(Time[myBarsAgoValue]);
    }

    When in real-time with Calculate.OnEachTick, barsAgo 0 will be the currently open building bar. barsAgo 1 will be the most recent fully closed bar.
    If you set a value any time while that bar is open that will be the value used, even if this is on the first tick.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    151 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X