PanagiotisCharalampous's avatar
PanagiotisCharalampous
26 follower(s) 0 following 1006 subscription(s)
Replies

PanagiotisCharalampous
13 Nov 2024, 06:33

RE: Error | CBot instance crashed with error #ED2F94F3.

samyelzallat said: 

when I remove onbarclosed from the bot and use onbar it doesn't cause an error

Hi there,

Please provide the complete cBot code

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
13 Nov 2024, 06:31

Hi there,

It looks like the dll is missing from your computer. Can you please advise the reference you use for the System.Drawing methods? The methods do not seem to be a part of the standard System.Drawing namespace

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 13:55

RE: RE: Memory Manager bot

dejonge4 said: 

PanagiotisCharalampous said: 

Hi there,

Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 

Hopefully you received the text as per the above instructions. The happens every time I try to Optimize a trading bot. The first pic is my % of free RAM before Optimization begins and the second pic is after 4 minutes of Optimization.

Image preview

Thank you. Unfortunately troubleshooting does not provide any useful information. It it possible to run dotMemory and provide us with a memory snapshot?


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 13:51

RE: RE: Why is backtesting SO slow after the update? yesterday it was fine before I updated and now my cBot is ultra slow

Elon.Musk said: 

PanagiotisCharalampous said: 

Hi there,

Can you share your cBot code so that we can reproduce the issue?

Best regards,

Panagiotis

hi @PanagiotisCharalampous .. the new Ctraders versions are extremly slow with optimization .. what used to optimize in 15 mins is now taking 1 hour if not up to 3 hours !!!  this is rendering the Ctrader really unusable for lots of algo traders .. what is the plan to enhance optimization performance ! 

Hi there,

Improvements related to this thread will be released in 5.1.0

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 11:19

RE: RE: RE: RE: cTrader web NOT usable lately!!

RobinRaePhoto said: 

PanagiotisCharalampous said: 

RobinRaePhoto said: 

PanagiotisCharalampous said: 

Hi there,

Thank you for reporting this issue. Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 

Thank you for your response. The video instruction did not show how to access the “troubleshooting” submission box. I finally figured out how to access it. I just submitted the troubleshooting information, including the link to this discussion. How will I hear back about this? 

Hi there,

The high memory usage in the browser may be due to a video card issue, which sometimes requires a computer restart to restore performance.

Please restart your Mac and check if your setup meets the minimum system requirements for cTrader. You can review them here: cTrader System Requirements.

If the issue persists, please wait for the next cTrader release, where we are working on fixing any potential issues.

Best regards,

Panagiotis

I forgot to mention in my last reply … I also tried using cTrader platform on Safari and Google Chrome. The problem also happens on both of those browsers, so it is not the browser. It is something in the application of the cTrader Web platform. As I said, I have been using cTrader Web for 2 years with no problems. This issue just began about a month ago. 

Hi there,

Any chance you can try another device as well and let us know if the issue persists?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:45

Hi there,

Because limit orders are always executed at the trigger price or better. On the contrary, stop orders are just market orders.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:43

RE: RE: ChartTrendLines don't get removed from OnDestroy() method when indicator removed from chart

firemyst said: 

PanagiotisCharalampous said: 

Hi firemyst,

Thank you for reporting this. We are investigating.

Best regards,

Panagiotis

Any updates on this? Were they able to reproduce the issue?

Yes, it will be fixed in an upcoming update


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:40

RE: Trading for this account is disabled. Trading for this symbol is currently disabled.

sumarasarjil said: 

 I am showing disabled symbols on my desktop and I am not able to place any trade, is there any solution for this, please help me fast.

Please talk to your broker


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:37

Hi there,

I do not understand your post. Is this a question? Are you suggesting something? How can we help?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:28

RE: RE: RE: RE: RE: RE: lock buy sell button

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

Add

using System.Linq;

in the namespaces you use

Best regards,

Panagiotis

I put it but it did not work

Please share the updated cBot code

