//Variable externasexterndouble Lote = 0.01;
externdouble StopLoss = 300;
externdouble TakeProfit = 400;
externint TrailingStop = 280;
externint Slipagge = 10;
externint MagicNumber = 12345;
externint PeriodoEMARapidaActual = 5;
externint PeriodoEMALentaActual = 21;
externint PeriodoEMARapidaPasada = 5;
externint PeriodoEMALentaPasada = 21;
//Variables Globalesint TicketCompra;
int MaximoDeOrdenes = 2;
int BarsCount = 0;
int i;
bool fm;
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+voidOnTick()
{
//Medias Exponencialesdouble EMARapidaActual = iMA(NULL,0,PeriodoEMARapidaActual,0,1,0,1);
double EMALentaActual = iMA(NULL,0,PeriodoEMALentaActual,0,1,0,1);
double EMARapidaPasada = iMA(NULL,0,PeriodoEMARapidaPasada,0,1,0,3);
double EMALentaPasada = iMA(NULL,0,PeriodoEMALentaPasada,0,1,0,3);
//Orden de compra // Linea EMAs: "EMARapida es mayor a EMALenta y no hay error if(EMARapidaActual > EMALentaActual && EMARapidaPasada > EMALentaPasada)
if (OrdersTotal()==MaximoDeOrdenes)
if (Bars > BarsCount)
//(x && y) = Si x e y son verdaderos, la expresion es verdadera
{ //(x == y) = x es igual a y 0 = No error returned //Abrir operacion de compra
TicketCompra = OrderSend(Symbol(),OP_BUY,Lote,Ask,Slipagge,(Ask - (StopLoss * Point)),(Ask + (TakeProfit * Point)),"Orden de Compra",MagicNumber,0,Green);
BarsCount = Bars;
}
Hi guys,
What I want to do is that the EA open Buy trades when the 5 EMA crosses over the 21 EMA, BUT also when the distance bewtween the two EMA's is not decreasing.
Other condition that could make me sense, is that the two EMA's must be increasing (Regardless the distance between them).
SalgadoCapital: What I want to do is that the EA open Buy trades when the 5 EMA crosses over the 21 EMA, BUT also when the distance bewtween the two EMA's is not decreasing.
Contradictory statements. Increasing distance is not a cross. Your code doesn't test for either.
Hi guys,
What I want to do is that the EA open Buy trades when the 5 EMA crosses over the 21 EMA, BUT also when the distance bewtween the two EMA's is not decreasing.
Other condition that could make me sense, is that the two EMA's must be increasing (Regardless the distance between them).
Any suggestion is welcome,
Thanks!