Files
mql5-skills/skills/mql5/references/docs/34-standardlibrary/3675-standardlibrary-expertclasses-sampletrailingclasses-ctrailingpsar-trailingparabolicsarchecktrailingstoplong.md
T
2026-06-23 21:47:51 +08:00

35 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CheckTrailingStopLong
Checks Trailing Stop conditions of a long position.
```
virtual bool  CheckTrailingStopLong(
   CPositionInfo*  position,     // pointer
   double&         sl,           // reference
   double&         tp            // reference
   )
```
Parameters
position
[in]  Pointer to [CPositionInfo](/en/docs/standardlibrary/tradeclasses/cpositioninfo) object.
sl
[in][out]  Reference to variable for Stop Loss price.
tp
[in][out]  Reference to variable for Take Profit price.
Return Value
true - conditions are satisfied, otherwise - false.
Note
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.