Checks Trailing Stop conditions of a long position.

virtual bool  CheckTrailingStopLong(
   CPositionInfo*  position,     // pointer
   double&         sl,           // reference
   double&         tp            // reference



[in]  Pointer to CPositionInfo object.


[in][out]  Reference to variable for Stop Loss price.


[in][out]  Reference to variable for Take Profit price.

Return Value

true - conditions are satisfied, otherwise - false.


First it calculates the maximal allowed Stop Loss price closest to the current price and calculates Stop Loss price using the values of Parabolic SAR indicator of the previous (completed) bar. If position already has Stop Loss price, its value is assumed as a base price, otherwise the position open price is assumed as a base price. If the calculated Stop Loss price is higher than base price and lower than maximal allowed Stop Loss price, it suggests to set new Stop Loss price.