Class Extensions
- Namespace
- StockSharp.Algo.Strategies
- Assembly
- StockSharp.Algo.Strategies.dll
Extension class for Strategy.
public static class Extensions
- Inheritance
-
Extensions
- Inherited Members
Methods
ClosePositionByQuoting(Strategy)
To close the open position via quoting.
public static void ClosePositionByQuoting(this Strategy strategy)
Parameters
strategy
StrategyStrategy.
OpenPositionByQuoting(Strategy, decimal)
To open the position via quoting.
public static void OpenPositionByQuoting(this Strategy strategy, decimal finishPosition)
Parameters
strategy
StrategyStrategy.
finishPosition
decimalThe 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.
public static MarketRule<Order, MyTrade> Protect(this MarketRule<Order, MyTrade> rule, Unit takePriceDelta, Unit stopPriceDelta)
Parameters
rule
MarketRule<Order, MyTrade>The rule for new orders.
takePriceDelta
UnitThe delta from the price of the protected order, by which the protective take profit order is to be registered.
stopPriceDelta
UnitThe delta from the price of the protected order, by which the protective stop loss order is to be registered.
Returns
- 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.
public static MarketRule<Order, MyTrade> Protect(this MarketRule<Order, MyTrade> rule, Func<MyTrade, TakeProfitStrategy> takeProfit, Func<MyTrade, StopLossStrategy> stopLoss)
Parameters
rule
MarketRule<Order, MyTrade>The rule for new orders.
takeProfit
Func<MyTrade, TakeProfitStrategy>The function that creates the strategy TakeProfitStrategy by the order.
stopLoss
Func<MyTrade, StopLossStrategy>The function that creates the strategy StopLossStrategy by the order.
Returns
- MarketRule<Order, MyTrade>
Rule.
WhenActivated(ProtectiveStrategy)
To create the rule for the event Activated.
public static IMarketRule WhenActivated(this ProtectiveStrategy strategy)
Parameters
strategy
ProtectiveStrategyThe strategy, by which the event will be monitored.
Returns
- IMarketRule
Rule.