Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

shifting arrays

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

    shifting arrays

    If I'm trying to shift values in arrays, does the following loop within OnBarUpdate() method iterate the entire loop on each bar update, or just one increment of w per update?

    for (int w = 5; w >0;w--)
    {
    PvtBar[w+1]=PvtBar[w]; //could this be some sort of .shift or .unshift method?
    PvtPrice[w+1]=PvtPrice[w];
    }
    PvtPrice[0]=PivotHigh;
    PvtBar[0]=CurrentBar-PvtHiBarsBack;

    #2
    Hi Hawk Arps, the entire loop would be run on every OnBarUpdate(). If you are trying to shift an array, I would recommend using a totally separate, temporary array to hold the intermediate values.
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    89 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    107 views
    0 likes
    Last Post CarlTrading  
    Working...
    X