confusion in trailing stop calculation

 

Hi everyone, I've found part of code below about trailing stop loss in the mql4 documentation. I'm confused about this part (Bid - open order price) and (Bid - Point*Trailing stop), what those calculation does?

Thank you.


if(Bid-OrderOpenPrice()>Point*TrailingStop)
    {
    if(OrderStopLoss()<Bid-Point*TrailingStop)
 

The first if prevents the trailing until it is above break even. Bid- Point*Trailing stop is the new SL (buy order.)

I code it this way:

double newTSL = Bid - Point*TrailingStop;
if( MathMax(OrderOpenPrice(), OrderStopLoss() ) < newTSL){ … OrderModify(… newTSL …);
Reason: