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

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

PanagiotisCharalampous
21 Nov 2024, 06:43

Hi there,

In the documentation there are examples for all messages, indicating what the tag 57 should be for each message

https://help.ctrader.com/fix/specification/#messages

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 06:38

Hi there,

The price feed is a responsibility of the broker. Please talk to your broker.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
21 Nov 2024, 06:37

Hi there,

Unfortunately we cannot help you with your issue in this forum. If you have disputes with the broker, please contact the regulator and your local authorities. Also this thread will be deleted, since broker reviewing is beyond the scope of this community and defaming is not allowed.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2024, 12:09 ( Updated at: 20 Nov 2024, 12:10 )

RE: RE: Listing all Orders, Positions where the Deal Status is Rejected

Can I programmatically list the ExecutionTime instead? My TakeProfit or LimitOrder are not executed despite the price being matched.

Not sure what do you mean here. Can you elaborate?

Also, is it normal for US500_SB to take 300ms? The LO and TP are already on cTrader - but in case it matters - the hired VPS is in New York. Importantly, the VPS provider said that Metatrader takes 1-2 ms for execution. I don't understand how this can be true.

This is the matching time, not cTrader's latency. It is the time it took for the order to be executed by the liquidity provider. This is not controlled by cTrader


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2024, 11:12

Hi there,

There is no way to do this at the moment. It will be added in a future release.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2024, 09:37

RE: RE: RE: RE: Cant get ADX indicator to retuen values matching the CTrader charts

Mohammadq said: 

PanagiotisCharalampous said: 

Mohammadq said: 

PanagiotisCharalampous said: 

Hi there,

Can you share screenshots showing what you are comparing?

Best regards,

Panagiotis

Here you go..

 

Hi there,

Your chart is set to UTC+3 while your cBot prints in UTC+0.

Best regards,

Panagiotis

Many thanks for the catch, you're absolutely right.

I changed that and i get much closer results. is it ok to still have minor differences or it must be exact match?

 

Thanks

Mohammad

Hi Mohammad,

The values displayed on the chart are rounded. So you should expect minor differences.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2024, 08:23

RE: RE: api problem

madeelcrypto said: 

or Not getting any auth code

PanagiotisCharalampous said: 

Hi there,

The information you provide is very vague. Please try explaining your issue using screenshots.

Best regards,

Panagiotis

 

Hi there,

It's better to contact cMAM developer or post your issue in the cMAM group in Telegram

https://t.me/cmam_official

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
20 Nov 2024, 07:13

Hi there,

The information you provide is very vague. Please try explaining your issue using screenshots.

Best regards,

Panagiotis


@PanagiotisCharalampous