Click or drag to resize

ProtectiveStrategy Class

The base strategy of the position protection.
Inheritance Hierarchy

Namespace:  StockSharp.Algo.Strategies.Protective
Assembly:  StockSharp.Algo.Strategies (in StockSharp.Algo.Strategies.dll) Version: 4.4.16.0 (4.4.16)
Syntax
C#
public abstract class ProtectiveStrategy : QuotingStrategy, 
	IProtectiveStrategy

The ProtectiveStrategy type exposes the following members.

Constructors
  NameDescription
Protected methodProtectiveStrategy
Initialize ProtectiveStrategy.
Top
Properties
  NameDescription
Public propertyActivationPrice
The absolute value of the price when the one is reached the protective strategy is activated.
Protected propertyBestPrice
To get the best price. If it is impossible to calculate the best price at the moment, then will be returned.
(Inherited from QuotingStrategy.)
Public propertyBestPriceOffset
The shift from the best price, on which the quoted order can be changed.
Public propertyCancelOrdersWhenStopping
To cancel active orders at stop. Is On by default.
(Inherited from Strategy.)
Public propertyChildStrategies
Subsidiary trade strategies.
(Inherited from Strategy.)
Protected propertyClosePositionPrice
The market price of position closing. If there is no information about the current price, then the will be returned.
Public propertyCommentOrders
To add to Comment the name of the strategy Name, registering the order.
(Inherited from Strategy.)
Public propertyCommission
Total commission.
(Inherited from Strategy.)
Public propertyConnector
Connection to the trading system.
(Inherited from Strategy.)
Public propertyCurrentRegisterFailCount
Current number of order registration errors.
(Inherited from QuotingStrategy.)
Public propertyCurrentReRegisterCount
Current number of order changes.
(Inherited from QuotingStrategy.)
Public propertyCurrentTime
Current time, which will be passed to the Time.
(Inherited from Strategy.)
Public propertyDisposeOnStop
Automatically to clear resources, used by the strategy, when it stops (state ProcessState becomes equal to Stopped) and delete it from the parent strategy through ChildStrategies.
(Inherited from Strategy.)
Public propertyEnvironment
Strategy environment parameters.
(Inherited from Strategy.)
Public propertyErrorCount
The current number of errors.
(Inherited from Strategy.)
Public propertyErrorState
The state of an error.
(Inherited from Strategy.)
Public propertyId
Strategy ID.
(Inherited from Strategy.)
Public propertyIsActivated
Whether the protective strategy is activated.
Public propertyIsDisposed (Inherited from Disposable.)
Public propertyIsRoot
Whether the source is the root (even if Parent is not equal to ).
(Inherited from BaseLogSource.)
Public propertyIsRulesSuspended
Is rules execution suspended.
(Inherited from Strategy.)
Public propertyIsSupportAtomicReRegister
Gets a value indicating whether the re-registration orders via the method ReRegisterOrder(Order, Order) as a single transaction. The default is enabled.
(Inherited from QuotingStrategy.)
Protected propertyIsTimeOut
Is the TimeOut occurred.
(Inherited from QuotingStrategy.)
Public propertyIsTrailing
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 propertyLatency
Total latency.
(Inherited from Strategy.)
Public propertyLeftVolume
The volume which is left to fulfill before the quoting end.
(Inherited from QuotingStrategy.)
Public propertyLogLevel
The logging level. The default is set to Inherit.
(Inherited from Strategy.)
Public propertyMaxErrorCount
The maximal number of errors, which strategy shall receive prior to stop operation.
(Inherited from Strategy.)
Public propertyMaxRegisterFailCount
The maximum number of order registration errors above which the algorithm will be stopped.
(Inherited from QuotingStrategy.)
Public propertyMaxReRegisterCount
The maximum number of order changes above which the algorithm will be stopped.
(Inherited from QuotingStrategy.)
Public propertyMyTrades
Trades, matched during the strategy operation.
(Inherited from Strategy.)
Public propertyName
Strategy name.
(Inherited from Strategy.)
Public propertyNameGenerator
The generator of strategy name.
(Inherited from Strategy.)
Public propertyOrder
The order with which the quoting strategy is currently operating.
(Inherited from QuotingStrategy.)
Public propertyOrderFails
Orders with errors, registered within the strategy.
(Inherited from Strategy.)
Public propertyOrders
Orders, registered within the strategy framework.
(Inherited from Strategy.)
Public propertyOrdersKeepTime
The time for storing Orders and StopOrders orders in memory. By default it equals to 2 days. If value is set in Zero, orders will not be deleted.
(Inherited from Strategy.)
Public propertyParameters
Strategy parameters.
(Inherited from Strategy.)
Public propertyParent
Parent.
(Inherited from BaseLogSource.)
Public propertyPnL
The aggregate value of profit-loss without accounting commission Commission.
(Inherited from Strategy.)
Public propertyPnLManager
The profit-loss manager. It accounts trades of this strategy, as well as of its subsidiary strategies ChildStrategies.
(Inherited from Strategy.)
Public propertyPortfolio
Portfolio.
(Inherited from Strategy.)
Public propertyPosition
The position aggregate value.
(Inherited from Strategy.)
Public propertyPositionManager
The position manager. It accounts trades of this strategy, as well as of its subsidiary strategies ChildStrategies.
(Inherited from Strategy.)
Public propertyPriceOffset
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 propertyProcessState
The operation state.
(Inherited from Strategy.)
Public propertyProtectiveLevel
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 propertyProtectivePrice
Protected position price.
Public propertyProtectiveSide
Protected position side.
Public propertyProtectiveVolume
Protected volume.
Public propertyQuotingDirection
Quoting direction.
(Inherited from QuotingStrategy.)
Public propertyQuotingVolume
Total quoting volume.
(Overrides QuotingStrategyQuotingVolume.)
Public propertyRegisterInterval
The order reregistration interval above which the new order would not be registered.
(Inherited from QuotingStrategy.)
Public propertyRiskManager
The risks control manager.
(Inherited from Strategy.)
Public propertyRules
Registered rules.
(Inherited from Strategy.)
Public propertySecurity
Security.
(Inherited from Strategy.)
Public propertySlippage
Total slippage.
(Inherited from Strategy.)
Public propertyStartedTime
Strategy start time.
(Inherited from Strategy.)
Public propertyStatisticManager
The statistics manager.
(Inherited from Strategy.)
Public propertyStopOnChildStrategyErrors
Stop strategy when child strategies causes errors.
(Inherited from Strategy.)
Public propertyStopOrders
Stop-orders, registered within the strategy framework.
(Inherited from Strategy.)
Public propertyTimeOut
The time limit during which the quoting should be fulfilled. If the total volume of QuotingVolume will not be fulfilled by this time, the strategy will stop operating.
(Inherited from QuotingStrategy.)
Public propertyTotalWorkingTime
The total time of strategy operation less time periods, when strategy was stopped.
(Inherited from Strategy.)
Public propertyUnrealizedPnLInterval
The interval for unrealized profit recalculation. The default value is 1 minute.
(Inherited from Strategy.)
Public propertyUseLastTradePrice
To use the last trade price, if the information in the order book is missed. The default is enabled.
(Inherited from QuotingStrategy.)
Public propertyUseMarketOrders
Whether to use Market for protection. By default, orders Limit are used.
Public propertyUseQuoting
Whether to quote the registered order by the market price. The default mode is disabled.
Public propertyVolume
Operational volume.
(Inherited from Strategy.)
Public propertyWaitAllTrades
Stop strategy only after getting all trades by registered orders.
(Inherited from Strategy.)
Top
Methods
  NameDescription