using System;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Internals;

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SampleTradingPanel : Robot
    {
        [Parameter("Vertical Position", Group = "Panel alignment", DefaultValue = VerticalAlignment.Top)]
        public VerticalAlignment PanelVerticalAlignment { get; set; }

        [Parameter("Horizontal Position", Group = "Panel alignment", DefaultValue = HorizontalAlignment.Left)]
        public HorizontalAlignment PanelHorizontalAlignment { get; set; }

        [Parameter("Default Lots", Group = "Default trade parameters", DefaultValue = 0.01)]
        public double DefaultLots { get; set; }

        [Parameter("Default Take Profit (pips)", Group = "Default trade parameters", DefaultValue = 100)]
        public double DefaultTakeProfitPips { get; set; }

        [Parameter("Default Stop Loss (pips)", Group = "Default trade parameters", DefaultValue = 20)]
        public double DefaultStopLossPips { get; set; }

        protected override void OnStart()
        {
            var tradingPanel = new TradingPanel(this, Symbol, DefaultLots, DefaultStopLossPips, DefaultTakeProfitPips);

            var border = new Border 
            {
                VerticalAlignment = PanelVerticalAlignment,
                HorizontalAlignment = PanelHorizontalAlignment,
                Style = Styles.CreatePanelBackgroundStyle(),
                Margin = "20 350 2 20",
                Width = 145,
                Child = tradingPanel
            };

            Chart.AddControl(border);
        }
    }

    public class TradingPanel : CustomControl
    {
        private const string LotsInputKey = "LotsKey";
        private const string TakeProfitInputKey = "TPKey";
        private const string StopLossInputKey = "SLKey";
        private readonly IDictionary<string, TextBox> _inputMap = new Dictionary<string, TextBox>();
        private readonly Robot _robot;
        private readonly Symbol _symbol;

        public TradingPanel(Robot robot, Symbol symbol, double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            _robot = robot;
            _symbol = symbol;
            AddChild(CreateTradingPanel(defaultLots, defaultStopLossPips, defaultTakeProfitPips));
        }

        private ControlBase CreateTradingPanel(double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            var mainPanel = new StackPanel();

            var header = CreateHeader();
            mainPanel.AddChild(header);

            var contentPanel = CreateContentPanel(defaultLots, defaultStopLossPips, defaultTakeProfitPips);
            mainPanel.AddChild(contentPanel);

            return mainPanel;
        }

        private ControlBase CreateHeader()
        {
            var headerBorder = new Border 
            {
                BorderThickness = "0 0 0 1",
                Style = Styles.CreateCommonBorderStyle()
            };

            var header = new TextBlock 
            {
                Text = "Quick Trading Panel",
                Margin = "10 7",
                Style = Styles.CreateHeaderStyle()
            };

            headerBorder.Child = header;
            return headerBorder;
        }

        private StackPanel CreateContentPanel(double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            var contentPanel = new StackPanel 
            {
                Margin = 10
            };
            var grid = new Grid(4, 3);
            //var grid2 = new Grid(5, 3);
            grid.Columns[1].SetWidthInPixels(5);

            var sellButton = CreateTradeButton("SELL", Styles.CreateSellButtonStyle(), TradeType.Sell);
            grid.AddChild(sellButton, 0, 0);

            var buyButton = CreateTradeButton("BUY", Styles.CreateBuyButtonStyle(), TradeType.Buy);
            grid.AddChild(buyButton, 0, 2);

            var lotsInput = CreateInputWithLabel("Quantity (Lots)", defaultLots.ToString("F2"), LotsInputKey);
            grid.AddChild(lotsInput, 1, 0, 1, 3);

            var stopLossInput = CreateInputWithLabel("SL/Pips/", defaultStopLossPips.ToString("F1"), StopLossInputKey);
            grid.AddChild(stopLossInput, 2, 0);

            var takeProfitInput = CreateInputWithLabel("TP/Pips/", defaultTakeProfitPips.ToString("F1"), TakeProfitInputKey);
            grid.AddChild(takeProfitInput, 2, 2);

            var closeAllButton = CreateCloseAllButton();
            var closeAllButton2 = CreateCloseAllButton2();
            //grid.AddChild(closeAllButton, 3, 0, 1, 3);
            //grid.AddChild(closeAllButton2, 3, 0, 1, 3);

            grid.AddChild(closeAllButton, 3, 0);
            grid.AddChild(closeAllButton2, 3, 2);

            contentPanel.AddChild(grid);

            return contentPanel;
        }

        private Button CreateTradeButton(string text, Style style, TradeType tradeType)
        {
            var tradeButton = new Button 
            {
                Text = text,
                Style = style,
                Height = 25
            };

            tradeButton.Click += args => ExecuteMarketOrderAsync(tradeType);

            return tradeButton;
        }

        private ControlBase CreateCloseAllButton()
        {
            var closeAllBorder = new Border 
            {
                Margin = "0 20 0 0",
                BorderThickness = "0 1 0 0",
                Style = Styles.CreateCommonBorderStyle()
            };

            var closeButton = new Button 
            {
                Style = Styles.CreateCloseButtonStyle(),
                Text = "Close.A",
                Margin = "0 20 0 0"
            };

            closeButton.Click += args => CloseAll();
            closeAllBorder.Child = closeButton;
            
            return closeAllBorder;
        }

        private ControlBase CreateCloseAllButton2()
        {

            var closeAllBorder2 = new Border 
            {
                Margin = "0 20 0 0",
                BorderThickness = "0 1 0 0",
                Style = Styles.CreateCommonBorderStyle()
            };

            var closeButton2 = new Button 
            {
                Style = Styles.CreateCloseButtonStyle(),
                Text = "Close.P",
                Margin = "0 20 0 0"
            };

            closeButton2.Click += args => ClosePart();
            closeAllBorder2.Child = closeButton2;
            
            return closeAllBorder2;
        }
        
        private Panel CreateInputWithLabel(string label, string defaultValue, string inputKey)
        {
            var stackPanel = new StackPanel 
            {
                Orientation = Orientation.Vertical,
                Margin = "0 10 0 0"
            };

            var textBlock = new TextBlock 
            {
                Text = label
            };

            var input = new TextBox 
            {
                Margin = "0 5 0 0",
                Text = defaultValue,
                Style = Styles.CreateInputStyle()
            };

            _inputMap.Add(inputKey, input);

            stackPanel.AddChild(textBlock);
            stackPanel.AddChild(input);

            return stackPanel;
        }

        private void ExecuteMarketOrderAsync(TradeType tradeType)
        {
            var lots = GetValueFromInput(LotsInputKey, 0);
            if (lots <= 0)
            {
                _robot.Print(string.Format("{0} failed, invalid Lots", tradeType));
                return;
            }

            var stopLossPips = GetValueFromInput(StopLossInputKey, 0);
            var takeProfitPips = GetValueFromInput(TakeProfitInputKey, 0);

            _robot.Print(string.Format("Open position with: LotsParameter: {0}, StopLossPipsParameter: {1}, TakeProfitPipsParameter: {2}", lots, stopLossPips, takeProfitPips));
            
            //var netProfit = Account.UnrealizedNetProfit;
            //var PercentProfit = Math.Round(netProfit / Account.Balance * 100, 2);
            
            var volume = _symbol.QuantityToVolumeInUnits(lots);
            
            if (Account.Equity < Account.Balance * ((100 - maxDrawDown) / 100))
            {
                //foreach (var position in Positions)
                    //ClosePositionAsync(position);
            }
            
            _robot.ExecuteMarketOrderAsync(tradeType, _symbol.Name, volume, "Trade Panel Sample", stopLossPips, takeProfitPips);
        }

        private double GetValueFromInput(string inputKey, double defaultValue)
        {
            double value;

            return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue;
        }

        private void CloseAll()
        {
            foreach (var position in _robot.Positions)
                _robot.ClosePositionAsync(position);
        }
    
        
        private void ClosePart()
        {
            foreach (var position in _robot.Positions) 
        { 
            
            _robot.ClosePosition(position, 5); 
             
        }
        }
    
    }

    public static class Styles
    {
        public static Style CreatePanelBackgroundStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.CornerRadius, 3);
            style.Set(ControlProperty.BackgroundColor, GetColorWithOpacity(Color.FromHex("#292929"), 0.10m), ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, GetColorWithOpacity(Color.FromHex("#FFFFFF"), 0.10m), ControlState.LightTheme);
            style.Set(ControlProperty.BorderColor, Color.FromHex("#3C3C3C"), ControlState.DarkTheme);
            style.Set(ControlProperty.BorderColor, Color.FromHex("#C3C3C3"), ControlState.LightTheme);
            style.Set(ControlProperty.BorderThickness, new Thickness(1));

            return style;
        }

        public static Style CreateCommonBorderStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.BorderColor, GetColorWithOpacity(Color.FromHex("#FFFFFF"), 0.12m), ControlState.DarkTheme);
            style.Set(ControlProperty.BorderColor, GetColorWithOpacity(Color.FromHex("#000000"), 0.12m), ControlState.LightTheme);
            return style;
        }

        public static Style CreateHeaderStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.ForegroundColor, GetColorWithOpacity("#FFFFFF", 0.70m), ControlState.DarkTheme);
            style.Set(ControlProperty.ForegroundColor, GetColorWithOpacity("#000000", 0.65m), ControlState.LightTheme);
            return style;
        }

        public static Style CreateInputStyle()
        {
            var style = new Style(DefaultStyles.TextBoxStyle);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#1A1A1A"), ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#111111"), ControlState.DarkTheme | ControlState.Hover);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#E7EBED"), ControlState.LightTheme);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#D6DADC"), ControlState.LightTheme | ControlState.Hover);
            style.Set(ControlProperty.CornerRadius, 3);
            return style;
        }

        public static Style CreateBuyButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#009345"), Color.FromHex("#10A651"));
        }

        public static Style CreateSellButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#F05824"), Color.FromHex("#FF6C36"));
        }

        public static Style CreateCloseButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#F05824"), Color.FromHex("#FF6C36"));
        }

        private static Style CreateButtonStyle(Color color, Color hoverColor)
        {
            var style = new Style(DefaultStyles.ButtonStyle);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.LightTheme);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.DarkTheme | ControlState.Hover);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.LightTheme | ControlState.Hover);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.DarkTheme);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.LightTheme);
            return style;
        }

        private static Color GetColorWithOpacity(Color baseColor, decimal opacity)
        {
            var alpha = (int)Math.Round(byte.MaxValue * opacity, MidpointRounding.AwayFromZero);
            return Color.FromArgb(alpha, baseColor);
        }
    }
}

 

