RelativeTakeProfitProtections constructor
constructor · RelativeTakeProfitProtections · cAlgo.API Since 5.8
DesktopCLICloud
Initializes a new instance with only a final take profit.
Overloads
RelativeTakeProfitProtections(RelativeTakeProfitLastProtection lastTakeProfit)
Initializes a new instance with only a final take profit.
public RelativeTakeProfitProtections(RelativeTakeProfitLastProtection lastTakeProfit)
RelativeTakeProfitProtections(lastTakeProfit: RelativeTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
lastTakeProfit | RelativeTakeProfitLastProtection | RelativeTakeProfitLastProtection | The final take profit that closes the remaining volume. |
Examples
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
Initializes a new instance with one partial take profit and a final take profit.
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
firstTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The first partial take profit. |
lastTakeProfit | RelativeTakeProfitLastProtection | RelativeTakeProfitLastProtection | The final take profit that closes the remaining volume. |
Examples
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 20000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 20000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
Initializes a new instance with two partial take profits and a final take profit.
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
firstTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The first partial take profit. |
secondTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The second partial take profit. |
lastTakeProfit | RelativeTakeProfitLastProtection | RelativeTakeProfitLastProtection | The final take profit that closes the remaining volume. |
Examples
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitProtection(10000, 30), new RelativeTakeProfitLastProtection(45));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 30000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitProtection(10000, 30), RelativeTakeProfitLastProtection(45))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 30000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
Initializes a new instance with three partial take profits and a final take profit.
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, thirdTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
firstTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The first partial take profit. |
secondTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The second partial take profit. |
thirdTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The third partial take profit. |
lastTakeProfit | RelativeTakeProfitLastProtection | RelativeTakeProfitLastProtection | The final take profit that closes the remaining volume. |
Examples
var takeProfits = new RelativeTakeProfitProtections(
new RelativeTakeProfitProtection(10000, 15),
new RelativeTakeProfitProtection(10000, 25),
new RelativeTakeProfitProtection(10000, 35),
new RelativeTakeProfitLastProtection(50));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 40000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
takeProfits = RelativeTakeProfitProtections(
RelativeTakeProfitProtection(10000, 15),
RelativeTakeProfitProtection(10000, 25),
RelativeTakeProfitProtection(10000, 35),
RelativeTakeProfitLastProtection(50))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 40000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitProtection fourthTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
Initializes a new instance with four partial take profits and a final take profit.
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitProtection fourthTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, thirdTakeProfit: RelativeTakeProfitProtection, fourthTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
firstTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The first partial take profit. |
secondTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The second partial take profit. |
thirdTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The third partial take profit. |
fourthTakeProfit | RelativeTakeProfitProtection | RelativeTakeProfitProtection | The fourth partial take profit. |
lastTakeProfit | RelativeTakeProfitLastProtection | RelativeTakeProfitLastProtection | The final take profit that closes the remaining volume. |
Examples
var takeProfits = new RelativeTakeProfitProtections(
new RelativeTakeProfitProtection(10000, 10),
new RelativeTakeProfitProtection(10000, 20),
new RelativeTakeProfitProtection(10000, 30),
new RelativeTakeProfitProtection(10000, 40),
new RelativeTakeProfitLastProtection(60));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 50000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
takeProfits = RelativeTakeProfitProtections(
RelativeTakeProfitProtection(10000, 10),
RelativeTakeProfitProtection(10000, 20),
RelativeTakeProfitProtection(10000, 30),
RelativeTakeProfitProtection(10000, 40),
RelativeTakeProfitLastProtection(60))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 50000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
RelativeTakeProfitProtections(RelativeTakeProfitProtections original)
public RelativeTakeProfitProtections(RelativeTakeProfitProtections original)
RelativeTakeProfitProtections(original: RelativeTakeProfitProtections)
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
original | RelativeTakeProfitProtections | RelativeTakeProfitProtections |