Public methodApplyChanges
Apply changes.
(Inherited from Strategy.)
Public methodApplyCommand
Apply incoming command.
(Inherited from Strategy.)
Protected methodAssignOrderStrategyId
To set the strategy identifier for the order.
(Inherited from Strategy.)
Public methodAttachOrder
To add the active order to the strategy and process trades by the order.
(Inherited from Strategy.)
Public methodCancelActiveOrders
To cancel all active orders (to stop and regular).
(Inherited from Strategy.)
Public methodCancelOrder
Cancel order.
(Inherited from Strategy.)
Public methodClone
Create a copy of Strategy.
(Inherited from Strategy.)
Protected methodCreateQuoting
To create a quoting strategy for the protective order (its fulfilment is guaranteed).
Public methodDispose (Inherited from Disposable.)
Protected methodDisposeManaged
Release resources.
(Inherited from Strategy.)
Protected methodDisposeNative (Inherited from Disposable.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize (Inherited from Disposable.)
Protected methodGetFilteredQuotes
To get the order book filtered with GetFilteredMarketDepth(Security).
(Inherited from QuotingStrategy.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLevel1Fields
To get a set of available fields Level1Fields, for which there is a market data for the instrument.
(Inherited from Strategy.)
Public methodGetMarketDepth
To get the quotes order book.
(Inherited from Strategy.)
Protected methodGetNewVolume
To get a new volume for an order.
(Inherited from QuotingStrategy.)
Protected methodGetNotificationRules
To get a list of rules on which the quoting will respond.
(Overrides QuotingStrategyGetNotificationRules.)
Public methodGetSecurityValue
To get the value of market data for the instrument.
(Inherited from Strategy.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodInitStartValues
Init.
(Inherited from Strategy.)
Public methodLoad
Load settings.
(Inherited from Strategy.)
Public methodLookup
Lookup securities by criteria criteria.
(Inherited from Strategy.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodNeedFinish
Whether the quoting can be stopped.
(Inherited from QuotingStrategy.)
Protected methodNeedQuoting
Should the order be quoted.
(Overrides QuotingStrategyNeedQuoting(NullableDecimal, NullableDecimal, Decimal).)
Protected methodNeedStop
Whether the quoting should be stopped because of new order registration error.
(Inherited from QuotingStrategy.)
Protected methodOnError
Processing of error, occurred as result of strategy operation.
(Inherited from Strategy.)
Protected methodOnNewMyTrade
The method, called at occurrence of new strategy trade.
(Inherited from Strategy.)
Protected methodOnOrderCanceling
To call the event OrderRegistered.
(Inherited from Strategy.)
Protected methodOnOrderChanged
The method, called at strategy order change.
(Inherited from Strategy.)
Protected methodOnOrderRegistered
To call the event OrderRegistered.
(Inherited from Strategy.)
Protected methodOnOrderRegisterFailed
The method, called at strategy order registration error.
(Inherited from Strategy.)
Protected methodOnOrderRegistering
To call the event OrderRegistering.
(Inherited from Strategy.)
Protected methodOnOrderReRegistering
To call the event OrderReRegistering.
(Inherited from Strategy.)
Protected methodOnPositionChanged
The method, called at strategy position change.
(Inherited from Strategy.)
Protected methodOnReseted (Overrides StrategyOnReseted.)
Protected methodOnStarted
The method is called when the Start method has been called and the ProcessState state has been taken the Started value.
(Overrides QuotingStrategyOnStarted.)
Protected methodOnStopOrderCanceling
To call the event StopOrderRegistered.
(Inherited from Strategy.)
Protected methodOnStopOrderChanged
The method, called at strategy stop order change.
(Inherited from Strategy.)
Protected methodOnStopOrderRegistered
To call the event StopOrderRegistered.
(Inherited from Strategy.)
Protected methodOnStopOrderRegisterFailed
The method, called at strategy stop order registration error.
(Inherited from Strategy.)
Protected methodOnStopOrderRegistering
To call the event StopOrderRegistering.
(Inherited from Strategy.)
Protected methodOnStopOrderReRegistering
To call the event StopOrderReRegistering.
(Inherited from Strategy.)
Protected methodOnStopOrdersChanged
The method, called at strategy stop orders change.
(Inherited from Strategy.)
Protected methodOnStopped
The method is called when the ProcessState process state has been taken the Stopped value.
(Inherited from QuotingStrategy.)
Protected methodOnStopping
The method is called when the ProcessState process state has been taken the Stopping value.
(Overrides QuotingStrategyOnStopping.)
Protected methodProcessCancelActiveOrders
To cancel all active orders (to stop and regular).
(Inherited from Strategy.)
Protected methodProcessNewOrders
To process orders, received for the connection Connector, and find among them those, belonging to the strategy.
(Inherited from Strategy.)
Protected methodProcessQuoting
To initiate the quoting.
(Overrides QuotingStrategyProcessQuoting.)
Protected methodProcessTimeOut
The TimeOut occurrence event handler.
(Overrides QuotingStrategyProcessTimeOut.)
Protected methodRaiseLog
To call the event Log.
(Inherited from Strategy.)
Protected methodRaiseParametersChanged
To call events ParametersChanged and PropertyChanged.
(Inherited from Strategy.)
Protected methodRaiseProcessStateChanged
To call the event ProcessStateChanged.
(Inherited from Strategy.)
Public methodRegisterOrder
To register the order and automatically add to start mechanism of profit-loss and slippage.
(Inherited from Strategy.)
Protected methodRegisterQuotingOrder
To register the quoted order.
(Overrides QuotingStrategyRegisterQuotingOrder(Order).)
Public methodReRegisterOrder
To re-register the order and automatically add to start mechanism of profit-loss and slippage.
(Inherited from Strategy.)
Public methodReset
To re-initialize the trade algorithm. It is called after initialization of the strategy object and loading stored parameters.
(Inherited from Strategy.)
Public methodSafeGetConnector
To get the strategy getting Connector. If it is not initialized, the exception will be discarded.
(Inherited from Strategy.)
Public methodSave
Save settings.
(Inherited from Strategy.)
Public methodStart
To start the trade algorithm.
(Inherited from Strategy.)
Public methodStop
To stop the trade algorithm.
(Inherited from Strategy.)
Protected methodThrowIfDisposed (Inherited from Disposable.)
Public methodToInfoMessage
Convert to StrategyInfoMessage.
(Inherited from Strategy.)
Public methodToString
Returns a string that represents the current object.
(Inherited from BaseLogSource.)
Top
Events
  NameDescription
Public eventActivated
The protective strategy activation event.
Public eventCommissionChanged
Commission change event.
(Inherited from Strategy.)
Public eventConnectorChanged
The event of strategy connection change.
(Inherited from Strategy.)
Public eventError
The event of error occurrence in the strategy.
(Inherited from Strategy.)
Public eventLatencyChanged
Latency change event.
(Inherited from Strategy.)
Public eventLog
New debug message event.
(Inherited from BaseLogSource.)
Public eventNewMyTrade
The event of new trade occurrence.
(Inherited from Strategy.)
Public eventNewStateMessage
New StrategyStateMessage occurred event.
(Inherited from Strategy.)
Public eventOrderCancelFailed
The event of order cancelling order.
(Inherited from Strategy.)
Public eventOrderCanceling
The event of sending order for cancelling.
(Inherited from Strategy.)
Public eventOrderChanged
The event of order change.
(Inherited from Strategy.)
Public eventOrderRegistered
The event of order successful registration.
(Inherited from Strategy.)
Public eventOrderRegisterFailed
The event of order registration error.
(Inherited from Strategy.)
Public eventOrderRegistering
The event of sending order for registration.
(Inherited from Strategy.)
Public eventOrderReRegistering
The event of sending order for re-registration.
(Inherited from Strategy.)
Public eventParametersChanged
Parameters change event.
(Inherited from Strategy.)
Public eventPnLChanged
PnL change event.
(Inherited from Strategy.)
Public eventPortfolioChanged
The event of strategy portfolio change.
(Inherited from Strategy.)
Public eventPositionChanged
Position change event.
(Inherited from Strategy.)
Public eventPositionChanged2
The event of strategy position change.
(Inherited from Strategy.)
Public eventProcessStateChanged
ProcessState change event.
(Inherited from Strategy.)
Public eventPropertyChanged
Occurs when a property value changes.
(Inherited from Strategy.)
Public eventProtectiveVolumeChanged
The protected volume change event.
Public eventReseted
The event of the strategy re-initialization.
(Inherited from Strategy.)
Public eventSecurityChanged
The event of strategy instrument change.
(Inherited from Strategy.)
Public eventSlippageChanged
Slippage change event.
(Inherited from Strategy.)
Public eventStopOrderCancelFailed
The event of stop-order cancelling order.
(Inherited from Strategy.)
Public eventStopOrderCanceling
The event of sending stop-order for cancelling.
(Inherited from Strategy.)
Public eventStopOrderChanged
The event of stop-order change.
(Inherited from Strategy.)
Public eventStopOrderRegistered
The event of stop-order successful registration.
(Inherited from Strategy.)
Public eventStopOrderRegisterFailed
The event of stop-order registration error.
(Inherited from Strategy.)
Public eventStopOrderRegistering
The event of sending stop-order for registration.
(Inherited from Strategy.)
Public eventStopOrderReRegistering
The event of sending stop-order for re-registration.
(Inherited from Strategy.)
Public eventValuesChanged
Security changed.
(Inherited from Strategy.)
Top
Extension Methods
  NameDescription
Public Extension MethodBuyAtLimit
To create the initialized order object for buy.
(Defined by StrategyHelper.)
Public Extension MethodBuyAtMarket
To create initialized object of buy order at market price.
(Defined by StrategyHelper.)
Public Extension MethodClosePosition
To close open position by market (to register the order of the type Market).
(Defined by StrategyHelper.)
Public Extension MethodClosePositionByQuoting
To close the open position via quoting.
(Defined by Extensions.)
Public Extension MethodCreateOrder
To create the initialized order object.
(Defined by StrategyHelper.)
Public Extension MethodGetAllowTrading
To get the strategy operation mode (initialization or trade).
(Defined by StrategyHelper.)
Public Extension MethodGetCandleManager
To get the candle manager, associated with the passed strategy.
(Defined by StrategyHelper.)
Public Extension MethodGetChart
To get the chart associated with the passed strategy.
(Defined by ChartHelper.)
Public Extension MethodGetIsEmulation
To get the strategy start-up mode (paper trading or real).
(Defined by StrategyHelper.)
Public Extension MethodGetMessageSender
To get the message sender, associated with the passed strategy.
(Defined by StrategyHelper.)
Public Extension MethodGetSecurityValueT
To get market data value for the strategy instrument.
(Defined by StrategyHelper.)
Public Extension MethodGetStrategyProcessStateIconName
Get icon for ProcessState.
(Defined by Extensions.)
Public Extension MethodLoadState
To restore the strategy state.
(Defined by StrategyHelper.)
Public Extension MethodOpenPositionByQuoting
To open the position via quoting.
(Defined by Extensions.)
Public Extension MethodParamT(String, T)Overloaded. (Defined by StrategyParamHelper.)
Public Extension MethodParamT(String, String, T)Overloaded. (Defined by StrategyParamHelper.)
Public Extension MethodSellAtLimit
To create the initialized order object for sell.
(Defined by StrategyHelper.)
Public Extension MethodSellAtMarket
To create the initialized order object of sell order at market price.
(Defined by StrategyHelper.)
Public Extension MethodSetAllowTrading
To set the strategy operation mode (initialization or trade).
(Defined by StrategyHelper.)
Public Extension MethodSetCandleManager
To set the candle manager for the strategy.
(Defined by StrategyHelper.)
Public Extension MethodSetChart
To set a chart for the strategy.
(Defined by ChartHelper.)
Public Extension MethodSetIsEmulation
To get the strategy start-up mode (paper trading or real).
(Defined by StrategyHelper.)
Public Extension MethodSetMessageSender
To set the message sender for the strategy.
(Defined by StrategyHelper.)
Public Extension MethodWhenActivated
To create the rule for the event Activated.
(Defined by Extensions.)
Public Extension MethodWhenError
To create a rule for event of strategy error (transition of state ErrorState into Error).
(Defined by StrategyHelper.)
Public Extension MethodWhenNewMyTrade
To create a rule for the event of occurrence new strategy trade.
(Defined by StrategyHelper.)
Public Extension MethodWhenOrderChanged
To create a rule for event of change of any strategy order.
(Defined by StrategyHelper.)
Public Extension MethodWhenOrderRegistered
To create a rule for event of occurrence of new strategy order.
(Defined by StrategyHelper.)
Public Extension MethodWhenPnLChanged
To create a rule for event of profit change.
(Defined by StrategyHelper.)
Public Extension MethodWhenPnLLess
To create a rule for event of profit reduction below the specified level.
(Defined by StrategyHelper.)
Public Extension MethodWhenPnLMore
To create a rule for event of profit increase above the specified level.
(Defined by StrategyHelper.)
Public Extension MethodWhenPositionChanged
To create a rule for the event of strategy position change.
(Defined by StrategyHelper.)
Public Extension MethodWhenPositionLess
To create a rule for event of position event reduction below the specified level.
(Defined by StrategyHelper.)
Public Extension MethodWhenPositionMore
To create a rule for event of position event increase above the specified level.
(Defined by StrategyHelper.)
Public Extension MethodWhenStarted
To create a rule for event of start of strategy operation.
(Defined by StrategyHelper.)
Public Extension MethodWhenStopped
To create a rule for event full stop of strategy operation.
(Defined by StrategyHelper.)
Public Extension MethodWhenStopping
To create a rule for event of beginning of the strategy operation stop.
(Defined by StrategyHelper.)
Public Extension MethodWhenWarning
To create a rule for event of strategy warning (transition of state ErrorState into Warning).
(Defined by StrategyHelper.)
Top
See Also