BaseProtectiveBehaviour
StockSharp.Algo.Strategies.Protective
Base implementation of IProtectiveBehaviour.
Inherits: BaseLogReceiver
Implements: IProtectiveBehaviour, ILogSource, IDisposable
Constructors
BaseProtectiveBehaviour
protected BaseProtectiveBehaviour(Unit takeValue, Unit stopValue, bool isStopTrailing, TimeSpan takeTimeout, TimeSpan stopTimeout, bool useMarketOrders)
baseProtectiveBehaviour = BaseProtectiveBehaviour(takeValue, stopValue, isStopTrailing, takeTimeout, stopTimeout, useMarketOrders)
Initializes a new instance of the BaseProtectiveBehaviour.
- takeValue
- Take offset.
- stopValue
- Stop offset.
- isStopTrailing
- Whether to use a trailing technique.
- takeTimeout
- Time limit. If protection has not worked by this time, the position will be closed on the market.
- stopTimeout
- Time limit. If protection has not worked by this time, the position will be closed on the market.
- useMarketOrders
- Whether to use market orders.
Properties
IsStopTrailing
protected bool IsStopTrailing { get; }
value = baseProtectiveBehaviour.IsStopTrailing
Whether to use a trailing technique.
Position
public abstract decimal Position { get; }
value = baseProtectiveBehaviour.Position
Current position value.
StopTimeout
protected TimeSpan StopTimeout { get; }
value = baseProtectiveBehaviour.StopTimeout
Time limit. If protection has not worked by this time, the position will be closed on the market.
TakeTimeout
protected TimeSpan TakeTimeout { get; }
value = baseProtectiveBehaviour.TakeTimeout
Time limit. If protection has not worked by this time, the position will be closed on the market.
UseMarketOrders
protected bool UseMarketOrders { get; }
value = baseProtectiveBehaviour.UseMarketOrders
Whether to use market orders.
Methods
TryActivate
public abstract ValueTuple<bool, Sides, decimal, decimal, OrderCondition>? TryActivate(decimal price, DateTime time)
result = baseProtectiveBehaviour.TryActivate(price, time)
Try activate protection.
- price
- Current price.
- time
- Current time.
Returns: Registration order info.
Update
public abstract ValueTuple<bool, Sides, decimal, decimal, OrderCondition>? Update(decimal price, decimal value, DateTime time)
result = baseProtectiveBehaviour.Update(price, value, time)
Update position difference.
- price
- Position difference price.
- value
- Position difference value.
- time
- Current time.
Returns: Registration order info.