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
Anyone had tried successful to have the trailing stop not take losses with negative profit?
typical trailing stop code:
void ShortTrailingStop()
{
int scnt;
int stotal = OrdersTotal();
for(scnt=stotal-1; scnt >= 0; scnt--)
{
OrderSelect(scnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_SELL) // short position is opened
{
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+(Point*Tra ilingStop))) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpen Price(),Ask+(Point*TrailingStop),Or derTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
}