Termos de Referência

//+------------------------------------------------------------------+
//|                     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);
   }
}
//+------------------------------------------------------------------+

Respondido

1
Desenvolvedor 1
Classificação
(35)
Projetos
60
22%
Arbitragem
3
33% / 33%
Expirado
15
25%
Livre
2
Desenvolvedor 2
Classificação
(547)
Projetos
630
33%
Arbitragem
38
39% / 50%
Expirado
11
2%
Trabalhando
3
Desenvolvedor 3
Classificação
(442)
Projetos
696
34%
Arbitragem
34
68% / 9%
Expirado
22
3%
Trabalhando
4
Desenvolvedor 4
Classificação
(1)
Projetos
2
0%
Arbitragem
0
Expirado
1
50%
Livre
5
Desenvolvedor 5
Classificação
(19)
Projetos
24
21%
Arbitragem
0
Expirado
2
8%
Livre
6
Desenvolvedor 6
Classificação
(28)
Projetos
39
23%
Arbitragem
14
0% / 93%
Expirado
4
10%
Trabalhando

Informações sobre o projeto

Orçamento
30+ USD
Prazo
de 1 para 39 dias

Cliente

Pedidos postados1
Número de arbitragens0