Class ProtectiveStrategy
- Namespace
- StockSharp.Algo.Strategies.Protective
- Assembly
- StockSharp.Algo.dll
The base strategy of the position protection.
[Obsolete("Use ProtectiveController class.")]
public abstract class ProtectiveStrategy : QuotingStrategy, IPersistable, INotifyPropertyChangedEx, INotifyPropertyChanged, IMarketRuleContainer, ILogReceiver, ILogSource, IDisposable, ICloneable<Strategy>, ICloneable, IMarketDataProvider, ISubscriptionProvider, ISecurityProvider, ISecurityMessageProvider, ITransactionProvider, IPositionProvider, IPortfolioProvider, IScheduledTask, IProtectiveStrategy
- Inheritance
-
ProtectiveStrategy
- Implements
-
IPersistableINotifyPropertyChangedExICloneable<Strategy>
- Derived
- Inherited Members
- Extension Methods
Constructors
ProtectiveStrategy(Sides, decimal, decimal, Unit, bool)
Initialize ProtectiveStrategy.
protected ProtectiveStrategy(Sides protectiveSide, decimal protectivePrice, decimal protectiveVolume, Unit protectiveLevel, bool isUpTrend)
Parameters
protectiveSide
SidesProtected position side.
protectivePrice
decimalProtected position price.
protectiveVolume
decimalThe protected position volume.
protectiveLevel
UnitThe protective level. If the Type type is equal to Limit, then the given price is specified. Otherwise, the shift value from
protectivePrice
is specified.isUpTrend
boolTo track price increase or falling.
Properties
BestPriceOffset
The shift from the best price, on which the quoted order can be changed.
public Unit BestPriceOffset { get; set; }
Property Value
IsActivated
Whether the protective strategy is activated.
public bool IsActivated { get; }
Property Value
IsTrailing
Whether to use a trailing technique. For the TakeProfitStrategy with profit increasing the level of profit taking is automatically increased. For the StopLossStrategy with profit increasing the level of loss protection is automatically increased. The default is disabled.
public bool IsTrailing { get; set; }
Property Value
PriceOffset
The price shift for the registering order. It determines the amount of shift from the best quote (for the buy it is added to the price, for the sell it is subtracted).
public Unit PriceOffset { get; set; }
Property Value
ProtectiveLevel
The protective level. If the Type type is equal to Limit, then the given price is specified. Otherwise, the shift value from the protected trade Trade is specified.
public Unit ProtectiveLevel { get; set; }
Property Value
ProtectivePrice
Protected position price.
public decimal ProtectivePrice { get; }
Property Value
ProtectiveSide
Protected position side.
public Sides ProtectiveSide { get; }
Property Value
ProtectiveVolume
Protected volume.
public decimal ProtectiveVolume { get; set; }
Property Value
QuotingVolume
Total quoting volume.
public override decimal QuotingVolume { set; }
Property Value
UseMarketOrders
Whether to use Market for protection.
public bool UseMarketOrders { get; set; }
Property Value
Remarks
By default, orders Limit are used.
UseQuoting
Whether to quote the registered order by the market price. The default mode is disabled.
public bool UseQuoting { get; set; }
Property Value
Methods
CreateQuoting()
To create a quoting strategy for the protective order (its fulfilment is guaranteed).
protected virtual QuotingStrategy CreateQuoting()
Returns
- QuotingStrategy
The strategy of quoting.
GetNotificationRules()
To get a list of rules on which the quoting will respond.
protected override IEnumerable<IMarketRule> GetNotificationRules()
Returns
- IEnumerable<IMarketRule>
Rule list.
NeedQuoting(DateTimeOffset, decimal?, decimal?, decimal)
Should the order be quoted.
protected override decimal? NeedQuoting(DateTimeOffset currentTime, decimal? currentPrice, decimal? currentVolume, decimal newVolume)
Parameters
currentTime
DateTimeOffsetCurrent time.
currentPrice
decimal?The current price. If the value is equal to null then the order is not registered yet.
currentVolume
decimal?The current volume. If the value is equal to null then the order is not registered yet.
newVolume
decimalNew volume.
Returns
- decimal?
The price at which the order will be registered. If the value is equal to null then the quoting is not required.
OnReseted()
It is called from the Reset() method.
protected override void OnReseted()
OnStarted(DateTimeOffset)
The method is called when the Start() method has been called and the ProcessState state has been taken the Started value.
protected override void OnStarted(DateTimeOffset time)
Parameters
time
DateTimeOffset
ProcessQuoting(DateTimeOffset)
To initiate the quoting.
protected override void ProcessQuoting(DateTimeOffset currentTime)
Parameters
currentTime
DateTimeOffsetCurrent time.
ProcessTimeOut(DateTimeOffset)
The TimeOut occurrence event handler.
protected override void ProcessTimeOut(DateTimeOffset currentTime)
Parameters
currentTime
DateTimeOffset
RegisterQuotingOrder(Order)
To register the quoted order.
protected override void RegisterQuotingOrder(Order order)
Parameters
order
OrderThe quoted order.
Events
Activated
The protective strategy activation event.
public event Action Activated
Event Type
ProtectiveVolumeChanged
The protected volume change event.
public event Action ProtectiveVolumeChanged