Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can BarsInProgress be processed dynamically?

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

    Can BarsInProgress be processed dynamically?

    Hello,

    Is it possible to have a strategy change BarsInProgress dynamically? Instead of having if (BarsInProgress = = 0), we replace 0 with our own variable that can change dynamically while backtesting?


    #2
    Hello Don22Trader1,

    The BarsInProgress variable is set by the platform for the series that called OnBarUpdate. You can make a variable of your own to compare against that, its just an int variable.

    Code:
    int myBIP = 1; 
    
    if(BarsInProgress == myBIP )
    That could be a user input or any int variable of your choosing as long as it equals one of the BarsInProgress for the series you are using.

    Comment

    Latest Posts

    Collapse

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