rokasearner:
Hello, I am coding ea and I dont know what is wrong :?
Hello, I am coding ea and I dont know what is wrong :?
so I try to code traling stop but it works bad with sell, so my code is:
this work good:
here is something wrong, but cant understand what:
Someone can tell me what is wrong with SELL code ? :?Try changing this :
if(OrderStopLoss()>Ask+Point*TrailingStop)
to this :
if(OrderStopLoss()==0 || OrderStopLoss()>Ask+Point*TrailingStop)
I dont know what is the reason, but it worked, thanks
rokasearner:
I dont know what is the reason, but it worked, thanks
I dont know what is the reason, but it worked, thanks

Your initial stop loss is 0. That is why in the case of a sell order you needed additional check : because OrderStopLoss()>Ask+Point*TrailingStop will not be fulfilled when order stop loss == 0

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello, I am coding ea and I dont know what is wrong :?
so I try to code traling stop but it works bad with sell, so my code is:
this work good:
{
if(Ask-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Ask-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask-Point*TrailingStop,OrderTakeProfit(),0,Blue);
return(0);
}
}
}here is something wrong, but cant understand what:
{
if(OrderOpenPrice()-Ask>Point*TrailingStop)
{
if(OrderStopLoss()>Ask+Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Blue);
return(0);
}
}
}Someone can tell me what is wrong with SELL code ? :?