Preload bars error message
08/16/2019 at 2:25 PM #104865
Even after i increase the defparam preloadbars = 5000 i still get the error message and my automatic code is rejected. I have tried setting to 0 and also removed it totally and my code still stops. The error message is the basic …please increase the number off preloaded bars with instruction DEFPARAM etc etc
Code works fine on back test – has also previously worked as automatic code before i have increase some filters in the code which is now causing the problem.08/16/2019 at 2:37 PM #104866
Try to increase to 10,000 (max. allowed).
In case you use very high period numbers for indicators, try decreasing them.
As a final resort you should post your full code to be able to replicate those messages.08/16/2019 at 3:25 PM #104871code with issue123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180Roberto , detailed code below as tried the solutions and still rejects code.//pending orders version//version (c)://mid bollinger cancel and closing time of pending orders//version (d)://max loss + breakeven + std conditionsdefparam flatafter=205500 //close opened orders and delete pending ones at that timedefparam cumulateorders=falsedefparam preloadbars= 10000// --- settingsamount = 3 //amount of contract/lot/shares to open for each orderStartTime = 143000 //start time of the strategy to look for a spike outside BBEndTime = 205500 //end time of the strategyBreakAboveBelowBB = 2//Break above/below BB (3points)BreakBarDistance = 2//Break below low/high of reference bar (2points)StopL = 1//Stop (2 point break of reference bar)TargetP = 95 //Target (Mid Bollinger 95%)MinTarget = 8//Minimum target for NO trade(10 points)MaxLoss = tp //Maximum loss in points for any orderBreakevenStart = 60//breakeven activation at x% of target achievedPointsToKeep = 5 //how much pips/points to keep in profit above of below our entry price when the breakeven is activated (beware of spread)MaxSTD = 14 //max standard deviation level to activate/cancel the ordersSTDperiod = 10//standard deviation period used for calculationMaxADX = 18ADXperiod = 16adxp=adxpindicator1 = ADX[adxp]indicator2 = ADXR[adxp]c1 = (indicator1 < indicator2)// Conditions to enter short positionsindicator3 = ADX[adxp]indicator4 = ADXR[adxp]c2 = (indicator3 < indicator4)// --- end of settingstcondition = opentime>=starttime and time<=endtimedcondition = OpenDayOfWeek = 6bbup = BollingerUp(close)bbdn = BollingerDown(close)mid = averageistd = std[STDperiod]iadx = adx[ADXperiod]//reset ref barif longonmarket thenhhrefbar=0endifif shortonmarket thenllrefbar=0endifif not tcondition thenhhrefbar=0llrefbar=0endifif not longonmarket and hhrefbar>0 and high crosses over mid thenhhrefbar=0endifif not shortonmarket and llrefbar>0 and low crosses under mid thenllrefbar=0endifif tcondition and not dcondition thenif not shortonmarket then//find first new BB+ ref bar = SHORT ORDERif llrefbar=0 then //first refif high>=bbup+BreakAboveBelowBB*pointsize thenll=lowsellsl=high+StopL*pointsizellrefbar=barindexlastref=-1endifelse //next refif high>high[max(1,barindex-llrefbar)] then //compute new reference barll=lowsellsl=high+StopL*pointsizellrefbar=barindexlastref=-1endifendifendifif not longonmarket then//find first new BB- ref bar = BUY ORDERif hhrefbar=0 then //first refif low<=bbdn-BreakAboveBelowBB*pointsize thenhh=highbuysl=low-StopL*pointsizehhrefbar=barindexlastref=1endifelse //next refif low<low[max(1,barindex-hhrefbar)] then //compute new reference barhh=highbuysl=low-StopL*pointsizehhrefbar=barindexlastref=1endifendifendif//break ref bar and open orders//case buyif not longonmarket and lastref>=0 and barindex>=hhrefbar and hhrefbar>0 then //and high>=hh+BreakBarDistance*pointsize thenavg = average(close)tp = (avg-(hh+BreakBarDistance*pointsize))*(TargetP/100)allowtarget = tp>=MinTarget*pointsizeif allowtarget and istd<maxstd*pointsize or iadx<maxadx and c1 thenbuy amount contract at hh+BreakBarDistance*pointsize stop//hhrefbar=0 //reset ref barset stop loss min(maxloss*pointsize,close-buysl)set target profit tpendifendif//case sellif not shortonmarket and lastref<=0 and barindex>=llrefbar and llrefbar>0 then // and low<=ll-BreakBarDistance*pointsize thenavg = average(close)tp = ((ll-BreakBarDistance*pointsize)-avg)*(TargetP/100)allowtarget = tp>=MinTarget*pointsizeif allowtarget and istd<maxstd*pointsize or iadx<maxadx and c2 thensellshort amount contract at ll-BreakBarDistance*pointsize stop//llrefbar=0 //reset ref barset stop loss min(maxloss*pointsize,sellsl-close)set target profit tpendifendifendifstartBreakeven = (BreakevenStart/100)*tp //how much pips/points in gain to activate the breakeven function?//reset the breakevenLevel when no trade are on marketIF NOT ONMARKET THENbreakevenLevel=0ENDIF// --- BUY SIDE ---//test if the price have moved favourably of "startBreakeven" points alreadyIF LONGONMARKET AND close-tradeprice(1)>=startBreakeven THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)+PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENSELL AT breakevenLevel STOPENDIF// --- end of BUY SIDE ---// --- SELL SIDE ---//test if the price have moved favourably of "startBreakeven" points alreadyIF SHORTONMARKET AND tradeprice(1)-close>=startBreakeven THEN//calculate the breakevenLevelbreakevenLevel = tradeprice(1)-PointsToKeep*pipsizeENDIF//place the new stop orders on market at breakevenLevelIF breakevenLevel>0 THENEXITSHORT AT breakevenLevel STOPENDIF// --- end of SELL SIDE ---//graph tp//graph hh+BreakBarDistance*pointsize coloured(0,255,0) as "reference buy"//graph ll-BreakBarDistance*pointsize coloured(255,0,0) as "reference sell"//graph allowtarget//graph close as "price Close"//graph not longonmarket and hhrefbar>0 and high crosses over mid//graph breakevenlevel08/16/2019 at 4:15 PM #10487408/16/2019 at 4:16 PM #10487508/16/2019 at 4:31 PM #104878
Restarted everything and reloaded and error happens again .
I can back test no problem with the code without errors its when i then put it live – it loads it then rejects it after a few minutes.
im running it on the DOW on 1 and 3 minute time frames.08/16/2019 at 5:34 PM #10488108/16/2019 at 6:13 PM #104886
Backtest is very slow, instead!
I agree … maybe the OP just chose the wrong Username! 🙂 🙂
I will try it on Demo Forward test and Report back!
EDIT / PS
Yep rejected 3 times with and without the PreLoad bars I get same error message … Increase PreLoad bars etc etc.08/16/2019 at 6:55 PM #104890
I reckon it’s timing out on Forward Test (code taking too long etc) and the error message is meaningless?
On Backtest there is probably a longer time out period and that is why the code eventually gets there in Backtest??
Basis for an easy worded Tech Report? I suggest …
08/16/2019 at 7:43 PM #104891
- System won’t run on Forward Test … please can you tell me why?
So u suggest I ask tech support with that so I therefore will with yr suggested comments . back testing is very slow due to all the requirements it has to test … let’s see if they have a solution .. ? Seems strange to me08/16/2019 at 8:02 PM #104892
Yeah we all learn more when we make mistakes, we need to know what the limits are on time for code to run and PRT may learn something also during the investigation ?
It may be something simple anyway that is making it real slow?
Results (attached) look promising on DJI 1M, spread = 4 attached so it is worth keeping the code as is if it will run okay?
Press Ctrl + M when you are seeing a Chart on the screen and follow the bottom option … Tech Report.
You must be logged in to access attached files.08/17/2019 at 10:20 AM #10491308/17/2019 at 10:54 AM #104919
There is something odd about that code even outside of PRT … as soon as have it up on my screen in this Forum and I am scrolling over the code … my scroll button works real slow like when I am running out of RAM.
I reckon it’s that Username the OP has … he’s jinxed himself!!! (joke! 🙂 )
But not joking about the slow mouse scroll.08/19/2019 at 1:38 PM #10507008/27/2019 at 10:11 AM #105637
Just spent the last hour or so removing various snippets / conditions / variables etc in an effort to stop this System being rejected and showing an error message that has nothing to do with the rejection!
Below is the fix. Seems it maybe was timeout error as I had suggested above?
Code was using ADXPeriod and ADXp for the same value, but ADXp was not defined anywhere in the code.12Line 36adxp=adxperiod (not adxp=adxp)
1 user thanked author for this post.