SL et TP mauvais codage
Forums › ProRealTime forum Français › Support ProOrder › SL et TP mauvais codage
- This topic has 6 replies, 2 voices, and was last updated 1 hour ago by
PRC_2021.
Viewing 7 posts - 1 through 7 (of 7 total)
-
-
06/14/2025 at 5:58 PM #248270
Bonjour,
J’essaie de coder un bot mais celui ci ne répond pas à mes attentes surement suites à des erreurs de codage.
Question N°1 => (Voir pj) Je veux mettre mon SL sous le plus bas de la bougie qui casse la EMA20 avec +2pts. Mais celui ci est trés souvent exécuter alors que les prix ne sont pas touchés.
Questions N°2 => (Voir pj) J’indique un TP1 à 2*SL et le TP2 à 3*SL mais seul le tp2 est pris alors qu’il y avait plusieurs cible pour prendre le TP2 et mis à BE.
Merci pour votre aide.
Voici le code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758DEFPARAM CUMULATEORDERS = falseDEFPARAM FLATBEFORE = 070000DEFPARAM FLATAFTER = 183000TIMEFRAME(5 Minute)//Réinitialisation VALEURif Not OnMarket THENSLFinance = 0SL = 0endifema20 = ExponentialAverage[20](close)Achat = open < ema20 and close > ema20+2Vente = open > ema20 and close < ema20+2if time>100000 and time<=1200000 AND Achat and Not OnMarket then// POUR UN ACHAT//Ordre AchatBUY 1 CONTRACT AT MARKETSLFinance = 1SL = close-lowest[2](close[1])SET STOP pLOSS SL//SET TARGET pPROFIT 100ELSIF time>100000 and time<=120000 AND Vente and Not OnMarket THEN//Ordre VENTESELLSHORT 1 CONTRACT AT MARKETSLFinance = 1SL = close-highest[2](close[1])SET STOP pLOSS SLENDIF//SL et TP pour la position d'achatif longonmarket and close-tradeprice>=SL*2 and SLFinance = 1 thensell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endifif longonmarket and close-tradeprice>=SL*3 and SLFinance = 2 then //REMPLACER ENSUITE par IBX2//sell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 2SELLSHORT AT MARKETendif//SL et TP pour la position de vente//StopLoss financé à x points en coupant la moitié de la positionIf shortonmarket and tradeprice-close>=SL*2 and SLFinance = 1 thenbuy abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endifIf shortonmarket and tradeprice-close>=100/PipSize and SLFinance = 2 then//REMPLACER ENSUITE par IBX2//buy abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 2EXITSHORT AT MARKETendifGRAPHONPRICE SL06/15/2025 at 4:59 PM #248286Essayez cette version :
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465DEFPARAM CUMULATEORDERS = falseDEFPARAM FLATBEFORE = 070000DEFPARAM FLATAFTER = 183000TIMEFRAME(5 Minute)//Réinitialisation VALEURif Not OnMarket THENSLFinance = 0//SL = 0endifema20 = ExponentialAverage[20](close)Achat = open < ema20 and close > ema20+2*pipsizeVente = open > ema20 and close < ema20-2*pipsizeif time>100000 and time<=1200000 AND Achat and Not OnMarket then// POUR UN ACHAT//Ordre AchatBUY 1 CONTRACT AT MARKETSLFinance = 1SL = low//close-lowest[2](close[1])TP1 = close + (abs(close - SL) * 2)TP2 = close + (abs(close - SL) * 3)SET STOP PRICE SLSET TARGET PRICE TP2//SET TARGET pPROFIT 100ELSIF time>100000 and time<=120000 AND Vente and Not OnMarket THEN//Ordre VENTESELLSHORT 1 CONTRACT AT MARKETSLFinance = 1SL = high//close-highest[2](close[1])TP1 = close + (abs(close - SL) * 2)TP2 = close + (abs(close - SL) * 3)SET STOP PRICE SLSET TARGET PRICE TP2ENDIF//SL et TP pour la position d'achatif longonmarket and close >= TP1 and SLFinance = 1 thensell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endifif longonmarket and close-tradeprice>=SL*3 and SLFinance = 2 then //REMPLACER ENSUITE par IBX2//sell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 0//SELLSHORT AT MARKETendif//SL et TP pour la position de vente//StopLoss financé à x points en coupant la moitié de la positionif shortonmarket and close <= TP1 and SLFinance = 1 thenexitshort abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endifIf shortonmarket and tradeprice-close>=100/PipSize and SLFinance = 2 then//REMPLACER ENSUITE par IBX2//buy abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 2//EXITSHORT AT MARKETendifGRAPHONPRICE SL coloured("Red")GRAPHONPRICE TP2 coloured("Blue")1 user thanked author for this post.
06/17/2025 at 6:58 AM #24830906/17/2025 at 8:38 AM #24831506/17/2025 at 9:14 AM #24831606/17/2025 at 12:55 PM #24832806/17/2025 at 1:11 PM #248330Maintenant toutes mes positions s’ouvrent et se ferment aussitôt (Voir pj)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546if "condition" and Not OnMarket then// POUR UN ACHAT//Ordre AchatBUY 1 CONTRACT AT MARKETSLFinance = 1SL = LOW//close-lowest[2](close[1])TP1 = close + (abs(close - SL) * 1)TP2 = close + (abs(close - SL) * 2)SET STOP pLOSS SLELSIF "condition" and Not OnMarket THEN//Ordre VENTESELLSHORT 1 CONTRACT AT MARKETSLFinance = 1SL = HIGH//close-highest[2](close[1])TP1 = close - (abs(SL - close) * 1)TP2 = close - (abs(SL - close) * 2)SET STOP pLOSS SLENDIF//SL et TP pour la position d'achatif longonmarket and close >= TP1 and SLFinance = 1 thensell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endif//if longonmarket and close-tradeprice>=100/PipSize and SLFinance = 2 then//sell abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 2//SELLSHORT AT MARKET//endif//SL et TP pour la position de venteIf shortonmarket and close >= TP1 and SLFinance = 1 thenbuy abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKETset stop BREAKEVENSLFinance = 2endif//If shortonmarket and tradeprice-close>=100/PipSize and SLFinance = 2 then//buy abs(COUNTOFPOSITION)/2 CONTRACTS AT MARKET//SLFinance = 2//EXITSHORT AT MARKET//endifGRAPHONPRICE SL coloured("Red")GRAPHONPRICE TP1 coloured("Blue")GRAPHONPRICE TP2 coloured("GREEN") -
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)
Find exclusive trading pro-tools on
Similar topics: