missing trade on backtest
Forums › ProRealTime English forum › ProOrder support › missing trade on backtest
- This topic has 2 replies, 2 voices, and was last updated 5 years ago by
ullle73.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
11/08/2020 at 6:37 PM #149849
Hi, anyone knows why backtest missing this entry and exit? I even increased spread on backtest to 8 points to see if it would take the trade, but it didnt.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257// Definition of code parametersDEFPARAM CumulateOrders = false // Cumulating positions deactivatedDEFPARAM preloadbars = 5000//Money ManagementMM = 0 // = 0 for optimizationif MM = 0 thenpositionsize=1ENDIFif MM = 1 thenONCE startpositionsize = 1ONCE factor = 6 // factor of 10 means margin will increase/decrease @ 10% of strategy profit; factor 20 = 5% etcONCE margin = (close*.005) // tier 1 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE margin2 = (close*.01)// tier 2 margin value of 1 contract in instrument currency; change decimal according to available leverageONCE tier1 = 200 // IG first tier margin limitONCE maxpositionsize = 2000 // IG tier 2 margin limitONCE minpositionsize = 1 // enter minimum position allowedIF Not OnMarket THENpositionsize = startpositionsize + Strategyprofit/(factor*margin)ENDIFIF Not OnMarket THENIF startpositionsize + Strategyprofit/(factor*margin) > tier1 thenpositionsize = (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 //incorporating tier 2 marginENDIFIF Not OnMarket THENif startpositionsize + Strategyprofit/(factor*margin) < minpositionsize THENpositionsize = minpositionsize //keeps positionsize from going below allowed minimumENDIFIF (((startpositionsize + (Strategyprofit/(factor*margin))-tier1)*(factor*margin))/(factor*margin2)) + tier1 > maxpositionsize thenpositionsize = maxpositionsize// keeps positionsize from going above IG tier 2 margin limitENDIFENDIFENDIFENDIFCtime = time >= 0 and time < 230000TIMEFRAME(2 hours,updateonclose)Period= 460inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)c1 = HULLa > HULLa[1]c2 = HULLa < HULLa[1]ST1 = SuperTrend[3.5,7]c4 = (close < ST1)ma1 = average[58,4](close)c6 = ma1 < ma1[1]//Stochastic RSI | indicatorlengthRSI = 7 //RSI periodlengthStoch = 12 //Stochastic periodsmoothK = 10 //Smooth signal of stochastic RSIsmoothD = 2 //Smooth signal of smoothed stochastic RSImyRSI = RSI[lengthRSI](close)MinRSI = lowest[lengthStoch](myrsi)MaxRSI = highest[lengthStoch](myrsi)StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)K = average[smoothK](stochrsi)*100D = average[smoothD](K)c8 = K<DTIMEFRAME(30 minutes,updateonclose)indicator5 = Average[2](typicalPrice)indicator6 = Average[5](typicalPrice)c10 = (indicator5 < indicator6)TIMEFRAME(15 minutes,updateonclose)mac = average[40,1](close)c11 = mac > mac[1]c12 = mac < mac[1]Periodc= 17innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)HULLc = weightedaverage[round(sqrt(Periodc))](innerc)c14 = HULLc < HULLc[1]TIMEFRAME(10 minutes)indicator4 = SuperTrend[2.5,7]indicator4a = SAR[0.025,0.025,0.15]c22 = (close < indicator4) or (close < indicator4a)TIMEFRAME(5 minutes)//Stochastic RSI | indicatorlengthRSIa = 11 //RSI periodlengthStocha = 5 //Stochastic periodsmoothKa = 11 //Smooth signal of stochastic RSIsmoothDa = 5 //Smooth signal of smoothed stochastic RSImyRSIa = RSI[lengthRSIa](close)MinRSIa = lowest[lengthStocha](myrsia)MaxRSIa = highest[lengthStocha](myrsia)StochRSIa = (myRSIa-MinRSIa) / (MaxRSIa-MinRSIa)Ka = average[smoothKa](stochrsia)*100Da = average[smoothDa](Ka)c16 = Ka<DaPeriodb= 21innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)c19 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]c20 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]// Conditions to enter short positionsIF Ctime and c2 AND C4 AND C6 and c8 and c10 and c12 and c14 and c16 and c20 and c22 THENSELLSHORT positionsize CONTRACT AT MARKETSET STOP %LOSS 1.7SET TARGET %PROFIT 2.5ENDIF//================== exit in profitIf shortonmarket and C11 and c19 and close<positionprice thenexitshort at marketendif//==============exit at lossIf shortonmarket and c1 and c19 and close>positionprice thenexitshort at marketendif//%trailing stop functiontrailingpercentlong = .29 // %trailingpercentshort = .34 // %stepPercentlong = .006stepPercentshort = .009sensitivity = (low+high+close)/3if onmarket thentrailingstartlong = tradeprice(1)*(trailingpercentlong/100) //trailing will start @trailingstart points profittrailingstartshort = tradeprice(1)*(trailingpercentshort/100) //trailing will start @trailingstart points profittrailingsteplong = tradeprice(1)*(stepPercentlong/100) //% step to move the stoplosstrailingstepshort = tradeprice(1)*(stepPercentshort/100) //% step to move the stoplossendif//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND sensitivity-tradeprice(1)>=trailingstartlong THENnewSL = tradeprice(1)+trailingsteplongENDIF//next movesIF newSL>0 AND sensitivity-newSL>trailingsteplong THENnewSL = newSL+trailingsteplongENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-sensitivity>=trailingstartshort THENnewSL = tradeprice(1)-trailingstepshortENDIF//next movesIF newSL>0 AND newSL-sensitivity>trailingstepshort THENnewSL = newSL-trailingstepshortENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF//************************************************************************IF shortonmarket and barindex-tradeindex>415 and close>positionprice thenexitshort at marketendif//=============================================if shortonmarket and abs(open-close)<1 and low[1]>low and close-low>16 and close<positionprice thenexitshort at marketendif//===================================myrsiM5=rsi[14](close)if myrsiM5>60 and barindex-tradeindex>1 and shortonmarket and close<positionprice thenexitshort at marketendif// --------- US DAY LIGHT SAVINGS MONTHS ---------------- //mar = month = 3 // MONTH STARTnov = month = 11 // MONTH ENDIF (month > 3 AND month < 11) OR (mar AND day>14) OR (mar AND day-dayofweek>7) OR (nov AND day<=dayofweek AND day<7) THENUSDLS=010000ELSEUSDLS=0ENDIFonce shortStep = 0once openStrongLong = 0if not onmarket or (time <= 143000 - USDLS and time >= 210000 - USDLS) thenshortStep = 0openStrongLong = 0endif//detect strong direction for market openonce rangeOK = 50once tradeMin = 500IF (time >= 144000 - USDLS) AND (time <= 144000 + tradeMin - USDLS) THENopenStrongLong = close > open AND close - open > rangeOKENDIFonce bollperiod = 20once bollMAType = 1once s = 2once BollLevel = 90once BollSR = 50bollMA = average[bollperiod, bollMAType](close)STDDEV = STD[bollperiod]bollUP = bollMA + s * STDDEVbollDOWN = bollMA - s * STDDEVIF bollUP = bollDOWN THENbollPercent = 50ELSEbollPercent = 100 * (close - bollDOWN) / (bollUP - bollDOWN)ENDIF//Market spike upIF shortonmarket AND shortStep = 0 AND bollPercent > BollLevel THENshortStep = 1ENDIF//Market slowly come downIF shortonmarket AND shortStep = 1 AND bollPercent < 100 - BollLevel THENshortStep = 2ENDIF//Market still go back to bullish and supported after strong bull open, exitIF shortonmarket AND shortStep = 2 AND bollPercent > BollSR AND openStrongLong THENexitshort at marketENDIFonce trendPeriod = 70once trendPeriodResume = 30once trendGap = 3once trendResumeGap = 6if not onmarket thenfullySupported = 0endif//Market supported in the wrong directionIF shortonmarket AND fullySupported = 0 AND summation[trendPeriod](bollPercent > 50) >= trendPeriod - trendGap THENfullySupported = 1ENDIF//Market pull back but continue to be supportedIF shortonmarket AND fullySupported = 1 AND bollPercent[trendPeriodResume + 1] < 0 AND summation[trendPeriodResume](bollPercent > 50) >= trendPeriodResume - trendResumeGap THENexitshort at marketENDIF//Started real wrong directiononce strongTrend = 70once strongPeriod = 6IF shortonmarket and openStrongLong and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent > strongTrend) = strongPeriod thenexitshort at marketENDIF11/08/2020 at 8:01 PM #14985911/09/2020 at 12:06 AM #149863 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: