0% ont trouvé ce document utile (0 vote)
130 vues3 pages

Robot de Trading MQL5 Exemple Code

Ce résumé décrit un code MQL5 pour un robot de trading qui prend des décisions basées sur des croisements positifs entre les indicateurs Exit-willy Alerts et Entry/Exit Trend coloris. Le robot ouvre des positions longues ou courtes lorsque ces indicateurs se croisent positivement.

Transféré par

Yannick Dawak
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOCX, PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
130 vues3 pages

Robot de Trading MQL5 Exemple Code

Ce résumé décrit un code MQL5 pour un robot de trading qui prend des décisions basées sur des croisements positifs entre les indicateurs Exit-willy Alerts et Entry/Exit Trend coloris. Le robot ouvre des positions longues ou courtes lorsque ces indicateurs se croisent positivement.

Transféré par

Yannick Dawak
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats DOCX, PDF, TXT ou lisez en ligne sur Scribd

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.

Vous aimerez peut-être aussi