Class Extensions
Extension class for Strategy.
Inherited Members
Namespace: StockSharp.Algo.Strategies
Assembly: StockSharp.Algo.Strategies.dll
Syntax
public static class Extensions
Methods
ClosePositionByQuoting(Strategy)
To close the open position via quoting.
Declaration
public static void ClosePositionByQuoting(this Strategy strategy)
Parameters
Type | Name | Description |
---|---|---|
Strategy | strategy | Strategy. |
OpenPositionByQuoting(Strategy, Decimal)
To open the position via quoting.
Declaration
public static void OpenPositionByQuoting(this Strategy strategy, Decimal finishPosition)
Parameters
Type | Name | Description |
---|---|---|
Strategy | strategy | Strategy. |
Decimal | finishPosition | The position value that should be reached. A negative value means the short position. |
Protect(MarketRule<Order, MyTrade>, Unit, Unit)
To create the action protecting orders by strategies TakeProfitStrategy and StopLossStrategy.
Declaration
public static MarketRule<Order, MyTrade> Protect(this MarketRule<Order, MyTrade> rule, Unit takePriceDelta, Unit stopPriceDelta)
Parameters
Type | Name | Description |
---|---|---|
MarketRule<Order, MyTrade> | rule | The rule for new orders. |
Unit | takePriceDelta | The delta from the price of the protected order, by which the protective take profit order is to be registered. |
Unit | stopPriceDelta | The delta from the price of the protected order, by which the protective stop loss order is to be registered. |
Returns
Type | Description |
---|---|
MarketRule<Order, MyTrade> | Rule. |
Protect(MarketRule<Order, MyTrade>, Func<MyTrade, TakeProfitStrategy>, Func<MyTrade, StopLossStrategy>)
To create the action protecting orders by strategies TakeProfitStrategy and StopLossStrategy.
Declaration
public static MarketRule<Order, MyTrade> Protect(this MarketRule<Order, MyTrade> rule, Func<MyTrade, TakeProfitStrategy> takeProfit, Func<MyTrade, StopLossStrategy> stopLoss)
Parameters
Type | Name | Description |
---|---|---|
MarketRule<Order, MyTrade> | rule | The rule for new orders. |
Func<MyTrade, TakeProfitStrategy> | takeProfit | The function that creates the strategy TakeProfitStrategy by the order. |
Func<MyTrade, StopLossStrategy> | stopLoss | The function that creates the strategy StopLossStrategy by the order. |
Returns
Type | Description |
---|---|
MarketRule<Order, MyTrade> | Rule. |
WhenActivated(ProtectiveStrategy)
To create the rule for the event Activated.
Declaration
public static IMarketRule WhenActivated(this ProtectiveStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
ProtectiveStrategy | strategy | The strategy, by which the event will be monitored. |
Returns
Type | Description |
---|---|
IMarketRule | Rule. |