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

PanagiotisCharalampous
26 Jul 2024, 10:46

RE: Testnet Server

santhosh.ms said: 

In order to create our own server like FTMO we will need to first understand the basics of server setup and maintenance. We must carefully choose the right hardware and software components that will support our desired functionality. Once we have all the necessary tools and resources we can start building and configuring our server according to our specific requirements. It is important to regularly monitor and update our server to ensure optimal performance and security. By following these steps diligently we can successfully create a server similar to FTMO for our own use.

 


 

Hi there,

I am not sure I understand what you are talking about.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 09:05

RE: RE: RE: RE: Copy from one broker to another broker

JINGXUAN said: 

PanagiotisCharalampous said: 

TradeExpert said: 

Thank you, and if the symbol is mapped correctly, then there is no problem to copy trades  from one broker to another, right?


PanagiotisCharalampous said: 

Hi there,

There is a mapping between symbols with different names. If you think a symbol is not mapped correctly accross symbols, feel free to share more information about it.

Best regards,

Panagiotis

 

Yes this is correct

Which means when my robot execute #USSPX500 in FxPro, for my investor who using ICMarket will execute US500 at the same time when my robot trigger execution but there might be different spread/commission/swap which lead to different PnL result, investor account will execute any order whenever strategy provider account execute any order, is that correct? 

Yes


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 09:05

Hi there,

You can use demo accounts and demo servers for this.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 06:08

RE: RE: Risk-Reward Tool missing on the desktop version

ctid5137747 said: 

PanagiotisCharalampous said: 

Hi there,

It is not available at the moment, it will be added in a future update.

Best regards,

Panagiotis

Do we know when?

Thanks Dennis

Unfortunately no


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 06:07

Hi there,

Unfortunately I did not understand what is the issue you are trying to describe. You can place an order with one click using several ways e.g. QuickTrade buttons. Can you please elaborate?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 06:05

RE: RE: Critical bot action error. Bankruption possible.

patrickandrade2 said: 

PanagiotisCharalampous said: 

As explained in your other thread, this is an issue of your cBot, you need to handle this situation inside your cBot code

I saw that other people had the exact same problem, and the same issue happens even if you use an algo bot ctrader generated bot. I don't think it's a “me” problem, there's even a post on quora about someone who had the exact same issue and didn't find any answer here or in the ctrader database. Looks like it's something like a latency issue with ctrader while using bots, if there's a command to input a stop loss and the ctrader doesn't compute that command and proceeds with the order it doesn't look like something an external code should fix.

Hi there,

I have explained why this happens and how it can be handled. If you have evidence that this is not what happens i.e. you set a stop loss outside the spread but it is not placed, then provide us with clear instructions on how to reproduce this and we will have a look.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 05:58

RE: RE: Crashed Error Instance

angelalzatewm said: 

PanagiotisCharalampous said: 

Hi there,

As per the message, your cBot crashes. Please share your cBot code so that we can check.

Best regards,

Panagiotis

Hi, thanks for your answer, however, I find it curious that it is in a matter of seconds that the cbot stops and immediately connects, and there should at least be a message with the type of error that is being generated and it only shows a dot.

Well we cannot advise for a cBot we cannot see :) Share your code and we will have a look


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 05:56

Hi there,

Please share your cBot code so that we can check what happens.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 05:52

RE: RE: RE: Found the problem

patrickandrade2 said: 

PanagiotisCharalampous said: 

patrickandrade2 said: 

The thing is, the actual bot is misbehaving, it occurs when the bot is trying to set a stop loss and a sudden movement happens. It happened live just some moments ago. I have the setup for max 15 pips of stop loss on this strategy. When buying there was a massive movement to go down. Stop loss wasn't setted and now I'm in a huge loss. This is severe, please fix. 

Hi there,

The stop loss is ignored when it falls within the spread since it is invalid. You need to handle this situation within your cBot code and detect when stop losses are not set due to invalid values.

Best regards,

Panagiotis

And how is it possible to fix this issue? I'm trying to find any article in the support database that makes possible to implement a stop loss verification but can't find one.

Hi there,

You can check if a position has a stop loss using the Position.Opened event. See below an example

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

