|
What have I done?
I need help coding in MT4
I have some code below:
StopLoss=EMAtrend-iClose(NULL,0,1);
TakeProfit=StopLoss
If(EMAshort>EMAlong && EMAshort_prev<EMAlong_prev)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask+StopLoss* Point,Bid+TakeProfit*Point,"Buy at close price",10000,0,Green);
}
If(EMAshort<EMAlong && EMAshort_prev>EMAlong_prev)
{
OrderSend(Symbol(),OP_SELL,Lots,Bid,0,StopLoss,Bid +TakeProfit*Point,"Sell at close price",11000,0,Red);
}
The idea were:
1. Open order at close price when criteria met;
2. I want to make the EMAtrend to be the stoploss level;
3. The distance between EMAtrend to Close price bar will be the distance for takeprofit from opened price
I try the code above but nothing happen and there is an error 130.
Please help me.
|