Code fails to run – Insufficient Data!
Forums › ProRealTime English forum › ProOrder support › Code fails to run – Insufficient Data!
- This topic has 18 replies, 6 voices, and was last updated 3 years ago by robertogozzi.
Tagged: division, division by zero, preloadbars, zero
-
-
09/15/2021 at 12:55 PM #177634
Guys,
In my code, I called up an indicator but every time it tries to run, it fails and gives the same error (Attached below). I have DEFRAM Preloadbars set to 10000 as suggested in the error message; I also have loaded the code into a chart with units set to over 10000 units. However, it will still not run
It backtests no problem at all.
Using Version 10.3
Any ideas?
09/15/2021 at 3:21 PM #17764409/15/2021 at 3:24 PM #17764609/15/2021 at 3:58 PM #17765109/15/2021 at 4:06 PM #17765209/15/2021 at 4:46 PM #177660PreLoadBars
The instruction “DefParam PreLoadBars” lets you configure the maximum amount of bars that are preloaded prior to the start of a trading system for the calculation of indicators used in the system prior to the system’s start (personal or predefined indicators). By default this parameter is equal to 1000. It cannot be less than 0 or higher than 5000. If you want to deactivate preloading data, set PreLoadBars = 0.
The value selected is a maximum because the amount of bars that can be preloaded depends on the amount of data available for a given instrument and timeframe.
If one of your indicators use more than 5000 bars then you get this error.
09/16/2021 at 1:58 PM #177723Well, after inspection of the provided codes, I do not see any special reason why you get this error message. You should send an error report through the assistance tool of the platform.
1 user thanked author for this post.
09/16/2021 at 3:48 PM #17773109/17/2021 at 5:21 AM #177752smpaxton please let us know the PRT response.
So often Reject error messages do not appear logical and it is so frustrating for us all getting rejected in Live and yet Backtest shows no problems.
I would like to see PRT doing something toward aligning Live running and backtest re reject errors … even if it is only a series of hints / possible suggestions that gets flagged up after a backtest has run. Not stop / reject the backtest as that would mean more load of PRT servers, just flag up possible reasons and possible solutions to code that may / is likely to be rejected in Live.
I can feel another Suggestion for Improvement to PRT coming on! 🙂
09/17/2021 at 7:36 AM #177760GraHal,
Yes, no problem. I do know the IG PRT team and spoke about the issue yesterday and they assure me they will be looking at it as a priority as it’s not the first time this has happened. It’s one of the many reasons I will not use V11 of PRT yet as v11 has too many bugs that just are not been resolved!
09/23/2021 at 9:00 PM #178247Guys,
here is the final response from IG PRT, see blow. It does not make sense! Unless anyone can explain this!
We’ve been guided by Eduard at PRT that your code issue has been resolved with the below feedback:
His code is working on a 4 hours UT but not on 1hour UT.
The error message is :
“The trading system was stopped due to a division by zero in one of its sub-functions during the evaluation of the last candlestick.”After analyzing we saw that last candlestick has the same high and the same low as you can see below :
20210917:170000,20210917:180000,4419.08,4419.08,4419.08,4419.08,3+ in his code you can see this line:
high= highest[period](high)
llow = lowest[period](low)temp = 0.66 * ((mean – llow) / (hhigh – llow) – 0.5) + 0.67 * Ld36
Therefore you have a division by 0 (because here low = high):
high = low => (mean – llow) / (hhigh – llow)
If the clients wants to trade on this UT he has to use a protection in case of high = low.
Below you’ll find an example of protection:
if hhigh-llow<> 0 then
temp = 0.66 * ((mean – llow) / (hhigh – llow) – 0.5) + 0.67 * Ld36
endif09/23/2021 at 9:04 PM #17824809/23/2021 at 9:32 PM #178255It does not make sense! Unless anyone can explain this!
Looks to me that IG have got mixed up and sent you the solution to somebody else’s problem (divide by zero).
1 user thanked author for this post.
09/23/2021 at 9:39 PM #178256I have out it on 200000 on some of my robots?
PreLoad bars cannot be more than 10,000 … no matter what we set it to.
Default preload bars is 2000 and the max available is 10000.
1 user thanked author for this post.
09/23/2021 at 9:39 PM #178257If the result of high-low is zero, then the division is impossible.
They suggested a solution.
I think a better solution would be:12345x = hhigh – llowif x = 0 thenx = 1endiftemp = 0.66 * ((mean – llow) / x – 0.5) + 0.67 * Ld31 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on