How to run 2 instances of one robot for the same currency pair independently.

05 Jan 2019, 12:57How to run 2 instances of one robot for the same currency pair independently.#1
silvio posts: 5since: 05 Jan 2019

I have tuned my robot and I found that 2 different sets of parameters works well. Now I would like to run robot with 2 instances for the same currency pair but with different input parameters. How to run them independently ?

I am referring to following line which I have in the code:

             var longPosition = Positions.Find(label, Symbol, TradeType.Buy);

'label' is the same for both instances so for example first instance may find open positions of second instance.


I tried following but it doesn't work:

I created robot parameter to assign custom name:

         [Parameter("Custom name", DefaultValue = "std")]
        public string CustomName { get; set; }


         public string label = "test-01DE" + CustomName;

but I receive error:

"Error CS0236: A field initializer cannot reference the non-static field, method, or property 'cAlgo.Robots.RobotDAX.CustomName.get'"


Thanks in advance for any help



06 Jan 2019, 02:58#2
DelTraderposts: 52since: 25 Jun 2017


You need add your parameter "CustomName" to the trading syntax, not to the string label declaration.

Here you only declarate a name to your label:

private const string Label = "test-01DE";

Here you add the parameter "CustomName":

ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, Label + CustomName);

After that just add 2 cbots with diff "CustomName", you can add to the same chart.
I hope i can have helped you and im sory for my English.
08 Jan 2019, 12:59RE:#3
silvio posts: 5since: 05 Jan 2019

Thank you, It solved my problem