Hi there,

The errors are different this time and they are self explanatory. You are using variables that are not defined anywhere.

Best regards,

Panagiotis

could you please give me the code?

Unfortunately I cannot write the code for you. If you have specific programming questions, I am happy to answer them. But if you don't know how to program, it's better to hire a professional.


@PanagiotisCharalampous

PanagiotisCharalampous
12 Nov 2024, 06:25

RE: RE: Custom indicator Plotting horizontal lines at User specified price increments

SaphirSpecs said: 

PanagiotisCharalampous said: 

 

so I’m not really fam with coding on this platform and currently the code does plot horizontal lines on the workspace. 
the ideal output is 

-user defines (current) price at which the algo starts plotting horizontal lines

-user defines increment at which each horizontal line is plotted 

 for example ( Gold 2000, 3, 100) 

algo plots a horizontal line each $3 

currently my code gives me the prompts for each parameter but does not even plot a single line. 
ideally the code would plot automatically using a for loop. But worst case scenario I can manually enter the code for each line 

Hi there,

Can you explain your issue in more detail? What do you expect your code to do and what does it do instead?

Best regards,

Panagiotis

 

Hi there,

I tried your indicator and it plots the lines fine. 

So I do not see a problem.

Best regards,


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 14:25

RE: RE: RE: Cannot login to app ctrader android