namespace cAlgo.Robots
{
    [Robot(AccessRights = AccessRights.None, AddIndicators = true)]
    public class CheckStopLoss : Robot
    {
        protected override void OnStart()
        {
            Positions.Opened += Positions_Opened;
        }

        private void Positions_Opened(PositionOpenedEventArgs obj)
        {
            if(obj.Position.StopLoss == null)
            {
                // Do something...
            }
        }

        protected override void OnTick()
        {
            // Handle price updates here
        }

        protected override void OnStop()
        {
            // Handle cBot stop here
        }
    }
}

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 05:47

Hi there,

Try installing the .Net 6.0 SDK from the link below

https://dotnet.microsoft.com/en-us/download/visual-studio-sdks

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
26 Jul 2024, 05:41

Hi there,

Probably your broker does not offer cTrader Copy. Reach out to them for more information.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:47

Hi there,

There is no such option at the moment. The R/R tool will be added in the rest of the applications in future releases.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:46

As explained in your other thread, this is an issue of your cBot, you need to handle this situation inside your cBot code


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:44

RE: Found the problem

patrickandrade2 said: 

The thing is, the actual bot is misbehaving, it occurs when the bot is trying to set a stop loss and a sudden movement happens. It happened live just some moments ago. I have the setup for max 15 pips of stop loss on this strategy. When buying there was a massive movement to go down. Stop loss wasn't setted and now I'm in a huge loss. This is severe, please fix. 

Hi there,

The stop loss is ignored when it falls within the spread since it is invalid. You need to handle this situation within your cBot code and detect when stop losses are not set due to invalid values.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:40

Hi there,

Accounts can be removed by the brokers. Please contact your broker regarding this.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:39

Hi there,

An obvious problem in your code is that you are using the current open bar's value for your checks. This value can change by the time the bar closes therefore this can lead to false or missing signals. You should only check closed bar values. Try the below instead

           double shortMAValue = shortMA.Result[lastIndex - 1];
           double longMAValue = longMA.Result[lastIndex - 1];
           double prevShortMAValue = shortMA.Result[lastIndex - 2];
           double prevLongMAValue = longMA.Result[lastIndex - 2];

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:36

Hi there,

As per the message, your cBot crashes. Please share your cBot code so that we can check.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:34

RE: Custom Indicator Values Controlled by cBot in cTrader

cortes.br said: 

I want to plot on the chart points that represent quantities calculated during the execution of the robot, such as limit and stop prices. I need the ability to draw values on the chart for debugging and visualization purposes. Specifically, I am looking for a function equivalent to PlotTimeSeries found in WealthLab.

 

 

PlotTimeSeries

public void PlotTimeSeries(TimeSeries ts, string name, string paneTag, WLColor color = default(WLColor), PlotStyles plotStyle = PlotStyle.Line, bool suppressLabels = false)

Plots a TimeSeries on the chart. The ts parameter is a TimeSeries instance. PlotTimeSeries is useful when plotting the results of mathematical operations on indicators and other TimeSeries. These operations always return instances of the TimeSeries class.

The name parameter should be a descriptive name of the data being plotted. This appears in the pane label.

The paneTag specifies which chart pane to plot the data in. You can specify Price for the price pane, Volume for the volume pane, or some other string value for a custom pane.

The color parameter is optional. If not provided, WealthLab will use a default color.

The plotStyle parameter is also optional, and is a member of the PlotStyle enum. If not specified, WealthLab will use PlotStyle.Line.

The suppressLabels parameter lets you disable to indicator pane labels and the value markers along the chart's right margin for this plot.

Why don't you do all of this in an indicator?


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:30

RE: RE: RE: RE: RE: RE: how to extend trendline to right?

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

tuuguu177 said: 

PanagiotisCharalampous said: 

Hi there,

I added the indicator on a chart but I see no error. Can you please explain what error do you get and how we can reproduce it?

Best regards,

Panagiotis

are you there?

You did not answer my question therefore I am not able to help you further at the moment.

This error occurred. I only want extend trend lines. That is all. I can not find right structure of extended trend line codes.

Please share the code that reproduces these error messages

Code is:

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

