Max. hist. bars in a strategy

Forums ProRealTime English forum ProOrder support Max. hist. bars in a strategy

Viewing 5 posts - 1 through 5 (of 5 total)
  • #237950
    JS

    Hi,

    I use the “IntraDayBarIndex” in my strategy to calculate certain indicators, the “IntraDayBarIndex” can reach a value of 75,000 (TF=1 sec)) during a day.

    I know that the maximum number of bars to load is 10,000 (DefParam PreLoadBars=10000).

    When you use “DefParam PreLoadBars=10,000” in your strategy, does the number of loaded bars always remain constant 10,000?

    So, when the strategy is running, and new bars are added, are the oldest bars, when the number exceeds 10,000, removed or not?

    #237953

    Good question, I have no idea, though.

    I wrote this code:

    to be able to see data on my chart, so I could figure out what it is all about.

    The attached screenshot reports what I found out:

    • Pic 1 is the screenshot I took when the mouse was sitting on the leftmost candle (the very first one) and it shows BARINDEX=10000, while the indicator reads BARINDEX=0
      .
    • Pic 2 is the screenshot I took when the mouse was sitting on a later bar where it shows BARINDEX=20001, while the indicator reads BARINDEX=10001.

    So, I assume the 10K preloaded bars are kept in memory.

    1 user thanked author for this post.
    #237955

    The indicator is simply:

    #237958
    JS

    Thanks Roberto…

    If this works the same for strategies and a maximum of 10k bars remains in memory, then the “IntraDayBarIndex” will never get a higher value than 10,000…? (“IntraDayBarIndex” depends on the number of bars loaded)

    Does it mean that a calculation involving more than 10,000 bars is no longer correct?

    #237977

    Using this code in ProBuilder:

    I could figure out that IntraDayBarIndex tallied a total 34772 intraday bars, but many are missing (on a 1-second TF that happens often), as from Pic 1.

    SMA10001 is plotted starting from bar 10000, as the first 10K bars (0-9999) were not enough for the calculations, as from Pic 2.


    This code, in ProBacktest:

    uses the same SMA10001 and starts graphing it from bar 10000 (using 10001 bars, 0-10000), which is bar 0 in ProBuilder, due to the 10K preloaded bars, as from Pic 3.

    If a change it to SMA10002 it is graphed from bar 10001 as it needs an additional bar for the calculations, as from Pic 4.


    We can assume that both ProBacktest/ProOrder and ProBuilder only plot accurate data when there are enough bars for the calculations.

    If you use defparam preloadbars = 0, then ProBacktest will graph the SMA10001 starting from bar 10000, i.e. you won’t get any signal (in case you expect a crossover) until 10K+ bars have elapsed. No incorrect calculations seem to be made.

     

     

     

    2 users thanked author for this post.
Viewing 5 posts - 1 through 5 (of 5 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login