balnisrokas said: 

balnisrokas said: 

PanagiotisCharalampous said: 

Hi there,

Can you record a video demonstrating what you are looking at?

Best regards,

Panagiotis

https://files.fm/u/4txfsb9mh3 here is video

So, any ideas? I need to trade and i cannot do it

Hi there,

It seems you have confirmed that you are a US resident. If you uninstall it and reinstall it, it should ask you again. If you are not a US resident, then click that you are not.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 14:11

RE: RE: Risk-Reward Tool - Where is it?

JohnnyG said: 

PanagiotisCharalampous said: 

Hi there,

This tool is only available on cTrader Web at the moment.

Best regards,

Panagiotis

Why? It would be useful, if all platforms would have same usability. 

It will be added to the rest of the applications in future updates


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 14:11

RE: RE: RE: RE: lock buy sell button

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

Add

using System.Linq;

in the namespaces you use

Best regards,

Panagiotis

I put it but it did not work

Please share the updated cBot code

using System;
using System.Collections.Generic;
using cAlgo.API;
using cAlgo.API.Internals;

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SampleTradingPanel : Robot
    {
        [Parameter("Vertical Position", Group = "Panel alignment", DefaultValue = VerticalAlignment.Top)]
        public VerticalAlignment PanelVerticalAlignment { get; set; }

        [Parameter("Horizontal Position", Group = "Panel alignment", DefaultValue = HorizontalAlignment.Left)]
        public HorizontalAlignment PanelHorizontalAlignment { get; set; }

        [Parameter("Default Lots", Group = "Default trade parameters", DefaultValue = 0.01)]
        public double DefaultLots { get; set; }

        [Parameter("Default Take Profit (pips)", Group = "Default trade parameters", DefaultValue = 100)]
        public double DefaultTakeProfitPips { get; set; }

        [Parameter("Default Stop Loss (pips)", Group = "Default trade parameters", DefaultValue = 20)]
        public double DefaultStopLossPips { get; set; }

        protected override void OnStart()
        {
            var tradingPanel = new TradingPanel(this, Symbol, DefaultLots, DefaultStopLossPips, DefaultTakeProfitPips);

            var border = new Border 
            {
                VerticalAlignment = PanelVerticalAlignment,
                HorizontalAlignment = PanelHorizontalAlignment,
                Style = Styles.CreatePanelBackgroundStyle(),
                Margin = "20 350 2 20",
                Width = 145,
                Child = tradingPanel
            };

            Chart.AddControl(border);
        }
    }

    public class TradingPanel : CustomControl
    {
        private const string LotsInputKey = "LotsKey";
        private const string TakeProfitInputKey = "TPKey";
        private const string StopLossInputKey = "SLKey";
        private readonly IDictionary<string, TextBox> _inputMap = new Dictionary<string, TextBox>();
        private readonly Robot _robot;
        private readonly Symbol _symbol;

        public TradingPanel(Robot robot, Symbol symbol, double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            _robot = robot;
            _symbol = symbol;
            AddChild(CreateTradingPanel(defaultLots, defaultStopLossPips, defaultTakeProfitPips));
        }

        private ControlBase CreateTradingPanel(double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            var mainPanel = new StackPanel();

            var header = CreateHeader();
            mainPanel.AddChild(header);

            var contentPanel = CreateContentPanel(defaultLots, defaultStopLossPips, defaultTakeProfitPips);
            mainPanel.AddChild(contentPanel);

            return mainPanel;
        }

        private ControlBase CreateHeader()
        {
            var headerBorder = new Border 
            {
                BorderThickness = "0 0 0 1",
                Style = Styles.CreateCommonBorderStyle()
            };

            var header = new TextBlock 
            {
                Text = "Quick Trading Panel",
                Margin = "10 7",
                Style = Styles.CreateHeaderStyle()
            };

            headerBorder.Child = header;
            return headerBorder;
        }

        private StackPanel CreateContentPanel(double defaultLots, double defaultStopLossPips, double defaultTakeProfitPips)
        {
            var contentPanel = new StackPanel 
            {
                Margin = 10
            };
            var grid = new Grid(4, 3);
            //var grid2 = new Grid(5, 3);
            grid.Columns[1].SetWidthInPixels(5);

            var sellButton = CreateTradeButton("SELL", Styles.CreateSellButtonStyle(), TradeType.Sell);
            grid.AddChild(sellButton, 0, 0);

            var buyButton = CreateTradeButton("BUY", Styles.CreateBuyButtonStyle(), TradeType.Buy);
            grid.AddChild(buyButton, 0, 2);

            var lotsInput = CreateInputWithLabel("Quantity (Lots)", defaultLots.ToString("F2"), LotsInputKey);
            grid.AddChild(lotsInput, 1, 0, 1, 3);

            var stopLossInput = CreateInputWithLabel("SL/Pips/", defaultStopLossPips.ToString("F1"), StopLossInputKey);
            grid.AddChild(stopLossInput, 2, 0);

            var takeProfitInput = CreateInputWithLabel("TP/Pips/", defaultTakeProfitPips.ToString("F1"), TakeProfitInputKey);
            grid.AddChild(takeProfitInput, 2, 2);

            var closeAllButton = CreateCloseAllButton();
            var closeAllButton2 = CreateCloseAllButton2();
            //grid.AddChild(closeAllButton, 3, 0, 1, 3);
            //grid.AddChild(closeAllButton2, 3, 0, 1, 3);

            grid.AddChild(closeAllButton, 3, 0);
            grid.AddChild(closeAllButton2, 3, 2);

            contentPanel.AddChild(grid);

            return contentPanel;
        }

        private Button CreateTradeButton(string text, Style style, TradeType tradeType)
        {
            var tradeButton = new Button 
            {
                Text = text,
                Style = style,
                Height = 25
            };

            tradeButton.Click += args => ExecuteMarketOrderAsync(tradeType);

            return tradeButton;
        }

        private ControlBase CreateCloseAllButton()
        {
            var closeAllBorder = new Border 
            {
                Margin = "0 20 0 0",
                BorderThickness = "0 1 0 0",
                Style = Styles.CreateCommonBorderStyle()
            };

            var closeButton = new Button 
            {
                Style = Styles.CreateCloseButtonStyle(),
                Text = "Close.A",
                Margin = "0 20 0 0"
            };

            closeButton.Click += args => CloseAll();
            closeAllBorder.Child = closeButton;
            
            return closeAllBorder;
        }

        private ControlBase CreateCloseAllButton2()
        {

            var closeAllBorder2 = new Border 
            {
                Margin = "0 20 0 0",
                BorderThickness = "0 1 0 0",
                Style = Styles.CreateCommonBorderStyle()
            };

            var closeButton2 = new Button 
            {
                Style = Styles.CreateCloseButtonStyle(),
                Text = "Close.P",
                Margin = "0 20 0 0"
            };

            closeButton2.Click += args => ClosePart();
            closeAllBorder2.Child = closeButton2;
            
            return closeAllBorder2;
        }
        
        private Panel CreateInputWithLabel(string label, string defaultValue, string inputKey)
        {
            var stackPanel = new StackPanel 
            {
                Orientation = Orientation.Vertical,
                Margin = "0 10 0 0"
            };

            var textBlock = new TextBlock 
            {
                Text = label
            };

            var input = new TextBox 
            {
                Margin = "0 5 0 0",
                Text = defaultValue,
                Style = Styles.CreateInputStyle()
            };

            _inputMap.Add(inputKey, input);

            stackPanel.AddChild(textBlock);
            stackPanel.AddChild(input);

            return stackPanel;
        }

        private void ExecuteMarketOrderAsync(TradeType tradeType)
        {
            var lots = GetValueFromInput(LotsInputKey, 0);
            if (lots <= 0)
            {
                _robot.Print(string.Format("{0} failed, invalid Lots", tradeType));
                return;
            }

            var stopLossPips = GetValueFromInput(StopLossInputKey, 0);
            var takeProfitPips = GetValueFromInput(TakeProfitInputKey, 0);

            _robot.Print(string.Format("Open position with: LotsParameter: {0}, StopLossPipsParameter: {1}, TakeProfitPipsParameter: {2}", lots, stopLossPips, takeProfitPips));
            
            //var netProfit = Account.UnrealizedNetProfit;
            //var PercentProfit = Math.Round(netProfit / Account.Balance * 100, 2);
            
            var volume = _symbol.QuantityToVolumeInUnits(lots);
            
            if (Account.Equity < Account.Balance * ((100 - maxDrawDown) / 100))
            {
                //foreach (var position in Positions)
                    //ClosePositionAsync(position);
            }
            
            _robot.ExecuteMarketOrderAsync(tradeType, _symbol.Name, volume, "Trade Panel Sample", stopLossPips, takeProfitPips);
        }

        private double GetValueFromInput(string inputKey, double defaultValue)
        {
            double value;

            return double.TryParse(_inputMap[inputKey].Text, out value) ? value : defaultValue;
        }

        private void CloseAll()
        {
            foreach (var position in _robot.Positions)
                _robot.ClosePositionAsync(position);
        }
    
        
        private void ClosePart()
        {
            foreach (var position in _robot.Positions) 
        { 
            
            _robot.ClosePosition(position, 5); 
             
        }
        }
    
    }

    public static class Styles
    {
        public static Style CreatePanelBackgroundStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.CornerRadius, 3);
            style.Set(ControlProperty.BackgroundColor, GetColorWithOpacity(Color.FromHex("#292929"), 0.10m), ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, GetColorWithOpacity(Color.FromHex("#FFFFFF"), 0.10m), ControlState.LightTheme);
            style.Set(ControlProperty.BorderColor, Color.FromHex("#3C3C3C"), ControlState.DarkTheme);
            style.Set(ControlProperty.BorderColor, Color.FromHex("#C3C3C3"), ControlState.LightTheme);
            style.Set(ControlProperty.BorderThickness, new Thickness(1));

            return style;
        }

        public static Style CreateCommonBorderStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.BorderColor, GetColorWithOpacity(Color.FromHex("#FFFFFF"), 0.12m), ControlState.DarkTheme);
            style.Set(ControlProperty.BorderColor, GetColorWithOpacity(Color.FromHex("#000000"), 0.12m), ControlState.LightTheme);
            return style;
        }

        public static Style CreateHeaderStyle()
        {
            var style = new Style();
            style.Set(ControlProperty.ForegroundColor, GetColorWithOpacity("#FFFFFF", 0.70m), ControlState.DarkTheme);
            style.Set(ControlProperty.ForegroundColor, GetColorWithOpacity("#000000", 0.65m), ControlState.LightTheme);
            return style;
        }

        public static Style CreateInputStyle()
        {
            var style = new Style(DefaultStyles.TextBoxStyle);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#1A1A1A"), ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#111111"), ControlState.DarkTheme | ControlState.Hover);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#E7EBED"), ControlState.LightTheme);
            style.Set(ControlProperty.BackgroundColor, Color.FromHex("#D6DADC"), ControlState.LightTheme | ControlState.Hover);
            style.Set(ControlProperty.CornerRadius, 3);
            return style;
        }

        public static Style CreateBuyButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#009345"), Color.FromHex("#10A651"));
        }

        public static Style CreateSellButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#F05824"), Color.FromHex("#FF6C36"));
        }

        public static Style CreateCloseButtonStyle()
        {
            return CreateButtonStyle(Color.FromHex("#F05824"), Color.FromHex("#FF6C36"));
        }

        private static Style CreateButtonStyle(Color color, Color hoverColor)
        {
            var style = new Style(DefaultStyles.ButtonStyle);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.DarkTheme);
            style.Set(ControlProperty.BackgroundColor, color, ControlState.LightTheme);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.DarkTheme | ControlState.Hover);
            style.Set(ControlProperty.BackgroundColor, hoverColor, ControlState.LightTheme | ControlState.Hover);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.DarkTheme);
            style.Set(ControlProperty.ForegroundColor, Color.FromHex("#FFFFFF"), ControlState.LightTheme);
            return style;
        }

        private static Color GetColorWithOpacity(Color baseColor, decimal opacity)
        {
            var alpha = (int)Math.Round(byte.MaxValue * opacity, MidpointRounding.AwayFromZero);
            return Color.FromArgb(alpha, baseColor);
        }
    }
}

 