#pragma warning disable

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = true, AccessRights = AccessRights.None)]
    public class LinearRegressionChannel : Indicator
    {
        [Parameter("Projection Length", DefaultValue = 0)]
        public int ProjLength { get; set; }

        [Parameter("Center", DefaultValue = true)]
        public bool ShowCenter { get; set; }

        [Parameter("Channel", DefaultValue = true)]
        public bool ShowChannel { get; set; }

        [Parameter("Standard deviation", DefaultValue = true)]
        public bool ShowDeviantion { get; set; }

        public Dictionary<string, LR> LRs = new Dictionary<string, LR>();

        protected override void Initialize()
        {
            ///Add the button in the topleft corner
            Border border = new Border 
            {
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = "20 40 20 20",
                Width = 50,
                Child = new Toolbar(this)
            };

            Chart.AddControl(border);

            ///Events for calculating and drawing
            Chart.ObjectUpdated += OnChartObjectUpdated;
            Chart.ObjectRemoved += OnChartObjectRemoved;

            foreach (ChartObject o in Chart.Objects)
                if (o.Name.Length > 24 && o.Name.Substring(0, 24) == "LinearRegressionChannel " && o.IsInteractive && o.ObjectType == ChartObjectType.TrendLine)
                {
                    LRs.Add(o.Name, new LR((ChartTrendLine)o));
                    o.IsInteractive = false;
                    o.IsInteractive = true;
                }
        }

        void OnChartObjectRemoved(ChartObjectRemovedEventArgs obj)
        {
            try
            {
                if (IsCleaning)
                    return;
                RemoveAllObjectsConnectedWith(obj.ChartObject);
                if (LRs.ContainsKey(obj.ChartObject.Name))
                    LRs.Remove(obj.ChartObject.Name);
            } catch (Exception e)
            {
                Print(e);
                Print("Errore nella rimozione dell'oggetto");
            }
        }

        bool IsCleaning = false;

        void RemoveAllObjectsConnectedWith(ChartObject o)
        {
            if (LRs.ContainsKey(o.Name))
            {
                IsCleaning = true;
                for (int i = 0; i < LRs[o.Name].Children.Count; ++i)
                {
                    try
                    {
                        Chart.RemoveObject(LRs[o.Name].Children[i].Name);
                    } catch (Exception e)
                    {
                        Print(e);
                        continue;
                    }
                }
            }
            LRs[o.Name].Children.Clear();
            IsCleaning = false;
        }


        public override void Calculate(int index)
        {
        }

        void OnChartObjectUpdated(ChartObjectUpdatedEventArgs obj)
        {
            try
            {
                RemoveAllObjectsConnectedWith(obj.ChartObject);
                ///Check if object is a rectangle and if it's part of this indicator
                if (!LRs.ContainsKey(obj.ChartObject.Name))
                    return;

                ChartTrendLine lr = (ChartTrendLine)obj.ChartObject;

                // Linear regresion
                double sum_x = 0, sum_x2 = 0, sum_y = 0, sum_xy = 0, x_avg=0, x=0,x_sum_squared=0,stdDeviation=0;

                int start = Bars.OpenTimes.GetIndexByTime(lr.Time1);
                int end = Bars.OpenTimes.GetIndexByTime(lr.Time2);

                int length = Math.Abs(end - start);

                if (start > end)
                {
                    start = Bars.OpenTimes.GetIndexByTime(lr.Time2);
                    end = Bars.OpenTimes.GetIndexByTime(lr.Time1);
                }

                for (int i = start; i < end; i++)
                {
                    sum_x += 1.0 * i;
                    sum_x2 += 1.0 * i * i;
                    sum_y += Bars[i].Close;
                    sum_xy += Bars[i].Close * i;
                }

                double a = (length * sum_xy - sum_x * sum_y) / (length * sum_x2 - sum_x * sum_x);
                double b = (sum_y - a * sum_x) / length;

                // Calculate maximum and standard devaitions

                double maxUpperDeviation = 0, maxLowerDeviation = 0;
                double sumDevation = 0;

                for (int i = start; i < end; i++)
                {
                    double price = a * i + b;
                    x = Math.Abs(Bars[i].Close - price);
                    x_avg=(x_avg+x)/i;
                    x_sum_squared += (x - x_avg) * (x - x_avg);
                    maxUpperDeviation = Math.Max(Bars[i].Close - price, maxUpperDeviation);
                    maxLowerDeviation = Math.Min(Bars[i].Close - price, maxLowerDeviation);
                    stdDeviation=Math.Sqrt(x_sum_squared/(length - 1));
                    
                }

                //double stdDeviation = Math.Sqrt(sumDevation / (length - 1));

                // draw in future
                //end += (int)(length * 0.01 * ProjLength);

                double pr1 = a * start + b;
                double pr2 = a * end + b;

                if (ShowCenter)
                {
                    //LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Center " + lr.Name, start, pr1, end, pr2, Color.Blue, 1, LineStyle.DotsRare));
                    var line LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Center " + lr.Name, start, pr1, end, pr2, Color.Blue, 1, LineStyle.DotsRare));

                    line .ExtendToInfinity = true;
                }

                if (ShowChannel)
                {
                    LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Top " + lr.Name, start, pr1 + stdDeviation*2, end, pr2 + stdDeviation*2, Color.Blue, 1, LineStyle.DotsRare));
                    LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Bottom " + lr.Name, start, pr1 - stdDeviation*2, end, pr2 - stdDeviation*2, Color.Blue, 1, LineStyle.DotsRare));
                }

                if (ShowDeviantion)
                {
                    LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Dev-Top " + lr.Name, start, pr1 + stdDeviation, end, pr2 + stdDeviation, Color.Blue, 1, LineStyle.DotsRare));
                    LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Dev-Bottom " + lr.Name, start, pr1 - stdDeviation, end, pr2 - stdDeviation, Color.Blue, 1, LineStyle.DotsRare));
                }
            } catch (Exception)
            {
            }
        }
    }

    public class Toolbar : CustomControl
    {
        LinearRegressionChannel LR;

        public Toolbar(LinearRegressionChannel lr)
        {
            LR = lr;
            var AddButton = new Button 
            {
                Text = "Add",
                Style = new Style(DefaultStyles.ButtonStyle),
                Height = 25
            };

            AddButton.Click += AddArea;

            AddChild(AddButton);
        }

        void AddArea(ButtonClickEventArgs e)
        {
            double Y = (LR.Chart.TopY - LR.Chart.BottomY) * 0.6 + LR.Chart.BottomY;
            string name = "LinearRegressionChannel " + LR.Time;
            LR.LRs.Add(name, new LR(LR.Chart.DrawTrendLine(name, LR.Chart.LastVisibleBarIndex - 2, Y, (int)(LR.Chart.LastVisibleBarIndex - (LR.Chart.LastVisibleBarIndex - LR.Chart.FirstVisibleBarIndex) * 0.2), Y, Color.DarkSlateGray)));
            LR.LRs[name].Parent.IsInteractive = true;
        }
    }

    public class LR
    {
        public ChartTrendLine Parent;
        public List<ChartTrendLine> Children = new List<ChartTrendLine>();

        public LR(ChartTrendLine cr)
        {
            Parent = cr;
        }
    }
}

