Max. hist. bars in a strategy
- This topic has 4 replies, 2 voices, and was last updated 2 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Max. hist. bars in a strategy
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?
Good question, I have no idea, though.
I wrote this code:
1 2 3 4 5 |
defparam preloadbars = 10000 buy at -close limit graph barIndex graph IntraDayBarIndex graph IsLastBarUpdate |
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:
So, I assume the 10K preloaded bars are kept in memory.
The indicator is simply:
1 |
RETURN BarIndex AS "BarIndex" |
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?
Using this code in ProBuilder:
1 |
RETURN IntraDayBarIndex AS "IntraBarIndex",BarIndex AS "BarIndex" |
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:
1 2 3 4 |
defparam preloadbars = 10000 Sma = average[10001,0](close) buy at -close limit graphonprice Sma AS "Sma 10001" |
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.
Find exclusive trading pro-tools on