Sets the maximum amount of bars preloaded for the calculation of indicators used in a trading system.
Syntax:
1 |
DEFPARAM PRELOADBARS = 200 |
This instruction is very useful if you plan to use indicators that need previous bar to compute before you can rely on them to make trading decisions in your code.
Example :
1 2 3 4 5 6 7 8 |
DEFPARAM PRELOADBARS = 150 myMA = average[100](close) IF NOT ShortOnMarket AND close[1]<myMA[1] THEN SELLSHORT 1 SHARES AT MARKET ENDIF SET STOP %TRAILING 2 |
In PRT 11, tested default value is 1000. When using Mulitple time frames the default is 1000 for each timeframe used.
I hear max is 10k but with V12, they should increase it further. Don’t know why they didn’t. I understand it needs bigger memory footprint on their servers where algos run. I wonder how big was the overhead while making this 10k decision.