AbsoluteTakeProfitLastProtection constructor
constructor · AbsoluteTakeProfitLastProtection · cAlgo.API Since 5.8
DesktopCLICloud
Represents the final take profit in an absolute take profit ladder, closing any remaining order volume at a specified price.
Overloads
| Signature | Description |
|---|---|
AbsoluteTakeProfitLastProtection(double Price) | Represents the final take profit in an absolute take profit ladder, closing any remaining order volume at a specified price. |
AbsoluteTakeProfitLastProtection(AbsoluteTakeProfitLastProtection original) |
AbsoluteTakeProfitLastProtection(double Price)
Represents the final take profit in an absolute take profit ladder, closing any remaining order volume at a specified price.
public AbsoluteTakeProfitLastProtection(double Price)
AbsoluteTakeProfitLastProtection(Price: float)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
Price | double | float | The absolute price at which the remaining volume is closed. |
Examples
var position = Positions.Find("myLabel");
if (position != null && position.TradeType == TradeType.Buy)
{
var targetPrice = position.EntryPrice + 50 * position.Symbol.PipSize;
var result = position.ModifyTakeProfit(new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitLastProtection(targetPrice)));
Print("Take profit set at {0}: {1}", targetPrice, result.IsSuccessful);
}
position = api.Positions.Find("myLabel")
if position is not None and position.TradeType == TradeType.Buy:
targetPrice = position.EntryPrice + 50 * position.Symbol.PipSize
result = position.ModifyTakeProfit(AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection(targetPrice)))
api.Print(f"Take profit set at {targetPrice}: {result.IsSuccessful}")
AbsoluteTakeProfitLastProtection(AbsoluteTakeProfitLastProtection original)
public AbsoluteTakeProfitLastProtection(AbsoluteTakeProfitLastProtection original)
AbsoluteTakeProfitLastProtection(original: AbsoluteTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
original | AbsoluteTakeProfitLastProtection | AbsoluteTakeProfitLastProtection |