Voici un exemple de code en MQL5 pour un robot de trading qui prend des décisions basées sur des
croisements positifs des indicateurs Exit-willy Alerts et Entry/Exit Trend coloris (wich Alerts) :
```
//Déclaration des variables
input int ExitWilly_period = 14; //période de l'indicateur Exit-willy Alerts
input ENUM_APPLIED_PRICE ExitWilly_price = PRICE_CLOSE; //type de prix pour l'Exit-willy Alerts
input int EntryExit_period = 50; //période de l'indicateur Entry/Exit Trend coloris (wich Alerts)
input ENUM_APPLIED_PRICE EntryExit_price = PRICE_CLOSE; //type de prix pour l'Entry/Exit Trend
coloris (wich Alerts)
input double LotSize = 0.01; //taille de la position
input int StopLoss = 100; //stop-loss en pips
input int TakeProfit = 200; //take-profit en pips
//Initialisation
int ticket = 0; //numéro d'ordre
double ExitWilly; //valeur de l'indicateur Exit-willy Alerts
double EntryExit; //valeur de l'indicateur Entry/Exit Trend coloris (wich Alerts)
double Ask; //prix ask
double Bid; //prix bid
//Fonction d'initialisation
void OnInit()
//Initialisation des indicateurs
ExitWilly = iCustom(NULL, 0, "Exit-willy Alerts", ExitWilly_period, 0, 0, 0, 0, ExitWilly_price, 0, 1);
EntryExit = iCustom(NULL, 0, "Entry/Exit Trend coloris (wich Alerts)", EntryExit_period, 0, 0, 0,
EntryExit_price, 1, 1);
//Fonction de mise à jour
void OnTick()
//Mise à jour du prix ask
Ask = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
//Mise à jour du prix bid
Bid = SymbolInfoDouble(Symbol(), SYMBOL_BID);
//Mise à jour des indicateurs
ExitWilly = iCustom(NULL, 0, "Exit-willy Alerts", ExitWilly_period, 0, 0, 0, 0, ExitWilly_price, 0, 1);
EntryExit = iCustom(NULL, 0, "Entry/Exit Trend coloris (wich Alerts)", EntryExit_period, 0, 0, 0,
EntryExit_price, 1, 1);
//Signal d'achat
if(Bid > Ask + StopLoss && ExitWilly > 0 && EntryExit > 0)
ticket = OrderSend(Symbol(), OP_BUY, LotSize, Ask, 3, Bid-StopLoss*Point, Bid+TakeProfit*Point,
"Buy", 0, 0, Green);
//Signal de vente
if(Ask < Bid - StopLoss && ExitWilly < 0 && EntryExit < 0)
{
ticket = OrderSend(Symbol(), OP_SELL, LotSize, Bid, 3, Ask+StopLoss*Point, Ask-TakeProfit*Point,
"Sell", 0, 0, Red);
```
Ce code utilise la fonction iCustom pour accéder aux valeurs des indicateurs Exit-willy Alerts et
Entry/Exit Trend coloris (wich Alerts). Lorsqu'un croisement positif est détecté, le robot effectue une
position d'achat ou de vente à l'aide de la fonction OrderSend. Les paramètres StopLoss et TakeProfit
sont également définis pour chaque ordre. Notez que ce code est fourni à titre d'exemple et doit être
personnalisé en fonction de vos propres stratégies de trading.