Sell trades aren't working
// entries
if(PositionSelect(_Symbol) == true)
}
if((shortSma2 < longSma2 && shortSma1 > longSma1) && retouchSma <= shortSma0)
{
trade.Buy(lot,_Symbol,currentBid,currentBid-stopLoss*_Point,currentBid+takeProfit*_Point,NULL);
}
else if((shortSma2 > longSma2 && shortSma1 < longSma1) && retouchSma >= shortSma0)
{
trade.Sell(lot,_Symbol,currentAsk,currentAsk+stopLoss*_Point,currentAsk-takeProfit*_Point,NULL);
}
}
gardee005 #:
actually should be
if(PositionSelect(_Symbol) == true)
also you should normailize the SL and TP before insertion
sl = SymbolInfoDouble(Symbol(),SYMBOL_BID) - SlPoints*Point(); sl = NormalizeDouble(sl, Digits()); tp = SymbolInfoDouble(Symbol(),SYMBOL_BID) + TpPoints*Point(); tp = NormalizeDouble(tp, Digits());
Hello guys. I'm very new to coding started a few weeks ago. And I have build the following EA. But the EA only opens buy trades. Can you guys help me out? What is wrong with the else if statement.
Please explain in detail because I wan't to learn as much as possible.