Max. hist. bars in a strategy
Forums › ProRealTime English forum › ProOrder support › Max. hist. bars in a strategy
- This topic has 4 replies, 2 voices, and was last updated 6 months ago by
robertogozzi.
-
-
09/23/2024 at 4:36 PM #237950
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?
09/23/2024 at 5:19 PM #237953Good question, I have no idea, though.
I wrote this code:
12345defparam preloadbars = 10000buy at -close limitgraph barIndexgraph IntraDayBarIndexgraph IsLastBarUpdateto 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.
09/23/2024 at 5:22 PM #237955The indicator is simply:
1RETURN BarIndex AS "BarIndex"09/23/2024 at 5:45 PM #237958Thanks 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?
09/24/2024 at 5:52 PM #237977Using this code in ProBuilder:
1RETURN 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:
1234defparam preloadbars = 10000Sma = average[10001,0](close)buy at -close limitgraphonprice 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.
- 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
-
AuthorPosts
Find exclusive trading pro-tools on