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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    640 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X