Trades Exist

Created at 21 Apr 2024, 20:58
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
EM

emmasystems

Joined 08.12.2015

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 

@emmasystems
Replies

PanagiotisCharalampous
22 Apr 2024, 06:28

Hi there,

You can access open positions through the Positions collection.

Best regards,

Panagiotis


@PanagiotisCharalampous