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

PanagiotisCharalampous
25 Nov 2024, 06:33

Hi there, 

The backtesting function should be at the same place as on the cTrader Windows application. Just click on the instance and you should get the tab on the right.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
25 Nov 2024, 06:29

RE: Backtest

nabilvigninou said: 

Did you tun the backtesting in this screenshot? Can you record a video demonstrating all the steps you take and then show the log?


@PanagiotisCharalampous

PanagiotisCharalampous
23 Nov 2024, 09:07

You can find the backtesting logs here


@PanagiotisCharalampous

PanagiotisCharalampous
23 Nov 2024, 09:01

Hi there,

I did not understand what calculation you are trying to do. Can you elaborate a bit more, providing us with some examples?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
23 Nov 2024, 08:59

Hi all,

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


 


@PanagiotisCharalampous

PanagiotisCharalampous
23 Nov 2024, 08:59

Hi all,

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


 


@PanagiotisCharalampous

PanagiotisCharalampous
23 Nov 2024, 08:48

Hi there,

We are not aware of any specific issue with optimization performance. If you can share more information with us like the cBot code and the optimization parameters and settings, we are happy to have a look.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 10:16

Hi there,

Please contact us at community@ctrader.com with more information.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 09:04

Hi there,

Yes it is. Just add an instance and click on it. You should see the backtesting tab on the right

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 08:57

Hi there,

This info needs to be kept on the client side. The whole concept of Async execution is to proceed with your code execution while you expect a response from the server. There is no pending state on the server side. The server receives the order and responds.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 08:51

RE: RE: RE: RE: Order Execution Error : Nothing to change

firemyst said: 

Panagio

 

Ok so at least you get a response and a message. I will suggest to the team to enhance the message.

I suppose the question for the team to consider is - should it even throw an error message if there's nothing to change? As opposed to, say, a warning? (depending on how the server side captures/responds to different severity levels)

 

There are no severity levels. There are only messages in the Error field when the modification is not successful.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 06:11

RE: RE: Order Execution Error : Nothing to change

firemyst said: 

PanagiotisCharalampous said: 

Hi firemyst,

Nor does it seem to be returned when checking a TradeResult object for error messages (unless I'm doing that wrong).

Can you share the code you are using so that we can see what you are doing? The below should work

Print("Error: {0}", TradeResult.Error);

Best regards,

Panagiotgis

Below is some sample code you can run on a forex symbol like EURJPY to demonstrate the lack of information.

The output from the log is:

Note that it doesn't say, “Nothing to Change” in the error reported, the symbol name, or anything. Just says, “invalid request”, which to me makes no sense when someone's looking for the actual error message in log files. “invalid request” can happen for any number of reasons, and means we have to keep bothering our broker to find out what and why was an “invalid request”.

Code to reproduce:

using System;using cAlgo.API;namespace cAlgo{    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]    public class TokyoSessionStrategy : Robot    {        private Position _p;        private int _tickCount;        protected override void OnStart()        {            _p = null;            _tickCount = 0;        }        protected override void OnTick()        {            TradeResult r;            if (_p == null)            {                r = ExecuteMarketOrder(TradeType.Buy, SymbolName, 1000, "TESTBOT");                if (!r.IsSuccessful)                {                    Print("Order not successful. Please restart bot. Error message {0}", r.Error.Value.ToString());                }                else                {                    _p = Positions.Find("TESTBOT");                }            }            Print("TICK COUNT {0}", _tickCount.ToString());                        if (_tickCount % 5 == 0 && _p != null)            {                Print("Modifying order");                r = _p.ModifyStopLossPrice(_p.StopLoss.GetValueOrDefault());                if (!r.IsSuccessful)                {                    Print("Order not successful. Error message:");                    Print("1 {0}", r.Error);                    Print("2 {0}", r.Error.Value.ToString());                }            }            _tickCount++;        }        protected override void OnStop()        {            if (_p != null)            {                _p.Close();            }            base.OnStop();        }    }}

 

 

Ok so at least you get a response and a message. I will suggest to the team to enhance the message.


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 06:08

RE: RE: RE: RE: RE: When a bot was "unexpectedly terminated", cTrader shows the bot as still running

firemyst said: 

PanagiotisCharalampous said: 

 

