How to apply multiple currencies by one cBot?
            
                 22 Jan 2023, 05:30
            
                    
Dear Spotware,
How to apply multiple currencies by one cBot?
I have tried the code below, even different currencies get opened, the price is not correct.
Can someone help?
        [Parameter("Vol", DefaultValue = 10000)]
        public int Vol { get; set; }
        protected override void OnStart()
        {
            Symbol symbol_1 = MarketData.GetSymbol("USDJPY");
            Symbol symbol_2 = MarketData.GetSymbol("EURUSD");
            Symbol symbol_3 = MarketData.GetSymbol("GBPUSD");
            var result =
            PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BU", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BE", 30, 15);           
            PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BG", 30, 15);           
            if (!result.IsSuccessful) Print("Error: ", result.Error);
             Stop();
        }
    }
}
Replies
                     jennifer1978bgf
                     23 Jan 2023, 15:16
                                    
RE: So how can I change the target price for each symbol? Thanks.
PanagiotisChar said:
Hi there,
What do you expect this code to do and what does it do instead? I don't understand why do you use the current symbol's Ask price as a target price.
@jennifer1978bgf
                     PanagiotisChar
                     24 Jan 2023, 14:42
                                    
Hi there,
See below
            PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, symbol_1.Ask - 15 * Symbol.PipSize, "BU", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, symbol_2.Ask - 15 * Symbol.PipSize, "BE", 30, 15);           
            PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, symbol_3.Ask - 15 * Symbol.PipSize, "BG", 30, 15);           
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar
                     jennifer1978bgf
                     24 Jan 2023, 20:01
                                    
RE: But the 2nd and 3rd LimitOrder changed to be MarketOrder, why?
PanagiotisChar said:
Hi there,
See below
PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, symbol_1.Ask - 15 * Symbol.PipSize, "BU", 30, 15); PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, symbol_2.Ask - 15 * Symbol.PipSize, "BE", 30, 15); PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, symbol_3.Ask - 15 * Symbol.PipSize, "BG", 30, 15);
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 UnderTest2 : Robot
    {
        [Parameter(DefaultValue = "USDJPY")]
        public string symbol_1 { get; set; }
        
        [Parameter(DefaultValue = "EURUSD")]
        public string symbol_2 { get; set; }
        
        [Parameter(DefaultValue = "GBPUSD")]
        public string symbol_3 { get; set; }
  
        [Parameter("Vol", DefaultValue = 10000)]
        public int Vol { get; set; }
        
        public double targetPrice_1 { get; set; }
        public double targetPrice_2 { get; set; }
        public double targetPrice_3 { get; set; }
        
        ///////////////////////////////////////////////////////////////////////////////////////////////
        protected override void OnStart()
        {
            Symbol symbol_1 = MarketData.GetSymbol("USDJPY");
            Symbol symbol_2 = MarketData.GetSymbol("EURUSD");
            Symbol symbol_3 = MarketData.GetSymbol("GBPUSD");
            var result =
            PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BU", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BE", 30, 15);  
            PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, Symbol.Ask - 15 * Symbol.PipSize, "BG", 30, 15);         
            if (!result.IsSuccessful) Print("Error: ", result.Error);
             Stop();
        }
    }
}
@jennifer1978bgf
                     jennifer1978bgf
                     25 Jan 2023, 08:15
                                    
My purpose is not to add those so many currencies/instances/symbols on the Start cBot click, I just want click once and all the other currencies/instances/symbols can place a LimitOrder, how to do this?
PanagiotisChar said:
Hi there,
See below
PlaceLimitOrder(TradeType.Buy, symbol_1, Vol, symbol_1.Ask - 15 * Symbol.PipSize, "BU", 30, 15); PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, symbol_2.Ask - 15 * Symbol.PipSize, "BE", 30, 15); PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, symbol_3.Ask - 15 * Symbol.PipSize, "BG", 30, 15);
@jennifer1978bgf
                     PanagiotisChar
                     25 Jan 2023, 10:33
                                    
Hi there,
It seems you made no changes to the code. See my responses above.
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar

PanagiotisChar
23 Jan 2023, 09:23
Hi there,
What do you expect this code to do and what does it do instead? I don't understand why do you use the current symbol's Ask price as a target price.
Aieden Technologies
Need help? Join us on Telegram
Need premium support? Trade with us
@PanagiotisChar