Trades Exist
Created at 21 Apr 2024, 20:58
EM
Trades Exist
21 Apr 2024, 20:58
Hello Ctrader Support, Please , in ctrader , is there a special syntax used in checking if manual trades exist before an order can be placed. ‘ Opentrade.IsExist ’
example: namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class NewcBot : Robot
{
private int openBuyTrade;
private int openSellTrade;
[Parameter(DefaultValue = "Hello world!")]
public string Message { get; set; }
protected override void OnStart()
{
// To learn more about cTrader Automate visit our Help Center:
// https://help.ctrader.com/ctrader-automate
Print(Message);
‘ Opentrade.IsExist ’
if(openTrade != IsExist)
{
Place a buy PendingOrder();
}
}
protected override void OnTick()
{
// Handle price updates here
}
protected override void OnStop()
{
// Handle cBot stop here
}
}
}
Thanks
PanagiotisCharalampous
22 Apr 2024, 06:28
Hi there,
You can access open positions through the Positions collection.
Best regards,
Panagiotis
@PanagiotisCharalampous