stratégie sur les marchés en temps réel le MTF n’est pas respecter
Forums › ProRealTime forum Français › Support ProOrder › stratégie sur les marchés en temps réel le MTF n’est pas respecter
- This topic has 11 replies, 2 voices, and was last updated 4 years ago by MagnetikGreen.
-
-
04/24/2020 at 6:12 PM #127887
Bonjour,
je construit une stratégie en MTF sur PRT demo IG mais j’ai un soucis, en backtest la stratégie est totalement respecter mais sur les marchés en temps réel le MTF n’est pas respecter…
Les UT 15mn et 5mn ne sont pas pris en compte du coup le Bot place des ordres alors que les conditions ne sont pas respecter.
je ne trouve pas pourquoi…
Merci pour votre aide.
Le code lier ci-dessous :
123456789101112131415161718192021222324252627282930313233343536373839404142434445timeframe(15mn,updateonclose)timeq = 0if hausse thentimeQ = 1endifif baisse thentimeQ = -1endiftimeframe(5mn,updateonclose)timef = 0if hausse thentimeF = 1endifif baisse thentimeF = -1endiftimeframe(1mn,default)////////////////////////////////////////////////////////////////////indicator1 = CALL "ICHIMOKU SIGNALS 2 histo"[25, 10]c1 = (indicator1 >= 1)if (c1 and hausse and timeq = 1 and timef =1)or( c1 and hausse and timef = 1 ) thenichi = 1endifindicator2 = CALL "ICHIMOKU SIGNALS 2 histo"[25, 10]c2 = (indicator2 <= -1)if (c2 and baisse and timeq = -1 and timef = -1)or( c1 and baisse and timef = -1 ) thenichi = -1endifif not longonmarket and ichi = 1 thenbuy 1 contracts at Marketendif04/27/2020 at 8:01 AM #12832204/27/2020 at 10:00 AM #128350Les deux variables sont renseigner mais je ne l’es ai pas inclut dans le bout de code. Tout marche bien mais sauf le MTF qui fonctionne en backtest mais pas en trading en temps réel.
04/27/2020 at 10:07 AM #128355Merci d’inclure l’ensemble du code la prochaine fois, c’est difficile de donner des réponses précises dans les bonnes informations, tu en conviendras.
Par ailleurs, qu’est ce qui ne fonctionne pas ? Je ne peux pas reproduire, je ne possède pas le code inclut dans ton CALL.
04/27/2020 at 10:17 AM #128362CALL ichimoku histo du bot12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061// HEIHEN HASHI//////////////////////////////////////////////////////HAturn = 0IF BarIndex = 0 THENXClose = TotalPriceXOpen = (Open + Close) / 2ELSEXClose = TotalPriceXOpen = (XOpen[1] + Xclose[1]) / 2ENDIF// ICHIMOKU/////////////////////////////////////////////////////Tenkan = (highest[9](high)+lowest[9](low))/2Kijun = (highest[26](high)+lowest[26](low))/2SSpanA = (tenkan[26]+kijun[26])/2SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2////////////////////////////////////////////////////////////////////////hausse = (SSpanA > SSpanB and xclose >= kijun and xclose > SSpanA and xclose > tenkan and xclose > SSpanA and close > SSpanB and kijun > SSpanA ) or (SSpanA < SSpanB and xclose >= kijun and xclose > tenkan and open > SSpanA and close > SSpanB and tenkan > SSpanA and kijun > SSpanA)baisse = (SSpanA < SSpanB and xclose <= kijun and xclose < SSpanA and xclose < tenkan and xclose < SSpanA and close < SSpanB and kijun < SSPanA ) or (SSpanA > SSpanB and xclose <= kijun and xclose < tenkan and open < SSpanA and close < SSpanB and tenkan < SSpanA and kijun < SSpanA )res = 0ichi = 0//tradeHA = 0////////////////////////////////////////////////////////////////////////////////////////////////////// ICHIMOKU TRENDif hausse thenres = 1r = 0g = 128a = 75endifif baisse thenres = -1r = 128g = 0a = 75endifif res = 1 then//tradeST = 1BACKGROUNDCOLOR(r,g,0,a)endifif res = -1 then//tradeST = -1BACKGROUNDCOLOR(r,g,0,a)endifif res = 0 thenr = 0g = 0a = 0BACKGROUNDCOLOR(r,g,0,a)endifLe code de l’indicateur appeler dans le bot.
04/27/2020 at 10:19 AM #128365Le code du bot entier, je l’ai fait pour le Dax en priorité.
code bot123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290// Définition des paramètres du codeDEFPARAM CumulateOrders = true// Cumul des positions désactivé// Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".DEFPARAM FLATBEFORE = 090000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 183000timeframe(1mn,default)///////FRACTALS/////////////////////////////////////Ncandles = 5// Nombres de bougies de chaque côté de la bougie extrêmeNside = (Ncandles - 1) / 2// Définition de la fractale supérieureIF high[Nside] >= highest[Ncandles](high) THEN//Fup = high[Nside]ENDIF// Définition de la fractale inférieureIF low[Nside] <= lowest[Ncandles](low) THEN//Fdown = low[Nside]ENDIF// HEIHEN HASHI//////////////////////////////////////////////////////HAturn = 0IF BarIndex = 0 THENXClose = TotalPriceXOpen = (Open + Close) / 2ELSEXClose = TotalPriceXOpen = (XOpen[1] + Xclose[1]) / 2ENDIF// ICHIMOKU/////////////////////////////////////////////////////Tenkan = (highest[9](high)+lowest[9](low))/2Kijun = (highest[26](high)+lowest[26](low))/2SSpanA = (tenkan[26]+kijun[26])/2SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2/////////////////GANN NIFTY ////////////////////////////////////////long = (sqrt(Dlow(1))+0.166) * (sqrt(Dlow(1))+0.166)short = (sqrt(Dhigh(1))-0.167) * (sqrt(Dhigh(1))-0.167)Res1 = (sqrt(Dlow(1))+0.25) * (sqrt(Dlow(1))+0.25)Res1B = (sqrt(Dlow(1))+0.375) * (sqrt(Dlow(1))+0.35)Res2 = (sqrt(Dlow(1))+0.5) * (sqrt(Dlow(1))+0.5)Res3 = (sqrt(Dlow(1))+1) * (sqrt(Dlow(1))+1)res4 = (sqrt(Dlow(1))+0.625) * (sqrt(Dlow(1))+625)res5 = (sqrt(Dlow(1))+0.75) * (sqrt(Dlow(1))+0.75)res6= (sqrt(Dlow(1))+0.875) * (sqrt(Dlow(1))+0.875)Sup1 = (sqrt(Dhigh(1))-0.25) * (sqrt(Dhigh(1))-0.25)Sup1B = (sqrt(Dhigh(1))-0.375) * (sqrt(Dhigh(1))-0.375)Sup2 = (sqrt(Dhigh(1))-0.5) * (sqrt(Dhigh(1))-0.5)Sup3 = (sqrt(Dhigh(1))-1) * (sqrt(Dhigh(1))-1)sup4 = (sqrt(Dlow(1))-0.625) * (sqrt(Dlow(1))-625)sup5 = (sqrt(Dlow(1))-0.75) * (sqrt(Dlow(1))-0.75)sup6= (sqrt(Dlow(1))-0.875) * (sqrt(Dlow(1))-0.875)//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VAIRABLEShausse = (SSpanA > SSpanB and xclose >= kijun and xclose > SSpanA and xclose > tenkan and xclose > SSpanA and close > SSpanB and kijun > SSpanA ) or (SSpanA < SSpanB and xclose >= kijun and xclose > tenkan and open > SSpanA and close > SSpanB and tenkan > SSpanA and kijun > SSpanA)baisse = (SSpanA < SSpanB and xclose <= kijun and xclose < SSpanA and xclose < tenkan and xclose < SSpanA and close < SSpanB and kijun < SSPanA ) or (SSpanA > SSpanB and xclose <= kijun and xclose < tenkan and open < SSpanA and close < SSpanB and tenkan < SSpanA and kijun < SSpanA )ichi = 0//HAtrade = 0//res = 0// CONDITIONStimeframe(15mn,updateonclose)timeq = 0if hausse thentimeQ = 1endifif baisse thentimeQ = -1endiftimeframe(5mn,updateonclose)timef = 0if hausse thentimeF = 1endifif baisse thentimeF = -1endif///////////////////////////////////////////////////////////////////////////////timeframe(1mn,default)indicator1 = CALL "ICHIMOKU SIGNALS 2 histo"[25, 10]c1 = (indicator1 >= 1)if (c1 and hausse and timeq = 1 and timef =1)or( c1 and hausse and timef = 1 ) thenichi = 1endifindicator2 = CALL "ICHIMOKU SIGNALS 2 histo"[25, 10]c2 = (indicator2 <= -1)if (c2 and baisse and timeq = -1 and timef = -1)or( c1 and baisse and timef = -1 ) thenichi = -1endif//////////////////////VOLUME //////////////////////////////////////EM = ExponentialAverage[14](Volume)VL = VolumeAVL = (VL > EM)//c2 = em crosses under VL////////////////////////////////////////////////////////////////////////// Conditions pour ouvrir une position acheteuseIF NOT LongOnMarket AND ichi = 1 and AVL THENBUY 1 CONTRACTS AT MARKET//set target profit tpset stop %loss 1ENDIF//// Conditions pour fermer une position acheteuse//if longonmarket and close crosses under kijun then//sell at market//endif//// Conditions pour ouvrir une position en vente à découvertIF NOT ShortOnMarket AND ichi = -1 and AVL THENSELLSHORT 1 contracts AT MARKET//set target profit 10set stop %loss 1ENDIF// Conditions pour fermer une position en vente à découvertif shortonmarket and close crosses over SHORT or close crosses under SHORT then // GANN NIFTY AUTOexitshort at marketendifif shortonmarket and close crosses over long or close crosses under long thenexitshort at marketendifif shortonmarket and close crosses over res1 or close crosses under res1 thenexitshort at marketendifif shortonmarket and close crosses over res1B or close crosses under res1B thenexitshort at marketendifif shortonmarket and close crosses over res2 or close crosses under res2 thenexitshort at marketendifif shortonmarket and close crosses over res3 or close crosses under res3 thenexitshort at marketendifif shortonmarket and close crosses over res4 or close crosses under res4 thenexitshort at marketendifif shortonmarket and close crosses over res5 or close crosses under res5 thenexitshort at marketendifif shortonmarket and close crosses over res6 or close crosses under res6 thenexitshort at marketendifif shortonmarket and close crosses over sup1 or close crosses under sup1 thenexitshort at marketendifif shortonmarket and close crosses over sup1B or close crosses under sup1B thenexitshort at marketendifif shortonmarket and close crosses over sup2 or close crosses under sup2 thenexitshort at marketendifif shortonmarket and close crosses over sup3 or close crosses under sup3 thenexitshort at marketendifif shortonmarket and close crosses over sup4 or close crosses under sup4 thenexitshort at marketendifif shortonmarket and close crosses over sup5 or close crosses under sup5 thenexitshort at marketendifif shortonmarket and close crosses over sup6 or close crosses under sup6 thenexitshort at marketendifif longonmarket and close crosses over SHORT or close crosses under SHORT then // GANN NIFTY AUTOsell at marketendifif longonmarket and close crosses over long or close crosses under long thensell at marketendifif longonmarket and close crosses over res1 or close crosses under res1 thensell at marketendifif longonmarket and close crosses over res1B or close crosses under res1B thensell at marketendifif longonmarket and close crosses over res2 or close crosses under res2 thensell at marketendifif longonmarket and close crosses over res3 or close crosses under res3 thensell at marketendifif longonmarket and close crosses over res4 or close crosses under res4 thensell at marketendifif longonmarket and close crosses over res5 or close crosses under res5 thensell at marketendifif longonmarket and close crosses over res6 or close crosses under res6 thensell at marketendifif longonmarket and close crosses over sup1 or close crosses under sup1 thensell at marketendifif longonmarket and close crosses over sup1B or close crosses under sup1B thensell at marketendifif longonmarket and close crosses over sup2 or close crosses under sup2 thensell at marketendifif longonmarket and close crosses over sup3 or close crosses under sup3 thensell at marketendifif longonmarket and close crosses over sup4 or close crosses under sup4 thensell at marketendifif longonmarket and close crosses over sup5 or close crosses under sup5 thensell at marketendifif longonmarket and close crosses over sup6 or close crosses under sup6 thensell at marketendif// Stops et objectifs : entrez vos stops et vos objectifs ici// FRACTALS /////////////////////////////////////////////////////////////////trailing stop functiontrailingstart = 1 //trailing will start @trailinstart points profittrailingstep = 1 //trailing step to move the "stoploss"//reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THENnewSL = tradeprice(1)+trailingstep*pipsizeENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsizeENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THENnewSL = tradeprice(1)-trailingstep*pipsizeENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsizeENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT newSL STOPENDIF04/27/2020 at 10:24 AM #12837504/27/2020 at 10:26 AM #128376Ok merci Nicolas. 🙂
04/27/2020 at 10:28 AM #12837804/27/2020 at 10:44 AM #128388Les deux trades sur le screen ont été fait par le bot en temps réel sauf qu’il n’aurait jamais du exister car sur l’UT 5mn la variable hausse n’est pas égale à 1 . Le bot sauf erreur de ma part doit placer un ordre au marché uniquement si hausse = 1 ou baisses = -1 sur UT5mn et UT1ln minimum. Sur le screen on peut voir que sur le backtest les trade ne sont pas fait. j’espère avoir été assez précis. 🙂
04/27/2020 at 12:28 PM #128408J’ai remarquer que le code de l’indicateur ichimoku histo n’est pas complet. Voila le code complet :
ichimoku histo complet1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283// HEIHEN HASHI//////////////////////////////////////////////////////HAturn = 0IF BarIndex = 0 THENXClose = TotalPriceXOpen = (Open + Close) / 2ELSEXClose = TotalPriceXOpen = (XOpen[1] + Xclose[1]) / 2ENDIF// ICHIMOKU/////////////////////////////////////////////////////Tenkan = (highest[9](high)+lowest[9](low))/2Kijun = (highest[26](high)+lowest[26](low))/2SSpanA = (tenkan[26]+kijun[26])/2SSpanB = (highest[52](high[26])+lowest[52](low[26]))/2////////////////////////////////////////////////////////////////////////hausse = (SSpanA > SSpanB and xclose >= kijun and xclose > SSpanA and xclose > tenkan and xclose > SSpanA and close > SSpanB and kijun > SSpanA ) or (SSpanA < SSpanB and xclose >= kijun and xclose > tenkan and open > SSpanA and close > SSpanB and tenkan > SSpanA and kijun > SSpanA)baisse = (SSpanA < SSpanB and xclose <= kijun and xclose < SSpanA and xclose < tenkan and xclose < SSpanA and close < SSpanB and kijun < SSPanA ) or (SSpanA > SSpanB and xclose <= kijun and xclose < tenkan and open < SSpanA and close < SSpanB and tenkan < SSpanA and kijun < SSpanA )res = 0ichi = 0//tradeHA = 0////////////////////////////////////////////////////////////////////////////////////////////////////// ICHIMOKU TRENDif hausse thenres = 1r = 0g = 128a = 75endifif baisse thenres = -1r = 128g = 0a = 75endifif res = 1 then//tradeST = 1BACKGROUNDCOLOR(r,g,0,a)endifif res = -1 then//tradeST = -1BACKGROUNDCOLOR(r,g,0,a)endifif res = 0 thenr = 0g = 0a = 0BACKGROUNDCOLOR(r,g,0,a)endif/////////////////////////////////////////////////////////////////////////////////if ((open < kijun and close > Kijun) or (open < kijun and close > tenkan) or (xclose crosses over Tenkan) or (xclose crosses over SSpanB) or (xclose crosses over SSpanA)) and res = 1 thenichi = 1r = 62g = 160b = 251DRAWARROWUP(barindex, low - pips )COLOURED(r,g,b)endifif ((open > kijun and close < Kijun) or (open > kijun and close < tenkan) or (xclose crosses under Tenkan) or (xclose crosses under SSpanB) or (xclose crosses under SSpanA) ) and res = -1 thenichi = -1r = 255g = 113b = 0DRAWARROWDOWN(barindex, high + pips )COLOURED(r,g,b)endif///////////////////////////////////////////////////////////////////////////////////RETURN ichi coloured(r,g,b) style(HISTOGRAM)04/29/2020 at 9:28 AM #128780Bonjour,
je relance le sujet, j’aimerai savoir si c’est un problème lier à PRT demo IG ou si j’ai fais une erreur de code ?
-
AuthorPosts
Find exclusive trading pro-tools on