Error with historical data
Forums › ProRealTime English forum › ProOrder support › Error with historical data
- This topic has 25 replies, 4 voices, and was last updated 5 years ago by
Tanou.
-
-
09/30/2020 at 6:28 PM #145999
Hello,
I keep getting one of my trading system rejected and I can sort it out…
The error is “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.” However, I don’t need much preloadbars for this system and I don’t see any mistakes.
It is currently running on demo without problems and I was trying to implement it on the 10 seconds DAX 1€ and prt keep cutting it of for a reason that I don’t see…!
I know that some of you already encountered this kind of problem and I already had a look at how it has been solved but I can’t relate my case to those as I don’t find the same mistakes!
Thanks for your help 😀
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104//-------------------------------------------------------------------------// Code principal : PPJ avec trailing stop v2//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Code principal : PPJ avec trailing stop v2//-------------------------------------------------------------------------DEFPARAM PRELOADBARS = 3000// Cumul des positions désactivéDEFPARAM CumulateOrders = False//************************************************************************//Horaires de trading// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".DEFPARAM FLATBEFORE = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 170000// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position avant l'heure spécifiéenoEntryBeforeTime = 080000timeEnterBefore = time >= noEntryBeforeTime// Empêche le système de placer des ordres pour entrer sur le marché ou augmenter la taille d'une position après l'heure spécifiéenoEntryAfterTime = 170000timeEnterAfter = time < noEntryAfterTime// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//************************************************************************IF Time < Time[1] THENPlusHaut = HighPlusBas = LowPP = (PlusHaut[1] + PlusBas[1] + Close[1]) / 3Premierpassage=0ELSEPlusHaut = Max(High,PlusHaut[1])PlusBas = Min(Low,PlusBas[1])PP = PP[1]ENDIF//************************************************************************// Conditions pour ouvrir une position acheteusec1 = (close CROSSES UNDER pp)IF c1 AND timeEnterBefore AND timeEnterAfter AND Premierpassage=0 AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETPremierpassage=1SET STOP pLOSS 50ENDIF// Conditions pour ouvrir une position en vente à découvertc2 = (close CROSSES OVER pp)IF c2 AND timeEnterBefore AND timeEnterAfter AND Premierpassage=0 AND not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETPremierpassage=1SET STOP pLOSS 50ENDIF//************************************************************************//trailing stop functiontrailingstart = 5 //trailing will start @trailinstart points profittrailingstep = 10 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart THENnewSL = tradeprice(1)+trailingstepENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep THENnewSL = newSL+trailingstepENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart THENnewSL = tradeprice(1)-trailingstepENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep THENnewSL = newSL-trailingstepENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************09/30/2020 at 8:10 PM #146009Give your topic a meaningful title.Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’.
Error is meaningless.
Thank you 🙂
09/30/2020 at 8:14 PM #14601209/30/2020 at 9:49 PM #146024You can set preloaded bars to its maximum which is 10K, despite your code does not seem to need them.
Don’t duplicate posts, leave them where they are and the way they are.
09/30/2020 at 9:52 PM #146025Ok understood!
However I already tried that and as you said it does not even require that amount.
This is the problem and I can’t figure out what could be the problem… It keeps telling me that I don’t have enough preload bars. I think the problem is elsewhere but can’t figure out where. That’s why I came to you guys 🙂
09/30/2020 at 10:19 PM #146028Surely below will not work?
Below may cause the Algo stoppage … despite what the error message says?
You need the Trail Start to be more than the Trail Step (usually Start is several times the Step),
12trailingstart = 5 //trailing will start @trailinstart points profittrailingstep = 10 //trailing step to move the "stoploss"10/01/2020 at 7:53 AM #14603910/01/2020 at 8:44 AM #146051Hello GraHal, Nicolas,
Thanks for your proposal GraHal! However I already have som systems that are currently running and have that set up. Just to be sure I tried and same, the system is kicked out…
@Nicolas, I’m currently in v10.3-1.8.0_202. Do you think it could come from the plateform?1 user thanked author for this post.
10/01/2020 at 8:54 AM #14605210/01/2020 at 8:56 AM #14605310/01/2020 at 9:02 AM #14605410/01/2020 at 9:05 AM #146055Try this, in this order, and make a test after each step if it solves the issue:
- remove the preloadbars line completely
- change the line 30 with: “if day<>day[1]”
- change the lines 46 and 55 by adding: “and pp>0” at the end of the lines (c1 and c2 conditions)
10/01/2020 at 9:11 AM #14605610/01/2020 at 9:27 AM #14605910/01/2020 at 9:30 AM #146060Because with this formula I don’t get the right PP..
With this formula I get the right one
1234567891011IF Time < Time[1] THENPlusHaut = HighPlusBas = LowPP = (PlusHaut[1] + PlusBas[1] + Close[1]) / 3Premierpassage=0ELSEPlusHaut = Max(High,PlusHaut[1])PlusBas = Min(Low,PlusBas[1])PP = PP[1]ENDIFAnd with this one I get another daily pp which isn’t good
12345Ht = DHigh(1)Bs = DLow(1)C = DClose(1)PP = (Ht + Bs + C) / 3 -
AuthorPosts
Find exclusive trading pro-tools on