Move Sl every x pips

 

Hello!

Does anybody know how to write step trailing stop? It must move SL every x pips and not every tick.
Example:
+10 profit --> SL=OrderOpenPrice,
+20 profit --> SL=OrderOpenPrice+10,
...

Thanks!

 
double  step = 20.*pips2dbl;
if (OrderStopLoss() - OrderOpenPrice() < 0) step/=2.;    // SL below Break Even
if (OrderClosePrice() - OrderStopLoss() >= step){
    if( !OrderModify(OrderTicket(), OrderOpenPrice(), 
                     OrderClosePrice()-10.*pips2dbl, OrderTakeProfit(), 0) )
       Alert( "OrderModify(ticket=", OrderTicket(), ...
 
I am still trying to learn to code in MQ4, and I'm sorry if this is a dumb question, but what purpose is the decimal in this line after the "0"?
double  step = 20.*pips2dbl;
Is it to parse the integer to a double? Or is it a dot operator, like in C++? And is the '*' is being used for multiplication? (not a pointer)
 

it is the same as 20.0

 
Any other solution?
 
Why do you need another solution? WHRoeder's is quite good.