Replies

jennifer1978bgf
25 Jan 2023, 08:19

RE: How to update? please help. In fact, my purpose is that no need to add all other instances but still place those LinitOrder in just one click, how to do this?

firemyst said:

You haven't updated the code in all the required places, and are still using Symbol.Ask in places you shouldn't be.

 

:-)

 


@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);           

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@jennifer1978bgf

jennifer1978bgf
25 Jan 2023, 08:10

jennifer1978bgf said:

firemyst said:

How about posting your updated code?

 

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_1.PipSize, "BU", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_2, Vol, Symbol.Ask - 15 * symbol_2.PipSize, "BE", 30, 15);
            PlaceLimitOrder(TradeType.Buy, symbol_3, Vol, Symbol.Ask - 15 * symbol_3.PipSize, "BG", 30, 15);

            if (!result.IsSuccessful) Print("Error: ", result.Error);
             Stop();
        }
    }
}


@jennifer1978bgf

jennifer1978bgf
25 Jan 2023, 08:09

RE: I used the updated code and only the first LinitOrder is PendingOrder, the rest two was opened as MarketOrder.

firemyst said:

How about posting your updated code?

 


@jennifer1978bgf

jennifer1978bgf
25 Jan 2023, 07:07

RE: RE: RE:I have changed symbol_1.Ask and symbol_1.PipSize and also for symbol2 and 3, but it turn out only the first LimitOrder is pending order, the 2nd and the 3rd was opened as MarketOrder, please help.

jennifer1978bgf said:

firemyst said:

jennifer1978bgf said:

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();
        }
    }
}

one of your issues is for each of those, you're using the chart's current symbol to get the ask and pipsize, not the currency you want.

Symbol.Ask gets the charts current symbol's asking price.

 

If you want the asking price of USDJPY for example, with your code you have to use symbol_1.Ask and symbol_1.PipSize

 

 

 


@jennifer1978bgf

jennifer1978bgf
25 Jan 2023, 07:05

RE: RE:I have changed symbol_1.Ask and symbol_1.PipSize

firemyst said:

jennifer1978bgf said:

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();
        }
    }
}

one of your issues is for each of those, you're using the chart's current symbol to get the ask and pipsize, not the currency you want.

Symbol.Ask gets the charts current symbol's asking price.

 

If you want the asking price of USDJPY for example, with your code you have to use symbol_1.Ask and symbol_1.PipSize

 

 


@jennifer1978bgf

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);           

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

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
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.

Aieden Technologies

Need help? Join us on Telegram

Need premium support? Trade with us

 


@jennifer1978bgf