I want to have a trailing stop added to my simple EA based on envelope indicator.
What my EA do :
- When the Fast MA break the upper line of the enveloppe indicator, it takes a long position.
- When the Fast MA break the lower line of the enveloppe indicator, it takes a short position.
What I want to add :
- When the EA takes long positions :
The stop loss will start on the lower line of the envelope indicator, and move up with the price until it reaches the
upper line of the envelope indicator, then it will not move anymore (it will be a break-even).
- When the EA takes short positions :
- Same but all inverted.
Final source code needed,
I will need to be able to modify the stoploss distance and break-even position in the parameters of the EA
(example : if I want the break even to be +1 or +2 points of the upperline of the envelope indicator).
I will give you the source code, and don't hesitate to contact me if you have any questions.
Thank you !
相似订单
//+------------------------------------------------------------------+ //| XAUUSD M5 TELEGRAM TRADING EA | //| EMA 20/50/200 + RSI + ATR + Telegram | //+------------------------------------------------------------------+ #property strict #property version "1.00" #property description "XAUUSD M5 EA with EMA, RSI, ATR and Telegram notifications" #include <Trade/Trade.mqh> CTrade trade;
Bonjour, Je souhaite créer un Expert Advisor (EA) en MQL5 optimisé pour opérer sur les paires Forex (EURUSD) et les métaux précieux (GOLD / XAUEUR / GAUUSD) Fonctionnalités requises : 1. Stratégie directionnelle : Le bot doit identifier le début d'un mouvement de tendance (hausse ou baisse) et exécuter des entrées rapides dans le sens de la tendance. 2. Sortie anticipée : Le bot doit sécuriser la position rapidement
Vous négociez les paires de devises (ex: EUR/USD, GBP/USD) en utilisant vos propres fonds ou ceux obtenus via des Prop Firms (sociétés de trading d'évaluation qui vous prêtent du capital après la réussite d'un test)