Click or drag to resize

ExtensionsProtect Method (MarketRuleOrder, MyTrade, FuncMyTrade, TakeProfitStrategy, FuncMyTrade, StopLossStrategy)

To create the action protecting orders by strategies TakeProfitStrategy and StopLossStrategy.

Namespace:  StockSharp.Algo.Strategies
Assembly:  StockSharp.Algo.Strategies (in StockSharp.Algo.Strategies.dll) Version: 4.4.16.0 (4.4.16)
Syntax
C#
public static MarketRule<Order, MyTrade> Protect(
	this MarketRule<Order, MyTrade> rule,
	Func<MyTrade, TakeProfitStrategy> takeProfit,
	Func<MyTrade, StopLossStrategy> stopLoss
)

Parameters

rule
Type: StockSharp.AlgoMarketRuleOrder, MyTrade
The rule for new orders.
takeProfit
Type: SystemFuncMyTrade, TakeProfitStrategy
The function that creates the strategy TakeProfitStrategy by the order.
stopLoss
Type: SystemFuncMyTrade, StopLossStrategy
The function that creates the strategy StopLossStrategy by the order.

Return Value

Type: MarketRuleOrder, MyTrade
Rule.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type MarketRuleOrder, MyTrade. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also