Skip to content

AbsoluteTakeProfitProtections constructor

constructor · AbsoluteTakeProfitProtections · cAlgo.API Since 5.8

DesktopCLICloud

Initializes a new instance with only a final take profit.

Overloads

AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with only a final take profit.

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection lastTakeProfit)
AbsoluteTakeProfitProtections(lastTakeProfit: AbsoluteTakeProfitLastProtection)

Parameters

Name C# type Python type Description
lastTakeProfit AbsoluteTakeProfitLastProtection AbsoluteTakeProfitLastProtection The final take profit that closes the remaining volume.

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitLastProtection(entryPrice + 40 * Symbol.PipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 10000, entryPrice, "myLabel", new AbsoluteStopLossProtection(entryPrice - 20 * Symbol.PipSize), takeProfits);
Print("Order placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection(entryPrice + 40 * api.Symbol.PipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 10000, entryPrice, "myLabel", AbsoluteStopLossProtection(entryPrice - 20 * api.Symbol.PipSize), takeProfits)
api.Print(f"Order placed: {result.IsSuccessful}")

AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with one partial take profit and a final take profit.

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)
AbsoluteTakeProfitProtections(firstTakeProfit: AbsoluteTakeProfitProtection, lastTakeProfit: AbsoluteTakeProfitLastProtection)

Parameters

Name C# type Python type Description
firstTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The first partial take profit.
lastTakeProfit AbsoluteTakeProfitLastProtection AbsoluteTakeProfitLastProtection The final take profit that closes the remaining volume.

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var pipSize = Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(10000, entryPrice + 20 * pipSize), new AbsoluteTakeProfitLastProtection(entryPrice + 40 * pipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 20000, entryPrice, "myLabel", new AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits);
Print("Order placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
pipSize = api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(10000, entryPrice + 20 * pipSize), AbsoluteTakeProfitLastProtection(entryPrice + 40 * pipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 20000, entryPrice, "myLabel", AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits)
api.Print(f"Order placed: {result.IsSuccessful}")

AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with two partial take profits and a final take profit.

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)
AbsoluteTakeProfitProtections(firstTakeProfit: AbsoluteTakeProfitProtection, secondTakeProfit: AbsoluteTakeProfitProtection, lastTakeProfit: AbsoluteTakeProfitLastProtection)

Parameters

Name C# type Python type Description
firstTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The first partial take profit.
secondTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The second partial take profit.
lastTakeProfit AbsoluteTakeProfitLastProtection AbsoluteTakeProfitLastProtection The final take profit that closes the remaining volume.

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var pipSize = Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(
    new AbsoluteTakeProfitProtection(10000, entryPrice + 15 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 30 * pipSize),
    new AbsoluteTakeProfitLastProtection(entryPrice + 45 * pipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 30000, entryPrice, "myLabel", new AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits);
Print("Order placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
pipSize = api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(
    AbsoluteTakeProfitProtection(10000, entryPrice + 15 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 30 * pipSize),
    AbsoluteTakeProfitLastProtection(entryPrice + 45 * pipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 30000, entryPrice, "myLabel", AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits)
api.Print(f"Order placed: {result.IsSuccessful}")

AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitProtection thirdTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with three partial take profits and a final take profit.

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitProtection thirdTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)
AbsoluteTakeProfitProtections(firstTakeProfit: AbsoluteTakeProfitProtection, secondTakeProfit: AbsoluteTakeProfitProtection, thirdTakeProfit: AbsoluteTakeProfitProtection, lastTakeProfit: AbsoluteTakeProfitLastProtection)

Parameters

Name C# type Python type Description
firstTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The first partial take profit.
secondTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The second partial take profit.
thirdTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The third partial take profit.
lastTakeProfit AbsoluteTakeProfitLastProtection AbsoluteTakeProfitLastProtection The final take profit that closes the remaining volume.

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var pipSize = Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(
    new AbsoluteTakeProfitProtection(10000, entryPrice + 15 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 25 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 35 * pipSize),
    new AbsoluteTakeProfitLastProtection(entryPrice + 50 * pipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 40000, entryPrice, "myLabel", new AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits);
Print("Order placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
pipSize = api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(
    AbsoluteTakeProfitProtection(10000, entryPrice + 15 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 25 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 35 * pipSize),
    AbsoluteTakeProfitLastProtection(entryPrice + 50 * pipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 40000, entryPrice, "myLabel", AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits)
api.Print(f"Order placed: {result.IsSuccessful}")

AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitProtection thirdTakeProfit, AbsoluteTakeProfitProtection fourthTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with four partial take profits and a final take profit.

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection firstTakeProfit, AbsoluteTakeProfitProtection secondTakeProfit, AbsoluteTakeProfitProtection thirdTakeProfit, AbsoluteTakeProfitProtection fourthTakeProfit, AbsoluteTakeProfitLastProtection lastTakeProfit)
AbsoluteTakeProfitProtections(firstTakeProfit: AbsoluteTakeProfitProtection, secondTakeProfit: AbsoluteTakeProfitProtection, thirdTakeProfit: AbsoluteTakeProfitProtection, fourthTakeProfit: AbsoluteTakeProfitProtection, lastTakeProfit: AbsoluteTakeProfitLastProtection)

Parameters

Name C# type Python type Description
firstTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The first partial take profit.
secondTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The second partial take profit.
thirdTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The third partial take profit.
fourthTakeProfit AbsoluteTakeProfitProtection AbsoluteTakeProfitProtection The fourth partial take profit.
lastTakeProfit AbsoluteTakeProfitLastProtection AbsoluteTakeProfitLastProtection The final take profit that closes the remaining volume.

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var pipSize = Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(
    new AbsoluteTakeProfitProtection(10000, entryPrice + 10 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 20 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 30 * pipSize),
    new AbsoluteTakeProfitProtection(10000, entryPrice + 40 * pipSize),
    new AbsoluteTakeProfitLastProtection(entryPrice + 60 * pipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 50000, entryPrice, "myLabel", new AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits);
Print("Order placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
pipSize = api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(
    AbsoluteTakeProfitProtection(10000, entryPrice + 10 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 20 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 30 * pipSize),
    AbsoluteTakeProfitProtection(10000, entryPrice + 40 * pipSize),
    AbsoluteTakeProfitLastProtection(entryPrice + 60 * pipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 50000, entryPrice, "myLabel", AbsoluteStopLossProtection(entryPrice - 20 * pipSize), takeProfits)
api.Print(f"Order placed: {result.IsSuccessful}")

AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtections original)

public AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtections original)
AbsoluteTakeProfitProtections(original: AbsoluteTakeProfitProtections)

Parameters

Name C# type Python type Description
original AbsoluteTakeProfitProtections AbsoluteTakeProfitProtections