Fixed Trailing Stop
CK
200 is a... generous TrailingStop...!
Use this for a 'fixed' TS... as ever OTTOMH :)
//=====================================================
extern int MagicNumber1 = 678;
extern double TrailingStop = 60;
start()
{
//---- code
MoveTrailingStopsPerMN(MagicNumber1);
return(0)
}
void MoveTrailingStopsPerMN(int iMN)
{
int icnt, itotal;
itotal=OrdersTotal();
for(icnt=0;icnt (Point*TrailingStop))
{
if(OrderStopLoss()>(Ask+Point*TrailingStop))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
}
}
}
if(OrderType()==OP_BUY &&OrderSymbol()==strSymbol &&OrderMagicNumber()==iMN)
{
if (OrderStopLoss()==0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
}
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss() Close_1) &&(ActiveSAR!=OrderStopLoss())) OrderModify(OrderTicket(),OrderOpenPrice(),ActiveSAR,OrderTakeProfit(),0,Yellow);
}
if(OrderType()==OP_BUY &&OrderSymbol()==strSymbol &&OrderMagicNumber()==iMN)
{
if ((ActiveSAR
any code available for a fixed trailing stop.
I don't want dynamic trailing stop to be recalculated at open of each new bar, but just a fixed trailing stop. Say 200. So the order is modified only when the price moves 200 points.