Code fails to run – Insufficient Data!

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #177634 quote
    smp
    Participant
    Average

    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?

    error.png error.png
    #177644 quote
    Nicolas
    Keymaster
    Master

    What is the max period used by any indicator of your system? Custom or default one?

    #177646 quote
    smp
    Participant
    Average

    I use the default 10000 units now.  When I first installed I used 200 units but changing from 200 to 10000 seems to have made no difference at all

    #177651 quote
    Nicolas
    Keymaster
    Master

    Sorry but you did not answered the question. In your code, are you using indicators suchs as EMA, RSI, etc? If yes, what is the maximum period used in the code?

    #177652 quote
    smp
    Participant
    Average

    Sorry,

    I enclose the indicator called “KEY”

    Also, the code that calls it up

     

    Hope this helps

    US500-60-KEY-LONG_V0.1DEV.itf KEY.itf
    #177660 quote
    JS
    Participant
    Senior

    PreLoadBars

    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.

    smp and jjduga thanked this post
    #177723 quote
    Nicolas
    Keymaster
    Master

    Well, 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.

    smp thanked this post
    #177731 quote
    smp
    Participant
    Average

    Thanks, reported issue to PRT

    #177752 quote
    GraHal
    Participant
    Master

    smpaxton  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! 🙂

    #177760 quote
    smp
    Participant
    Average

    GraHal,

    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!

    GraHal, JS and jjduga thanked this post
    #178247 quote
    smp
    Participant
    Average

    Guys,

    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
    endif

    #178248 quote
    deleted23092025
    Participant
    New

    JS

    preloadbars can be det over 5000? I have out it on 200000 on some of my robots?

    #178255 quote
    GraHal
    Participant
    Master

    It 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).

    smp thanked this post
    #178256 quote
    GraHal
    Participant
    Master

    I 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.

    smp thanked this post
    #178257 quote
    robertogozzi
    Moderator
    Master

    If the result of high-low is zero, then the division is impossible.

    They suggested a solution.
    I think a better solution would be:

    x = hhigh – llow
    if x = 0 then
       x = 1
    endif
    temp = 0.66 * ((mean – llow) / x – 0.5) + 0.67 * Ld3
    smp thanked this post
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

Code fails to run – Insufficient Data!


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
smp @smpaxton Participant
Summary

This topic contains 18 replies,
has 6 voices, and was last updated by robertogozzi
4 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/15/2021
Status: Active
Attachments: 4 files
Logo Logo
Loading...