Hi there,

The errors are different this time and they are self explanatory. You are using variables that are not defined anywhere.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 14:07

Hi there,

This is not possible at the moment but you can suggest it in Suggestions.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 14:05

RE: RE: cTrader web NOT usable lately!!

RobinRaePhoto said: 

PanagiotisCharalampous said: 

Hi there,

Thank you for reporting this issue. Could you please send us some troubleshooting information the next time this happens? Please paste a link to this discussion inside the text box before you submit it.

Best regards,

Panagiotis
 

Thank you for your response. The video instruction did not show how to access the “troubleshooting” submission box. I finally figured out how to access it. I just submitted the troubleshooting information, including the link to this discussion. How will I hear back about this? 

Hi there,

The high memory usage in the browser may be due to a video card issue, which sometimes requires a computer restart to restore performance.

Please restart your Mac and check if your setup meets the minimum system requirements for cTrader. You can review them here: cTrader System Requirements.

If the issue persists, please wait for the next cTrader release, where we are working on fixing any potential issues.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 08:47

RE: RE: RE: RE: How to get list of trader history

ctid8575994 said: 

PanagiotisCharalampous said: 

ctid8575994 said: 

PanagiotisCharalampous said: 

Hi there,

It is really hard to help you with this level of information since do not know what you are doing. Your issue could be anywhere, from wrong dates, wrong account id or any other oversight in your code. A way forward would be to reproduce your issue using the example project. If you cannot, the problem is somewhere in your code. If you can, then provide us the necessary information to reproduce it as well.

