Why is this strategy not well calculated? – solved
Forums › ProRealTime English forum › ProOrder support › Why is this strategy not well calculated? – solved
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by pieroim.
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
10/09/2017 at 10:21 AM #48732
Solved… a stupid mistake.. pardon..
This is a very simple strategy for better understanding programming with PRT. But the backtest gives me strange results .. what I’m doing of wrong?
ichimoku strategy12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394//Stategy: IchimDefparam CUMULATEORDERS = Falseonce prevdirection = 0 //1 = buy, 2 = sellpossize = 1stoploss = 0.0100 //points 0.0010 10 pipsprofitto = 0.0100//indicators---------------------------------------------------------------------------------T = 9 //Tenkan-Sen Period (9)I = 26 //Chikou-Span Period (26)K = 52 //Kijun-Sen Period (52)TS = (highest[T](high)+lowest[T](low))/2 //Tenkan-SenKS = (highest[I](high)+lowest[I](low))/2 //Kijun-SenSA = (TS[I]+KS[I])/2 //Senkou-Span ASB = (highest[K](high[I])+lowest[K](low[I]))/2 //Senkou-Span B//end of indicators--------------------------------------------------------------------------//Signals------------------------------------------------------------------------------------//Kumo parameterskumoUP =0kumoDOWN =0if SA[0]>SB[0] thenkumoUP=SA[0]kumoDOWN=SB[0]elsekumoUP=SB[0]kumoDOWN=SA[0]endif//mini price trendprimo = (high[3]+low[3])/2ultimo = (high[0]+low[0])/2spread = pointsize*2miniTrPr= ultimo-primominiTrPr= miniTrPr/spread//end of signals------------------------------------------------------------------------------------//Orders--------------------------------------------------------------------------------------------if prevdirection = 2 or prevdirection = 0 thenif countofposition = 0 and entrataAquisto = 0 and entrataVendita = 0 and open[0]>kumoUP and close[0]>open[0] and miniTrPr>5 thenBuy possize contracts at marketset target profit profitto// profit in pointsSET STOP LOSS stoplossentrataAquisto = 1prevdirection = 1endifendifif prevdirection = 1 or prevdirection = 0 thenif countofposition = 0 and entrataVendita = 0 and entrataAquisto = 0 and close[0]<kumoDOWN and close[0]<open[0] and miniTrPr<-5 thenSellshort possize contracts at marketset target profit profitto// profit in pointsSET STOP LOSS stoplossentrataVendita = 1prevdirection = 2endifendif//End of orders-------------------------------------------------------------------------------------//Exit Conditions-----------------------------------------------------------------------------------if entrataAquisto = 1 and open[0]>kumoDOWN and open[0]<kumoUP and close[0]>kumoDOWN and close[0]<kumoUP thenSell at marketendifif entrataVendita = 1 and open[0]>kumoDOWN and open[0]<kumoUP and close[0]>kumoDOWN and close[0]<kumoUP thenexitshort at marketendifIF NOT ShortOnMarket THENentrataVendita = 0ENDIFIF NOT LongOnMarket THENentrataAquisto = 0ENDIFif (open[0]>kumoDOWN and open[0]<kumoUP) and (close[0]>kumoDOWN and close[0]<kumoUP) thenprevdirection = 0endifgraph entrataVendita coloured (255,0,0) as "vendita"//graph entrataAquisto coloured (255,0,0) as "aquisto"graph prevdirection coloured (255,0,0) as "prevdirection"graph kumoUP coloured (0,255,0) as "kumoUP"graph kumoDOWN coloured (0,255,0) as "kumoDOWN"graph miniTrPr coloured (0,255,0) as "miniTrPr"//Exit of exit conditions---------------------------------------------------------------------------10/09/2017 at 11:56 AM #4876010/09/2017 at 12:11 PM #4876310/09/2017 at 1:12 PM #4877310/09/2017 at 1:41 PM #4877510/09/2017 at 7:44 PM #48806Thank’s Nicolas, very strange behavior of PRT backtest..
However, your suggestion has led me to the solution..
I replaced:
123456IF NOT ShortOnMarket THENentrataVendita = 0ENDIFIF NOT LongOnMarket THENentrataAquisto = 0ENDIFsimply with:
12entrataVendita = ShortOnMarketentrataAquisto = LongOnMarketNow all works great!
Thank’s
Piero
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)