Your problem is this line of code. This is not correct C#

 var line LRs[lr.Name].Children.Add(Chart.DrawTrendLine("Center " + lr.Name, start, pr1, end, pr2, Color.Blue, 1, LineStyle.DotsRare));

Maybe you are trying to do this?

                    var line = Chart.DrawTrendLine("Center " + lr.Name, start, pr1, end, pr2, Color.Blue, 1, LineStyle.DotsRare);
                    line .ExtendToInfinity = true;
                    LRs[lr.Name].Children.Add(line);

 


@PanagiotisCharalampous

PanagiotisCharalampous
25 Jul 2024, 05:23

RE: RE: RE: RE: Cache data not available or corrupted

Dharaksa.pokpong said: 

PanagiotisCharalampous said: 

Dharaksa.pokpong said: 

PanagiotisCharalampous said: 

Hi there,

Which version of cTrader do you use?

Best regards,

Panagiotis

Hi Panagiotis

it's the latest version so 5.0.28

Best,

Dha

Hi Dha,

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

Hi Panagiotis,

First of all, thank you for your attention. I have already submitted the form with a link to this forum. However, I saw that there is a link to download a older version of ctrader, thus, I downloaded yet it says this broker has been suspended. Is there any way for me to use the older version for now? 

Best,

Dha

Hi Dha,

No you cannot use an older version of cTrader at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous