trading stopped due to defparam Preloadbars = 10000 issue
Forums › ProRealTime English forum › ProRealTime platform support › trading stopped due to defparam Preloadbars = 10000 issue
- This topic has 6 replies, 3 voices, and was last updated 1 year ago by jjduga.
-
-
09/05/2023 at 10:56 PM #220385
Hello everyone.
My code has been working fine on Demo and also yesterday on live trading. I am trying to run it on the 5 min US500 on IG platform in the UK. From today (5.9.2023) it has been stopping when used for live trading by giving the infamous ” insufficient historical data loaded to calculate at least one indicator … try DEFPARAM preloadbars = 10000″.
I have been instructing the “DEFPARAM preloadbars = 10000” from the offset as I have run into this issue before. I am using several indicators in my code and the one with the longest period is a TEMA (540).
I am using PRT v10.3
Thanks in advance
09/06/2023 at 9:28 AM #22039509/06/2023 at 9:37 AM #220398Alternatively submit a Technical Report direct to PRT using Help > Help Center > I’m having a Technical Problem. (Help > etc on the PRT Platform).
Best is to submit Report as above and continue yourself also re NO Call Indicators etc.
1 user thanked author for this post.
09/06/2023 at 9:53 AM #220403The issue lies in these two lines:
12c5 = (indicator7 > indicator8[120])c6 = (indicator9 > indicator10[98])because ProOrder has to multiply 240 periods (Ema) by 120 or 98.
Since an EMA requires roughly twice its periods (in this case about 450 periods) for its calculations, the two multiplications return results well exceeding 10k.
Try reducing those two lookback values or try using an IF…ENDIF to make sure trading starts AFTER 55K bars (maybe a bit less, it’s just a matter of trying different values):
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109DEFPARAM Preloadbars = 10000// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.DEFPARAM FLATBEFORE = 010000// Cancel all pending orders and close all positions at the "FLATAFTER" timeDEFPARAM FLATAFTER = 213000// Prevents the system from placing new orders to enter the market or increase position size after the specified timeIF BarIndex > 55000 THENnoEntryAfterTime = 210000timeEnterAfter = time < noEntryAfterTime// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0IF Not OnMarket THENBreakEven0 = 0ELSIF LongOnMarket THENIF (close - Tradeprice) >= (1 * pipsize) THENBreakEven0 = TradePrice - 2 * pipsizeENDIFIF BreakEven0 THENSELL AT BreakEven0 STOPENDIFENDIFIF Not OnMarket THENBreakEven4 = 0ELSIF LongOnMarket THENIF (close - Tradeprice) >= (2 * pipsize) THENBreakEven4 = TradePrice + 1 * pipsizeENDIFIF BreakEven4 THENSELL AT BreakEven4 STOPENDIFENDIFIF Not OnMarket THENBreakEven1 = 0ELSIF LongOnMarket THENIF (close - Tradeprice) >= (4 * pipsize) THENBreakEven1 = TradePrice + 3 * pipsizeENDIFIF BreakEven1 THENSELL AT BreakEven1 STOPENDIFENDIFIF Not OnMarket THENBreakEven2 = 0ELSIF LongOnMarket THENIF (close - Tradeprice) >= (6 * pipsize) THENBreakEven2 = TradePrice + 5 * pipsizeENDIFIF BreakEven2 THENSELL AT BreakEven2 STOPENDIFENDIFIF Not OnMarket THENBreakEven3 = 0ELSIF LongOnMarket THENIF (close - Tradeprice) >= (9 * pipsize) THENBreakEven3 = TradePrice + 7 * pipsizeENDIFIF BreakEven3 THENSELL AT BreakEven3 STOPENDIFENDIF// Conditions to enter long positionsindicator1, ignored = CALL "DPO-Detrended Price Oscillator"[30, 1, 1](close)userindic1, ignored = CALL "DPO-Detrended Price Oscillator"[30, 1, 1](close)indicator2 = DEMA[12](userindic1)c1 = (indicator1 CROSSES OVER indicator2)indicator3 = ExponentialAverage[25](MoneyFlowIndex[14])indicator4 = ExponentialAverage[3](MoneyFlowIndex[14])c2 = (indicator3 >= indicator4)indicator5 = MoneyFlowIndex[14]c3 = (indicator5 > 30)indicator6 = CALL "Choppiness index"[25](close)c4 = (indicator6 <= 70)indicator7 = ExponentialAverage[240](close)indicator8 = ExponentialAverage[240](close)c5 = (indicator7 > indicator8[120])indicator9 = ExponentialAverage[240](close)indicator10 = ExponentialAverage[240](close)c6 = (indicator9 > indicator10[98])indicator11 = TEMA[540](close)c7 = (close >= indicator11)IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 AND c7) AND timeEnterAfter AND not daysForbiddenEntry THENBUY 1 PERPOINT AT MARKETENDIF// Conditions to exit long positionsindicator12 = DEMA[5](MoneyFlowIndex[14])indicator13 = DEMA[30](MoneyFlowIndex[14])c8 = (indicator12 CROSSES UNDER indicator13)IF c8 THENSELL AT MARKETENDIF// Stops and targetsSET STOP pLOSS 5SET TARGET pPROFIT 12ENDIFThe main issue is when you launch it in autotrading… it’ll wait quite many days before the trading starts!
09/06/2023 at 7:57 PM #22046509/06/2023 at 7:59 PM #220466Grazie Roberto
I will give this a go. Thanks to GraHal too.
I will keep you posted. Won’t be able to give it a go until the weekend due to work though. But thanks both
2 users thanked author for this post.
09/17/2023 at 9:49 PM #221179The issue is now resolved after following Roberto’s advise.
1 user thanked author for this post.
-
AuthorPosts