Error Asset conversion from HKD to USD failed. Some or all related symbols are disabled: USDHKD

Created at 25 Apr 2023, 16:28
M4

m4trader4

Joined 19.09.2021

Error Asset conversion from HKD to USD failed. Some or all related symbols are disabled: USDHKD
25 Apr 2023, 16:28


Dear Support

I am on cTrader version 4.7.9.15890 with broker topfx. Attached indicator, am getting error  "Asset conversion from HKD to USD failed. Some or all related symbols are disabled: USDHKD", when the indicator is running on symbol HONG KONG 50 with other symbols there is no issue.

Regards

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class TimeFrameV6 : Indicator
    {
        cAlgo.API.TextBox ServerTimeTextBox;
        [Parameter("FontSize", Group = "Default trade parameters", DefaultValue = 10)]
        public double fontsize { get; set; }

        public string ChartTimeFrame;
        private void UpdateServerTimeTextBox(string Text, cAlgo.API.HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, string X, String Y, double fontSize, string clr)
        {


            //Chart.RemoveObject(Text);
            //InfoTextBox = new cAlgo.API.TextBox
            ServerTimeTextBox = new cAlgo.API.TextBox
            {
                //BackgroundColor = Color.Black,

                //BackgroundColor = Color.FromHex("#FF000000"),
                BackgroundColor = Color.Transparent,
                ForegroundColor = Color.FromHex(clr),
                //ForegroundColor = Color.GhostWhite,

                Text = Text,
                Margin = X + " " + Y,
                //Width = 10,
                //Height = 10,
                // Padding = "8 4",
                FontSize = fontSize,
                FontWeight = FontWeight.Bold,
                IsReadOnly = true,
                // Dock = Dock.Top,

                HorizontalAlignment = HorizontalAlignment,
                VerticalAlignment = VerticalAlignment
            };



            //Chart.RemoveControl(text1);



        }

        private void Bars_Tick(BarsTickEventArgs obj)
        {
            var b = obj.Bars;          
            ServerTimeTextBox.Text = Symbol.Name + " " + Account.Number + " " + Chart.TimeFrame + "  " + Server.Time.ToString("HH:mm:ss");

        }
        protected override void Initialize()
        {
            ChartTimeFrame = Chart.TimeFrame.ToString();
            UpdateServerTimeTextBox("ServerTime", cAlgo.API.HorizontalAlignment.Right, VerticalAlignment.Top, "0", "9", fontsize, "#06E7FB");
            Chart.AddControl(ServerTimeTextBox);
            ServerTimeTextBox.Text = Symbol.Name + " " + Symbol.Spread.ToString("F" + Symbol.Digits) + " " + Chart.TimeFrame + "  " + Server.Time.ToString("HH:mm:ss");
            Bars.Tick += Bars_Tick;
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }
    }
}

 


@m4trader4
Replies

firemyst
26 Apr 2023, 03:41 ( Updated at: 21 Dec 2023, 09:23 )

I'm not sure why you think this is an issue?

If you look on topfx website, they don't have USDHKD listed as a currency pair they allow users to trade, so that error is expected:

 

 

If you want to trade USDHKD, it looks like you'll have to change brokers, or ask them if they can enable it for you.

Good luck.


@firemyst

m4trader4
26 Apr 2023, 12:40

RE:

It is an tick bar indicator getting server time, its not doing any USD to HKD or vice versa conversion, with all other symbols the same indicator is working fine

Regards

 


@m4trader4

m4trader4
26 Apr 2023, 12:54 ( Updated at: 21 Dec 2023, 09:23 )

RE: RE:

Attached screen shot of error


@m4trader4

Xammo
26 Apr 2023, 13:55

Haven't looked too closely at this but I would guess even though no currency conversion going on it is still needing the tick data to fire the 

private void Bars_Tick(BarsTickEventArgs obj)

I just chucked this into VS and can't see why the 

var b = obj.Bars;

is there it isn't doing anything that I can see so edited the code to below/seems to output the same and just gets the tick trigger from the Calculate overide and not dependant on any tick triggers coming in

Hope it works/apologies if I've misunderstood and it's not what you're after! 

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class TimeFrameV6 : Indicator
    {
        cAlgo.API.TextBox ServerTimeTextBox;
        [Parameter("FontSize", Group = "Default trade parameters", DefaultValue = 10)]
        public double fontsize { get; set; }

        public string ChartTimeFrame;
        private void UpdateServerTimeTextBox(string Text, cAlgo.API.HorizontalAlignment HorizontalAlignment, VerticalAlignment VerticalAlignment, string X, String Y, double fontSize, string clr)
        {


            //Chart.RemoveObject(Text);
            //InfoTextBox = new cAlgo.API.TextBox
            ServerTimeTextBox = new cAlgo.API.TextBox
            {
                //BackgroundColor = Color.Black,

                //BackgroundColor = Color.FromHex("#FF000000"),
                BackgroundColor = Color.Transparent,
                ForegroundColor = Color.FromHex(clr),
                //ForegroundColor = Color.GhostWhite,

                Text = Text,
                Margin = X + " " + Y,
                //Width = 10,
                //Height = 10,
                // Padding = "8 4",
                FontSize = fontSize,
                FontWeight = FontWeight.Bold,
                IsReadOnly = true,
                // Dock = Dock.Top,

                HorizontalAlignment = HorizontalAlignment,
                VerticalAlignment = VerticalAlignment
            };

            //Chart.RemoveControl(text1);
        }

        //private void Bars_Tick(BarsTickEventArgs obj)
        //{
        //    var b = obj.Bars;          
        //}

        protected override void Initialize()
        {
            ChartTimeFrame = Chart.TimeFrame.ToString();
            UpdateServerTimeTextBox("ServerTime", cAlgo.API.HorizontalAlignment.Right, VerticalAlignment.Top, "0", "9", fontsize, "#06E7FB");
            Chart.AddControl(ServerTimeTextBox);
            ServerTimeTextBox.Text = Symbol.Name + " " + Symbol.Spread.ToString("F" + Symbol.Digits) + " " + Chart.TimeFrame + "  " + Server.Time.ToString("HH:mm:ss");
            //Bars.Tick += Bars_Tick;
        }

        public override void Calculate(int index)
        {
            ServerTimeTextBox.Text = Symbol.Name + " " + Account.Number + " " + Chart.TimeFrame + "  " + Server.Time.ToString("HH:mm:ss");
        }
    }
}

 


@Xammo

Spotware
26 Apr 2023, 16:35

Dear m4trader4,

Thank you for reporting this issue. We were able to reproduce this and we will fix it in an upcoming update.

Best regards,

cTrader Team

 


@Spotware