Tp et SL +/- 1 Point/pips
Forums › ProRealTime forum Français › Support ProOrder › Tp et SL +/- 1 Point/pips
- This topic has 23 replies, 2 voices, and was last updated 5 years ago by Ramahu.
-
-
12/12/2019 at 6:29 PM #11476212/12/2019 at 6:47 PM #114768
Tu as peut être mal réorganisé le code dans ta stratégie, dans le doute voici ma version:
12345678910111213141516171819202122232425262728293031defparam cumulateorders=false//ACHATconditionachat= rsi[14] crosses over 50if conditionachat thenstoploss = low[0]-1*pointsize //niveau prix du SLbuy at marketsell at stoploss stopset target profit (close-(low[0]-1*pointsize))*2endifif longonmarket thensell at stoploss stopset target profit (positionprice-stoploss)*2endif//VENTEconditionvente= rsi[14] crosses under 50if conditionvente thenstoploss = high[0]+1*pointsize //niveau prix du SLsellshort at marketsell at stoploss stopset target profit ((high[0]+1*pointsize)-close)*2endifif shortonmarket thenexitshort at stoploss stopset target profit (stoploss-positionprice)*2endifgraphonprice stoploss coloured(255,0,0)(Non testé).
12/12/2019 at 8:40 PM #11477312/12/2019 at 8:42 PM #114775Je te donne mon code Short, si tu vois une incohérence.
1234567891011121314151617181920212223242526272829303132333435363738394041424344// Définition des paramètres du codeDEFPARAM CumulateOrders = False // 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 = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 120000// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position en vente à découvertindicator12 = RSI[13](close)indicator13 = Average[7](indicator12)c7 = (indicator12 CROSSES UNDER indicator13)indicator14 = RSI[13](close)c8 = (indicator14 < indicator14[1])indicator15 = Average[7](RSI[13](close))indicator16 = indicator15c9 = (indicator15 < indicator16[1])indicator17 = Average[35](RSI[13](close))indicator18 = indicator17c10 = (indicator17 < indicator18[1])indicator19 = Average[7](RSI[13](close))indicator20 = Average[35](RSI[13](close))c11 = (indicator19[1] < indicator20[1])indicator21 = RSI[13](close)indicator22 = Average[35](indicator21)c12 = (indicator21[1] < indicator22[1])IF (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Conditions pour fermer une position en vente à découvertif (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THENstoploss = high[0]+1*pointsize //niveau prix du SLsellshort at marketsell at stoploss stopset target profit ((high[0]+1*pointsize)-close)*2endifif shortonmarket thenexitshort at stoploss stopset target profit (stoploss-positionprice)*2endif12/13/2019 at 9:09 AM #114795En effet, on recalcule le stoploss même si on est déjà au marché, il faut vérifier qu’on ne l’ai pas avant. Par contre dans ton code tu passes 2 fois l’instruction pour lancer un ordre, inutile.
non testé12345678910111213141516171819202122232425262728293031323334353637383940// Définition des paramètres du codeDEFPARAM CumulateOrders = False // 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 = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 120000// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position en vente à découvertindicator12 = RSI[13](close)indicator13 = Average[7](indicator12)c7 = (indicator12 CROSSES UNDER indicator13)indicator14 = RSI[13](close)c8 = (indicator14 < indicator14[1])indicator15 = Average[7](RSI[13](close))indicator16 = indicator15c9 = (indicator15 < indicator16[1])indicator17 = Average[35](RSI[13](close))indicator18 = indicator17c10 = (indicator17 < indicator18[1])indicator19 = Average[7](RSI[13](close))indicator20 = Average[35](RSI[13](close))c11 = (indicator19[1] < indicator20[1])indicator21 = RSI[13](close)indicator22 = Average[35](indicator21)c12 = (indicator21[1] < indicator22[1])// Conditions pour fermer une position en vente à découvertif not shortonmarket and (c7 AND c8 AND c9 AND c10 AND c11 AND c12) AND not daysForbiddenEntry THENstoploss = high[0]+1*pointsize //niveau prix du SLSELLSHORT 1 CONTRACT AT MARKETexitshort at stoploss stopset target profit ((high[0]+1*pointsize)-close)*2endifif shortonmarket thenexitshort at stoploss stopset target profit (stoploss-positionprice)*2endif12/13/2019 at 12:36 PM #114816Parfait !! (y) tout est ok pour ce code. tout est respecté les SL, les TP X2 (+spread) etc ..
Qu’est ce qui cloche avec l’achat du coup s’il te plait ?
D’un jour à l’autre, d’une position à une autre il respecte tout puis plus rien ..
1234567891011121314151617181920212223242526272829303132333435363738394041424344// Définition des paramètres du codeDEFPARAM CumulateOrders = False // 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 = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 120000// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position acheteuseindicator1 = RSI[13](close)indicator2 = Average[7](indicator1)c1 = (indicator1 CROSSES OVER indicator2)indicator3 = RSI[13](close)c2 = (indicator3 > indicator3[1])indicator4 = Average[7](RSI[13](close))indicator5 = indicator4c3 = (indicator4 > indicator5[1])indicator6 = Average[35](RSI[13](close))indicator7 = indicator6c4 = (indicator6 > indicator7[1])indicator8 = Average[7](RSI[13](close))indicator9 = Average[35](RSI[13](close))c5 = (indicator8[1] > indicator9[1])indicator10 = RSI[13](close)indicator11 = Average[35](indicator10)c6 = (indicator10[1] > indicator11[1])IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry THENBUY 1 CONTRACT AT MARKETENDIF// Conditions pour fermer une position acheteuseif (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry thenstoploss = low[0]-1*pointsize //niveau prix du SLbuy at marketsell at stoploss stopset target profit (close-(low[0]-1*pointsize))*2endifif longonmarket thensell at stoploss stopset target profit (positionprice-stoploss)*2endif12/17/2019 at 7:24 PM #11511912/18/2019 at 2:21 PM #115174A tester cette version pour les achats: (au passage j’ai corrigé une petite coquille dans la version vente dans mon dernier message).
12345678910111213141516171819202122232425262728293031323334353637383940// Définition des paramètres du codeDEFPARAM CumulateOrders = False // 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 = 080000// Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"DEFPARAM FLATAFTER = 120000// Empêche le système de placer de nouveaux ordres sur les jours de la semaine spécifiésdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions pour ouvrir une position acheteuseindicator1 = RSI[13](close)indicator2 = Average[7](indicator1)c1 = (indicator1 CROSSES OVER indicator2)indicator3 = RSI[13](close)c2 = (indicator3 > indicator3[1])indicator4 = Average[7](RSI[13](close))indicator5 = indicator4c3 = (indicator4 > indicator5[1])indicator6 = Average[35](RSI[13](close))indicator7 = indicator6c4 = (indicator6 > indicator7[1])indicator8 = Average[7](RSI[13](close))indicator9 = Average[35](RSI[13](close))c5 = (indicator8[1] > indicator9[1])indicator10 = RSI[13](close)indicator11 = Average[35](indicator10)c6 = (indicator10[1] > indicator11[1])if not longonmarket and (c1 AND c2 AND c3 AND c4 AND c5 AND c6) AND not daysForbiddenEntry thenstoploss = low[0]-1*pointsize //niveau prix du SLBUY 1 CONTRACT AT MARKETsell at stoploss stopset target profit (close-(low[0]-1*pointsize))*2endifif longonmarket thensell at stoploss stopset target profit (positionprice-stoploss)*2endif12/19/2019 at 6:16 PM #115266 -
AuthorPosts
Find exclusive trading pro-tools on