MultiTimeFrame PreLoadBars Error Message?
Forums › ProRealTime English forum › ProOrder support › MultiTimeFrame PreLoadBars Error Message?
- This topic has 9 replies, 3 voices, and was last updated 4 years ago by Nicolas.
-
-
01/13/2020 at 9:33 AM #116596
Hi All,
Please could someone assist in answering some questions on the PreLoadBars function when using MultiTimeFrame in ProOrder?
I am attempting to automate a 1 hour system and run it in a significantly lower timeframe (read 1 minute or even 1 second). Back testing seems to be working well but when I try to run it live on IG’s ProRealTime version 10.3, I get the following error message: “This trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick.”
My PreLoadBars are already set to the maximum of 10,000 so my questions are:
- Is there a way to create a dummy indicator in my code, purely to pass this test (to trick ProOrder somehow)? The idea is then to restrict trading until such time that enough candlesticks are available (built up over time) in order for there to be enough data available in the shorter MTF to satisfy the requirements of candlesticks in the longer MTF?
- Can this historical data be built up over time or is there a hard limit of only looking back a maximum of 10,000 bars in the shorter MTF?
- Does ProRealTime version 11 cater for a larger value for PreLoadBars for ProOrder in order to cater for MultiTimeFrame data requirements?
Many thanks.
01/13/2020 at 12:40 PM #116622Hi All,
Perhaps the error message is misleading as I found the following link mentioning that a phantom bar may be causing a divide by zero error: https://www.prorealcode.com/topic/trading-system-automatically-stopped/
I am now going through my code with a fine toothcomb trying to find a possible divide by zero exception.
Strange that this is not a problem during back-testing?
01/14/2020 at 11:38 AM #116758Strange that this is not a problem during back-testing?
I wrote a comment to above and then thought it would be more usefully posted in the Forum on the link below
1 user thanked author for this post.
01/14/2020 at 12:15 PM #116769Hi GraHal,
Thanks for the link, I fully agree with your sentiments! I have spent the last day debugging my code and running it live (stopping and restarting the strategy each time I make a debug change) line by line until it starts failing.
I finally tracked it down to the following lines in my code which seem to be failing due to the longer MultiTimeFrame not having sufficient data for the shorter MTF check. I have tried coding around this by checking for “undefined” and/or other “if” statements but so far to no avail, which brings me back to my questions above. This part of my code gets executed in a 1 hour block of a 1 second MTF strategy.
Failing Code12345678// -> Reversion Power (RSI)ReversionPowerLimit = 15RK5 = WeightedAverage[3]((RSI[5](MesaInput) - Lowest[5](RSI[5](MesaInput))) / (Highest[5](RSI[5](MesaInput)) - Lowest[5](RSI[5](MesaInput)))) * 100RK14 = WeightedAverage[3]((RSI[14](MesaInput) - Lowest[14](RSI[14](MesaInput))) / (Highest[14](RSI[14](MesaInput)) - Lowest[14](RSI[14](MesaInput)))) * 100RK45 = WeightedAverage[14]((RSI[45](MesaInput) - Lowest[45](RSI[45](MesaInput))) / (Highest[45](RSI[45](MesaInput)) - Lowest[45](RSI[45](MesaInput)))) * 100RK75 = WeightedAverage[20]((RSI[75](MesaInput) - Lowest[75](RSI[75](MesaInput))) / (Highest[75](RSI[75](MesaInput)) - Lowest[75](RSI[75](MesaInput)))) * 100WeightedRK = ((4.1 * RK5) + (2.5 * RK14) + (RK45) + (4 * RK75)) / 11.6AverageWeightedRK = WeightedAverage[SignalCycle](WeightedRK)If you can think of a way around this problem, don’t hesitate to share your thoughts 😉
01/14/2020 at 2:48 PM #116783Have you tried the shorter TF at 5 seconds?
1 second TF may just not be long enough to read all your code and execute a trade (esp if many lines and complex?) and then start reading again on the next second?
Worth a try anyway?
01/14/2020 at 8:03 PM #11681501/15/2020 at 10:02 AM #116842Hi All,
At least my story ends well as I have managed to get the automated trading code running stable again.
Just a warning to anyone reading this thread: You should not always trust the exception messages that ProOrder returns upon failure. Sometimes “This trading system was stopped because the historical data loaded was insufficient to calculate at least one indicator during the evaluation of the last candlestick” means exactly what it says. Other times it may mean that there is a divide by zero error or a phantom bar causing the problem, as highlighted by GraHal in another thread. In my case, as far as I can tell, ProOrder sometimes doesn’t handle MultiTimeFrame strategies as expected. On this note also just a reminder that the BarIndex in various portions of a MTF strategy will be different depending on the time block that you are in. Anyway, what finally fixed my issue was changing my code above to: (Basically forcing an initialisation of some variables)
Working Code123456789101112131415// -> Reversion Power (RSI)ReversionPowerLimit = 15If BarIndex > MinBarsRequired thenRK5 = WeightedAverage[3]((RSI[5](MesaInput) - Lowest[5](RSI[5](MesaInput))) / (Highest[5](RSI[5](MesaInput)) - Lowest[5](RSI[5](MesaInput)))) * 100RK14 = WeightedAverage[3]((RSI[14](MesaInput) - Lowest[14](RSI[14](MesaInput))) / (Highest[14](RSI[14](MesaInput)) - Lowest[14](RSI[14](MesaInput)))) * 100RK45 = WeightedAverage[14]((RSI[45](MesaInput) - Lowest[45](RSI[45](MesaInput))) / (Highest[45](RSI[45](MesaInput)) - Lowest[45](RSI[45](MesaInput)))) * 100RK75 = WeightedAverage[20]((RSI[75](MesaInput) - Lowest[75](RSI[75](MesaInput))) / (Highest[75](RSI[75](MesaInput)) - Lowest[75](RSI[75](MesaInput)))) * 100ElseRK5 = 0RK14 = 0RK45 = 0RK75 = 0EndIfWeightedRK = ((4.1 * RK5) + (2.5 * RK14) + (RK45) + (4 * RK75)) / 11.6AverageWeightedRK = WeightedAverage[SignalCycle](WeightedRK)Good trading to all and once again thanks to GraHal for the support!
01/15/2020 at 10:21 AM #116843my hopes are tempered as I think I tried a 1 min, 5 min and 30 min timeframe at one stage without success.
Your current short TF is 1 sec so I was suggesting try 5 seconds TF … so I guess above you meant to say 1 sec, 5 sec and 30 sec??
01/15/2020 at 10:38 AM #116844Actually, I did mean the longer timeframes I mentioned (1, 5 & 30min) just to give the 1 hour timeframe enough bars to calculate my indicators considering the PreLoadBars maximum of 10,000. But your times frames (1, 5 & 30 secs) now also works even if I have to run it for a little while to provide the 1 hour timeframe with enough bars to start calculating the indicators correctly 😉
As IG currently only provides ProRealTime version 10.3, I still have one last open question on ProRealTime version 11, especially considering that I read somewhere that the “new” back-testing now caters for a 1 million bar lookback…
Does ProRealTime version 11 cater for a larger value for PreLoadBars for ProOrder in order to cater for MultiTimeFrame data requirements?
1 user thanked author for this post.
01/15/2020 at 1:18 PM #116868When using MTF in a strategy, the Preloadbars will load maximum 10k bars for all timeframes declared in the code. But, bear in mind that calculation will start at the first bar of the default timeframe (the shorter one).
However, even with 1M bars, as that it will be possible with v11, I don’t think that it is necessary to get more than 10k bars preloaded, the principle of testing strategy will be the same as now, despite the fact that we will have more history available.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on