TrailingStopPriceCalculator
StockSharp.MatchingEngine
Converts between a trailing stop's market-price watermark and stop price.
メソッド
CalculateStopPrice
public static decimal CalculateStopPrice(decimal watermark, decimal? offset, bool isPercent, Sides side)
result = TrailingStopPriceCalculator.CalculateStopPrice(watermark, offset, isPercent, side)
Calculates the stop price for a market-price watermark.
- watermark
- Best market price seen by the trailing stop.
- offset
- Trailing distance. A value is treated as zero.
- isPercent
- Whether is a percentage of the watermark.
- side
- Stop order side.
戻り値: The stop price corresponding to the watermark.
InitialWatermark
public static decimal? InitialWatermark(decimal stopPrice, decimal? offset, bool isPercent, Sides side)
result = TrailingStopPriceCalculator.InitialWatermark(stopPrice, offset, isPercent, side)
The watermark a trailing stop starts from, before it has seen any price.
- stopPrice
- Level the stop was registered at.
- offset
- Trailing distance. A value is treated as zero.
- isPercent
- Whether is a percentage of the watermark.
- side
- Stop order side.
戻り値: The implied watermark, or when the level implies none.
IsPercentOffsetReachable
public static bool IsPercentOffsetReachable(decimal offset, Sides side)
result = TrailingStopPriceCalculator.IsPercentOffsetReachable(offset, side)
Whether a percentage trailing offset can produce a stop price the market is able to reach.
- offset
- Trailing distance, as a percentage of the watermark.
- side
- Stop order side.
戻り値: when the offset yields a reachable stop price.
ReconstructWatermark
public static decimal ReconstructWatermark(decimal stopPrice, decimal? offset, bool isPercent, Sides side)
result = TrailingStopPriceCalculator.ReconstructWatermark(stopPrice, offset, isPercent, side)
Reconstructs the market-price watermark from a persisted stop price.
- stopPrice
- Persisted stop price.
- offset
- Trailing distance. A value is treated as zero.
- isPercent
- Whether is a percentage of the watermark.
- side
- Stop order side.
戻り値: The reconstructed watermark.