The Best Ichimoku Strategy
Forums › ProRealTime English forum › ProOrder support › The Best Ichimoku Strategy
- This topic has 12 replies, 5 voices, and was last updated 3 years ago by robertogozzi.
-
-
10/31/2017 at 9:23 AM #51007
I have created this comprehensive strategy based on ichimoku. I optimized this on Germany cash 1 euro a CFD market TF 3H. The parameters to be optimized are both SL and TP but also the same ichimoku parameters based on the TF and the market. The goal is to improve it again and to make it perform well on other tools like forex. Thnaks.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322//-------------------------------------------------------------------------// Codice principale : ichi//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Codice principale : Ichimonu_trading//-------------------------------------------------------------------------//DEFPARAM FlatBefore = 080000//DEFPARAM FlatAfter = 220000DEFPARAM CumulateOrders = false//parametri calcolo ichimoku...fibonacci (8, 21, 55) e gli altri sono noti.I= 6//7//9//8//8P = 26//28//26//21//21U = 146//119//52//55//89//signal=0DojiSize = 0.08//0.13data=(abs(open - close) <= (high - low) * DojiSize)kk= dataMM = ExponentialAverage[8](close)MM2 = ExponentialAverage[89](close)//TTlong = close [1] crosses over MM OR close > MM AND MM[3]<MM[2] AND MM[2]<MM[1] AND MM[1] < MM//TTShort= close[1] crosses under MM OR close < MM AND MM[3]>MM[2] AND MM[2]>MM[1] AND MM[1] > MMTTlong= MM - MM[2] >= 1.4 AND CLOSE >MM AND CLOSE > MM2TTshort= MM[2] - MM >= 1.35 AND CLOSE < MM AND CLOSE < MM2//controllo direzione chikou per longKK1= chikou > chikou[1]//diffe= ((chikou -chikou[1])/chikou)*100//kk1= diffe >=a//controllo direzione chikou per shortkk2= chikou < chikou[1]//diffe1= ((chikou[1] -chikou)/chikou[1])*100//kk2= diffe1 >= b//Kijunsen piattaKK3= Kijunsen = Kijunsen[1] and Kijunsen[1] = Kijunsen[2]//IchimokuTenkansen = (highest[I](high)+lowest[I](low))/2Kijunsen = (highest[P](high)+lowest[P](low))/2SpanA = (tenkansen[P]+kijunsen[P])/2SpanB = (highest[U](high[P])+lowest[U](low[P]))/2//FutureSpanA = (tenkansen+kijunsen)/2//FutureSpanB = (highest[52](high)+lowest[52](low))/2Chikou = close// le condizioni sono volutamente ripetute per una maggiore visisibilità in fase di ottimizzazione. Una volta ottimizzata occorrerà creare delle condizioni uniche e non ridondanti.// SpanA > SpanB e brekout kumo LONGC1= SpanA > SpanBc2= close[1] crosses over SpanAC3= close > SpanAC4= close > Tenkansenc5= close > Kijunsenc6= chikou > Tenkansen[P]c7= chikou > Kijunsen [P]C8= chikou > Close[P]c9= chikou > SpanA[P]c10= chikou > SpanB[P]//BKUMOLONG= c1 and c2 and c3 and c4 and c5 and c6 and c7 and c8 and c9 and c10BKUMOLONG= c1 and c2 and c3 and c4 and c5 and c8 and c9 and c10 and c6 and c7 and not kk and kk1 and not kk3 and TTlong// SpanA < SpanB e brekout kumo LONGc11=SpanA < SpanBc12= close[1] crosses over SpanBC13= close > SpanBC14= close > Tenkansenc15= close > Kijunsenc16= chikou > Tenkansen[P]c17= chikou > Kijunsen [P]C18= chikou > Close[P]c19= chikou > SpanB[P]c191= chikou > SpanB[P]//BKUMOLONG1= c11 and c12 and c13 and c14 and c15 and c16 and c17 and c18 and c19 and c191BKUMOLONG1= c11 and c12 and c13 and c14 and c15 and c18 and c19 and c191 and c16 and c17 and not kk and kk1 and not kk3 and TTlong//SpanA > SpanB e croce d'oro sopra kumo LONGC20= SpanA > SpanBC21= Tenkansen crosses over KijunsenC22= chikou > Close[P]C23= close > Tenkansenc24= close > kijunsenc25= chikou > Tenkansen[P]c26= chikou > Kijunsen [P]C27= close > SpanA//OROLONG = c20 and c21 and c22 and c23 and c24 and c25 and c26 and c27OROLONG = c20 and c21 and c22 and c23 and c24 and c27 and c25 and c26 and not kk and kk1 and not kk3 and TTlong//SpanA < SpanB e croce d'oro sotto kumo LONGc28=SpanA < SpanBC29= Tenkansen crosses over KijunsenC30= chikou > Close[P]C31= close > Tenkansenc34= close > kijunsenc35= chikou > Tenkansen[P]c36= chikou > Kijunsen [P]//c37= close < SpanA//OROLONG1= c28 and c29 and c30 and c31 and c34 and c35 and c36 and c37OROLONG1= c28 and c29 and c30 and c31 and c34 and c35 and c36 and not kk and kk1 and not kk3 and TTlong// SpanA > SpanB Segnale tre linee sopra kumo LONGC38= SpanA > SpanBc39= Tenkansen > kijunsenc40= kijunsen > SpanAc41= Tenkansen > SpanAC42= close > SpanAC43= close > Tenkansenc44= close > kijunsenC420= close[1] > SpanAC430= close[1] > Tenkansenc440= close[1] > kijunsenc45= chikou > close[P]c46= chikou > SpanA[P]c47= chikou > SpanB[P]TRELINEELONG= c38 and c39 and c40 and c41 and c42 and c43 and c44 and c45 and c46 and c47 and c420 and c430 and c440 and not KK and kk1 and not kk3 and TTlong// SpanA < SpanB e brekout kumo SHORTC48= SpanA < SpanBc49= close[1] crosses under SpanAC50= close < SpanAC51= close < Tenkansenc52= close < Kijunsenc53= chikou < Tenkansen[P]c54= chikou < Kijunsen [P]C55= chikou < Close[P]c56= chikou < SpanA[P]c57= chikou < SpanB[P]BKUMOSHORT= c48 and c49 and c50 and c51 and c52 and c53 and c54 and c55 and c56 and c57 and not kk and kk2 and not kk3 and TTshort// SpanA > SpanB e brekout kumo SHORTC58= SpanA > SpanBc59= close[1] crosses under SpanBC60= close < SpanBC61= close < Tenkansenc62= close < Kijunsenc63= chikou < Tenkansen[P]c64= chikou < Kijunsen [P]C65= chikou < Close[P]c66= chikou < SpanA[P]c67= chikou < SpanB[P]//BKUMOSHORT1= c58 and c59 and c60 and c61 and c62 and c63 and c64 and c65 and c66 and c67BKUMOSHORT1= c58 and c59 and c60 and c61 and c62 and c65 and c66 and c67 and c63 and c64 and not kk and kk2 and not kk3 and TTshort//SpanA > SpanB e croce morte sopra kumo SHORTC68= SpanA > SpanBC69= Tenkansen crosses under KijunsenC70= chikou < Close[P]C71= close < Tenkansenc72= close < kijunsenc73= chikou < Tenkansen[P]c74= chikou < Kijunsen [P]//C75= close > SpanA//MORTESHORT= c68 and c69 and c70 and c71 and c72 and c73 and c74 and c75MORTESHORT= c68 and c69 and c70 and c71 and c72 and c73 and c74 and not kk and kk2 and not kk3 and TTshort//SpanA < SpanB e croce MORTE sotto kumo SHORTC76= SpanA < SpanBc77= Tenkansen crosses under Kijunsenc78= chikou< close[P]C79= close < Tenkansenc80= close < kijunsenc81= chikou < Tenkansen[P]c82= chikou < Kijunsen [P]c83=close < SpanA//MORTESHORT1= c76 and c77 and c78 and c79 and c80 and c81 and c82 and c83MORTESHORT1= c76 and c77 and c78 and c79 and c80 and c83 and c81 and c82 and not kk and kk2 and not kk3 and TTshort// SpanA < SpanB Segnale tre linee sottokumo SHORTc84=SpanA < SpanBc85= Tenkansen < kijunsenc86= kijunsen < SpanAc87= Tenkansen < SpanAC88= close < SpanAc880= close[1]<SpanAc89= close < SpanBC90= chikou < Close[P]C91= close < Tenkansenc92= close< kijunsenC910= close[1] < Tenkansenc920= close[1]< kijunsenc93= chikou < SpanA[P]c94= chikou < SpanB[P]TREELINEESHORT= c84 and c85 and c86 and c87 and c88 and c89 and c90 and c91 and c92 and c93 and c94 and c880 and c910 and c920 and not KK and kk2 and not kk3 and TTshortIF not onmarket and BKUMOLONG thenbuy 1 shares at market//signal=1endifIF not onmarket and BKUMOLONG1 thenbuy 1 shares at market//signal=2endifIF not onmarket and OROLONG thenbuy 1 shares at market//signal=3endifIF not onmarket and OROLONG1 thenbuy 1 shares at market//signal=4endifIF not onmarket and TRELINEELONG thenbuy 1 shares at market//signal=5endifIF not onmarket and BKUMOSHORT thensellshort 1 shares at market//signal=-1endifIF not onmarket and BKUMOSHORT1 thensellshort 1 shares at market//signal=-2endifIF not onmarket and MORTESHORT thensellshort 1 shares at market//signal=-3endifIF not onmarket and MORTESHORT1 thensellshort 1 shares at market//signal=-4endifIF not onmarket and TREELINEESHORT thensellshort 1 shares at market//signal=-5endifif longonmarket and close crosses under Kijunsen or close crosses under SpanA or close crosses under spanB or close crosses over Kijunsen or close crosses over SpanA or close crosses over spanB thensell at market//signal=0endifif shortonmarket and close crosses under Kijunsen or close crosses under SpanA or close crosses under spanB or close crosses over Kijunsen or close crosses over SpanA or close crosses over spanB thenexitshort at market//signal=0endif//trailing stoptrailingstop = 14//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif//SET STOP ploss b//20//SET TARGET pPROFIT c//54//GRAPH signal coloured(255,0,0) as "segnale per capire"SET STOP ploss 105SET TARGET pPROFIT 135//SET STOP PTRAILING a//TRAILING STOP10/31/2017 at 9:32 AM #51030Thank you for your post proposal into the library. any ideas or codes proposed will do anything that will move the community forward 🙂 Moved it here to discuss about:
1/ Overfit is the first thing that come to mind, did you try at least to validate your optimized variables on an Out Of Sample (OOS) period? To prevent over fitting, develop your idea on a 70% time period and validate it on the last 30% period.
2/ The conditions to exit position (long or short) are exactly the same between lines 273 to 281?
10/31/2017 at 9:54 AM #51037hi,
- I will do it as soon as possible and display result here;
- I write the same condition for semplicity but it operate correctly in the case of long of short position. I can modify it but it will not have variation of the results.
Thanks
10/31/2017 at 11:01 AM #5104211/01/2017 at 11:09 AM #51180Hi,
I have do the Walk Forward analysis and it seems ok and confirm the parameters optimized. I add some screenshoot. Thanks
11/02/2017 at 12:06 PM #5129411/02/2017 at 2:57 PM #51322The only variables that influence the results are those below. The other parameters constitute valid filters for each instrument and TF.
I= 6P = 26U = 146Even the SL and TP levels are valid for any period. I also did, with SL and TP, a separate optimization and the Walk Forward Analysis provides positive results.
I concentrated to find reliability only on Germany cash 1 euro. If anyone in the community wants to help me to make it even more efficient on forex I would be grateful.
Thanks
08/08/2020 at 3:34 PM #141160Hello,
I would have liked to test this strategy.
Unfortunately, he doesn’t want to show me anything.
Not an error message either.
Would it be possible for Nicolas to test it?Thank you in advance!
Kind regards,
Tom
08/08/2020 at 4:15 PM #14116108/09/2020 at 10:00 AM #141196I have not tested it, but the difference between the MA should be converted to pointsize, change the lines:
123TTlong= MM - MM[2] >= 1.4*pointsize AND CLOSE >MM AND CLOSE > MM2TTshort= MM[2] - MM >= 1.35*pointsize AND CLOSE < MM AND CLOSE < MM21 user thanked author for this post.
08/09/2020 at 1:05 PM #141215Thank You Nicolas, but it still doesn’t execute any trades.
Has to be something simple?
I have tried everything I can think of. I’ll wait until @volpiemanuele comes back on and hopefully sorts it?
05/17/2021 at 3:13 PM #16990205/17/2021 at 3:44 PM #169904There you go, I changed TTlong and TTshort as suggested by Nicolas, then replaced TenkanSen and KijunSen by TenkanSenX and KijunSenX not to be confused with new v11 keywords.
As reported by GraHal no trades were opened. There must be some error in the logic that volpiemanuele could fix (he’s likely to have already fixed it).
-
AuthorPosts
Find exclusive trading pro-tools on