Best regards,

Panagiotis

Hi,
Thank you for your response. Please visit https://github.com/Agus-Wei/ctrader-openapi for the reproduce code.

Please use below variable values 

appClientId = "11952_cukFsQKaloXkbJIP6Qi95k9jZ4Dqux1ehviD8Xm4rf4NP70Nr6"appClientSecret = "5100bMPPdKnTIkVf4nNdgP752oxzggUgbdd3hKWLr3hldHP5He"accessToken = "7NYgAg33OeHobiiWVTVEafIIZUvD019QVIdHYTGoOdI"

Here is what I get when I try to get Deal List



On app.ctrader.com, I can see my account already have trade history as shown on the screenshot below

Hi there,

I am not an expert in Python but I could not find where do you read the ProtoOADealListRes response.

Best regards,

Panagiotis

Hi,
It is on this part print("Message received: \n", Protobuf.extract(message))

as on below screenshot, it only give me ctidTraderAccountId.

Obviously this method does not do anything more. You would need to write some more code to read the deals out of the extracted message. 


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 08:43

Hi there,

Can you record a video demonstrating what you are looking at?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 08:41

Hi there,

Unfortunately this is not possible at the moment. It will be added in a future update of Open API.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
11 Nov 2024, 08:16

RE: RE: Backtest for a multisymbol strategy crashes after upgrade to ctrader 5.0.x

richardsmits007 said: 

PanagiotisCharalampous said: 

Hi Richard, 

Can you please let us know your broker as well?

Best regards,

Panagiotis

Hi Panagiotis,

I'm using Pepperstone (Europe) as broker.

Best regards,

Richard

Thank you. The issue will be investigated and resolved in an upcoming update


@PanagiotisCharalampous