We do not have an ETA unfortunately. It will be released in one of the following updates

I didn't see any release notes for 5.0.46. 

Is this issue resolved in 5.0.46?

We will post release notes soon. This issue was not solved in 5.0.46. It will be fixed in 5.1.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 06:05

Hi there,

Can you be more specific? What do you mean when you say you cannot see the built-in indicators? Can you share screenshots/videos?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
22 Nov 2024, 06:01

RE: Backtest

nabilvigninou said: 

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TrendFollowingBot : Robot
    {
        private double lotSize;
        
        protected override void OnStart()
        {
            // Calcul de la taille du lot basé sur le solde du compte
            lotSize = Account.Balance / 10000;
        }

        protected override void OnTick()
        {
            // Vérifie s'il y a assez de barres dans l'historique
            if (Bars.Count < 3)
                return;

            // Obtient les trois dernières barres
            var currentBar = Bars.Last(0);
            var previousBar = Bars.Last(1);
            var twoBarsAgo = Bars.Last(2);

            // Vérifie les conditions pour les positions longues (achat)
            bool bullishCondition = previousBar.Close > previousBar.Open 
                               && twoBarsAgo.Close > twoBarsAgo.Open;

            // Vérifie les conditions pour les positions courtes (vente)
            bool bearishCondition = previousBar.Close < previousBar.Open 
                               && twoBarsAgo.Close < twoBarsAgo.Open;

            // Gestion des positions existantes et nouvelles entrées
            ManagePositions(bullishCondition, bearishCondition);
        }

        private void ManagePositions(bool bullishCondition, bool bearishCondition)
        {
            var positions = Positions;

            // Si condition haussière
            if (bullishCondition)
            {
                // Ferme d'abord toutes les positions vendeuses
                foreach (var position in positions)
                {
                    if (position.TradeType == TradeType.Sell)
                        ClosePosition(position);
                }

                // Vérifie s'il n'y a pas de positions acheteuses ouvertes
                if (!HasOpenPositions(TradeType.Buy))
                {
                    ExecuteMarketOrder(TradeType.Buy, SymbolName, lotSize, "Buy Signal");
                }
            }
            // Si condition baissière
            else if (bearishCondition)
            {
                // Ferme d'abord toutes les positions acheteuses
                foreach (var position in positions)
                {
                    if (position.TradeType == TradeType.Buy)
                        ClosePosition(position);
                }

                // Vérifie s'il n'y a pas de positions vendeuses ouvertes
                if (!HasOpenPositions(TradeType.Sell))
                {
                    ExecuteMarketOrder(TradeType.Sell, SymbolName, lotSize, "Sell Signal");
                }
            }
        }

        private bool HasOpenPositions(TradeType tradeType)
        {
            foreach (var position in Positions)
            {
                if (position.TradeType == tradeType)
                    return true;
            }
            return false;
        }
    }
}

 

Les paramètres de mon backtest : Capital initial 1 000 dollars avec les graphiques renko de 500 pips.

je n'ai pas connecté un courtier

 

Hi there,

Can you please also share screenshots from your log?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 13:35

RE: RE: RE: FontFamily in Button Text?

ctid5996231 said: 

@Panagiotis

My platform has just updated itself to 5.0.46, and the  Button font issue appears to have been fixed, thanks…

However, something  else is now broken, all buttons' ForegroundColor is now white, and I'm unable to change it…?

Thanks,

Mat

 

Hi Mat,

We will fix this as well.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 13:34

Hi all,

We do not have such plans at the moment.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 13:33

Hi there,

Please provide us with the following information

  • cBot code
  • Backtesting parameters and settings
  • Broker
  • Screenshots from your backtesting log

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 08:50

Hi firemyst,

Nor does it seem to be returned when checking a TradeResult object for error messages (unless I'm doing that wrong).

Can you share the code you are using so that we can see what you are doing? The below should work

Print("Error: {0}", TradeResult.Error);

Best regards,

Panagiotgis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 06:47

Hi there,

This happens because you are printing the values at the opening of the bar. The indicator value might change by the time the bar closes. Try printing values for closed bars i.e. 

            var openTime = Bars.OpenTimes.Last(1);
            var _rsi = rsi.Result.Last(1);

Best regards,

Panagiotis


@PanagiotisCharalampous