HELP! Opening Orders when there is an "X" difference in pips between two EMAs New comment Fibonacci Gucci 2018.06.24 23:39 Guys, I really need your help, I want to create an EA with the following strategy, Open Buy Order when the gap ( in pips) between EMA 20 and EMA 50 is in the range of 5 to 10 pips and the EMA 5 is above all other EMAs, I have tried to create the following code but the orders are opened without following the above conditions. What is wrong? void OnTick() { if (OrdersTotal() > 0) { return; } double lots = 0.55; int stopLoss = 500; int takeProfit = 30; double ema20 = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0); double ema50= iMA(NULL,0,50,0,MODE_EMA, PRICE_CLOSE, 0); double ema5= iMA(NULL,0,5,0,MODE_EMA, PRICE_CLOSE, 0); double MAdif= MathAbs(ema20-ema50); if (MAdif/Point > 5 && MAdif/Point < 10 && ema5 > ema50 && ema5 > ema20 && ema20>ema50) { if (OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - stopLoss * Point, Ask + takeProfit * Point, "buy", 12345, 0, Green)) { Print("Buy order succeeded!"); } } } CROSSING EMA 5 x EMA 13 Difference between 2 EMAS Need help indentifying indicator New comment
Guys, I really need your help, I want to create an EA with the following strategy,
Open Buy Order when the gap ( in pips) between EMA 20 and EMA 50 is in the range of 5 to 10 pips and the EMA 5 is above all other EMAs,
I have tried to create the following code but the orders are opened without following the above conditions. What is wrong?