Spécifications

//+------------------------------------------------------------------+
//|                     EA Cruzamento de Médias MT5                  |
//+------------------------------------------------------------------+
#property strict

#include <Trade/Trade.mqh>
CTrade trade;

//---- Inputs
input int FastMAPeriod = 20;
input int SlowMAPeriod = 50;
input double LotSize = 0.01;
input int StopLoss = 300;
input int TakeProfit = 600;

//---- Handles
int fastMAHandle;
int slowMAHandle;

//+------------------------------------------------------------------+
int OnInit()
{
   fastMAHandle = iMA(_Symbol, _Period, FastMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
   slowMAHandle = iMA(_Symbol, _Period, SlowMAPeriod, 0, MODE_EMA, PRICE_CLOSE);
   
   if(fastMAHandle == INVALID_HANDLE || slowMAHandle == INVALID_HANDLE)
   {
      Print("Erro ao criar médias");
      return(INIT_FAILED);
   }
   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
void OnTick()
{
   if(PositionSelect(_Symbol))
      return;

   double fastMA[2];
   double slowMA[2];

   CopyBuffer(fastMAHandle, 0, 0, 2, fastMA);
   CopyBuffer(slowMAHandle, 0, 0, 2, slowMA);

   double fastCurrent = fastMA[0];
   double fastPrevious = fastMA[1];
   double slowCurrent = slowMA[0];
   double slowPrevious = slowMA[1];

   // Cruzamento para compra
   if(fastPrevious < slowPrevious && fastCurrent > slowCurrent)
   {
      trade.Buy(LotSize, _Symbol, Ask, StopLoss * _Point, TakeProfit * _Point);
   }

   // Cruzamento para venda
   if(fastPrevious > slowPrevious && fastCurrent < slowCurrent)
   {
      trade.Sell(LotSize, _Symbol, Bid, StopLoss * _Point, TakeProfit * _Point);
   }
}
//+------------------------------------------------------------------+

Répondu

1
Développeur 1
Évaluation
(35)
Projets
60
22%
Arbitrage
3
33% / 33%
En retard
15
25%
Gratuit
2
Développeur 2
Évaluation
(547)
Projets
630
33%
Arbitrage
38
39% / 50%
En retard
11
2%
Travail
3
Développeur 3
Évaluation
(442)
Projets
697
34%
Arbitrage
33
70% / 9%
En retard
22
3%
Gratuit
4
Développeur 4
Évaluation
(1)
Projets
2
0%
Arbitrage
0
En retard
1
50%
Gratuit
5
Développeur 5
Évaluation
(19)
Projets
24
21%
Arbitrage
0
En retard
2
8%
Gratuit
6
Développeur 6
Évaluation
(28)
Projets
39
23%
Arbitrage
14
0% / 93%
En retard
4
10%
Travail
7
Développeur 7
Évaluation
(1)
Projets
1
0%
Arbitrage
2
0% / 50%
En retard
0
Gratuit
8
Développeur 8
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit

Informations sur le projet

Budget
30+ USD
Délais
de 1 à 39 jour(s)

Client

Commandes passées1
Nombre d'arbitrages0