Setting Advanced Take Proft 1-3 via Cbot and Enumerated Choice Buy/Sell

Created at 13 Nov 2016, 13:04
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!
S.

s.unkelbach

Joined 13.11.2016

Setting Advanced Take Proft 1-3 via Cbot and Enumerated Choice Buy/Sell
13 Nov 2016, 13:04


Hi together,

When I open a order I usally use the Advanced TPs funcionalitty and Breakeven funcionality of Ctrader. I'm currently programming a small cbot which opens a new MarketOrder. I want to integrate in my cbot that afterwards the Advanced TPs 1-3  and / SL to Breakeven settings are set by the cbot. It that possible and how?

 

My second question. As an input parmeter for the cbot I want to have a choice for Buy or Sell. Like an enumerated choice which have this two options. I already tried following argument TradeType but I can't get it to work/compile. Seems like that the TradeType is not a valid parameter type.

Is it not possible to create just a new Enum Parameter with the values I want?

 

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class testsven : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }


        [Parameter("Trade Type")]
        public TradeType TType { get; set; }


        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}


@s.unkelbach