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

PanagiotisCharalampous
18 Jun 2024, 05:36

Hi there,

It's better to ask your broker why this happened.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:36

RE: RE: RE: Crash in visual mode during backtest and StopLoss not set duing backtest

ys2310 said: 

ys2310 said: 

PanagiotisCharalampous said: 

Hi there,

We have received the exception and the issue will be solved in an upcoming release.

Regarding the SL issue, we would need the cBot code and backtesting parameters in order to reproduce this and explain what happens.

Best regards,

Panagiotis

Hi Panagiotis,

Here is the test code that produce the SL issue, I'm using Nikkei225, Hm1 for testing

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.Robots
{
    [Robot(AccessRights = AccessRights.FullAccess, TimeZone = TimeZones.EasternStandardTime)]
    public class Test2 : Robot
    {        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int lossCut { get; set; }
        
        [Parameter(DefaultValue = 10, MinValue = 0, MaxValue = 500, Step = 10)]
        public int takeProfit { get; set; }
        
        double volume = 0.0;
        
        protected override void OnStart()
        {
            // To learn more about cTrader Automate visit our Help Center:
            // https://help.ctrader.com/ctrader-automate
        }

        protected override void OnBarClosed()
        {
            volume = 10;
            
            var last_buy_position = Positions.Where(x => x.Label == "Test" && x.SymbolName == Symbol.Name && x.TradeType == TradeType.Buy).OrderByDescending(x => x.EntryTime).FirstOrDefault();
            
            // Handle price updates here
            if(MarketData.GetBars(TimeFrame, "US500").ClosePrices.Last(0) > MarketData.GetBars(TimeFrame, "US500").OpenPrices.Last(0))
               if (last_buy_position == null || Symbol.Ask < last_buy_position.EntryPrice - 100 * Symbol.TickSize)
                   ExecuteMarketOrder(TradeType.Buy, Symbol.Name, volume, "Test", lossCut, takeProfit, (Server.Time - Bars.Last(0).OpenTime).Milliseconds.ToString());            
        }
        protected override void OnTick() {
            foreach(var position in Positions.FindAll("Test", Symbol.Name))
                if(position.StopLoss == null)
                    ModifyPositionAsync(position, Symbol.Ask - 20 * Symbol.PipSize, position.TakeProfit);
                
        }

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

Can you also tell me the broker? This usually happens when your SL falls within the symbol's spread. Please check if this is the case


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:34

RE: RE: Playback feature and c bots /algos

QuantumTrader.pro said: 

PanagiotisCharalampous said: 

Hi there,

Why don't you use backtesting to test your cBots?

Best regards,

Panagiotis

I've been looking for the optimization / backtesting section for my cBot. Since the update, I haven't been able to locate it. I'm using Desktop version 5.0.25

As responded in another thread, here they are


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:31

Hi there,

It's where it always was

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:28

Hi there,

Please provide some description of your problem.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:25

Hi there,

This option is only available in cTrader v5.0.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:24

RE: RE: RE: RE: RE: RE: Changing timeframe while backtesting using visual backtesting

bcronje said: 

PanagiotisCharalampous said: 

bcronje said: 

PanagiotisCharalampous said: 

After the backtest finishes it is possible to change the timeframe

How do I do that? When my backtest finishes, I am unable to change the timeframe on the backtest tab, the options are greyed out. Changing the timeframe under the Algo left panel does not update the backtest window timeframe either.

 

Hi there,

It looks like a bug. You should be able to change it from the instance.

Best regards,

Panagiotis

Hi Panagiotis,

I can indeed change the timeframe from the instance as per you screenshot, but the problem is when you change it there the chart on the finished backtesting tab is not changed, it stays on the timeframe of when you ran the backtest.

Kind regards

Beyers

Hi Beyers,

The timeframe will change as soon as you start backtesting again.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:22

Hi there,

I have just tried this option and works fine. Can you provide more information e.g. record a video demonstrating this happening?

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
18 Jun 2024, 05:19

Hi there,

It will be added in an upcoming update of cTrader Desktop.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 12:08

RE: RE: RE: RE: Changing timeframe while backtesting using visual backtesting

bcronje said: 

PanagiotisCharalampous said: 

After the backtest finishes it is possible to change the timeframe

How do I do that? When my backtest finishes, I am unable to change the timeframe on the backtest tab, the options are greyed out. Changing the timeframe under the Algo left panel does not update the backtest window timeframe either.

 

Hi there,

It looks like a bug. You should be able to change it from the instance.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 07:07

Hi Tarek,

One of the changes in cTrader 5.0 is that the data for all passes is kept. So if your cBot is printing too much information in the log, this could eventually hinder the performance of optimization

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 06:50

Hi there,

Thanks for reporting this behavior. We will change the color in an upcoming update.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 06:47

Hi there,

No it does not include swaps and commissions. If you need them, you would need to develop your own methods.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:48

Hi there,

This is by design. If the price jumps more that one bar, then the method is only executed once for the last bar.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:46

Hi there,

There is nothing cTrader specific here. Pip size is determined by the broker and the platform behaves accordingly.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:43

Hi there, 

Yes there is. Make sure Bid and Ask prices are checked

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:41

RE: RE: Changing timeframe while backtesting using visual backtesting

bcronje said: 

PanagiotisCharalampous said: 

Hi Cnicholasdownie,

No this is not possible and we do not have plans to add such an option. You cannot change the chart timeframe while the cBot is running.

Best Regards,

Panagiotis 

Join us on Telegram

Panagiotis, what about after the visual backtest has finished? Technically the bot is not running anymore, so why are we not able to change the timeframe then, but keep the backtest trade history?

After the backtest finishes it is possible to change the timeframe


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:39

Hi there,

Spreads are set by the brokers. You should contact your broker regarding this issue.

Best regards,

Panagiotis


@PanagiotisCharalampous

PanagiotisCharalampous
17 Jun 2024, 05:38

RE: RE: RE: RE: RE: RE: Can not login cTrader for desktop

yahuimns said: 

PanagiotisCharalampous said: 

yahuimns said: 

PanagiotisCharalampous said: 

yahuimns said: 

PanagiotisCharalampous said: 

Hi there,

If the issue persists please send us some troubleshooting info and quote the link to this discussion.

Best Regards,

Panagiotis 

=======================

 

Can not login agin now.

By the way: my internet is OK.


 

 

Hi there,

Did you send us troubleshooting?

Best regards,

Panagiotis

Hi

How to get the troubleshooting?

Check the link in my first reply

Hi

OK.

But, I mean that how to look the “error log of cTrader”, to find the reason for frequent disconnections.

Thanks

There is no such log available to you


@PanagiotisCharalampous

PanagiotisCharalampous
16 Jun 2024, 06:27

Hi there,

See the correct formula below

        private double CalculateSwap(double swap, double volume)
        { 
            return AssetConverter.Convert(Symbol.SwapLong * Symbol.PipSize * volume, Symbol.QuoteAsset, Account.Asset ); 
        }

Best regards,

Panagiotis


@PanagiotisCharalampous