Topics

Forum Topics not found

Replies

daniel.podrazka
18 Apr 2023, 17:42

Dear Spotware Support,

I tested it some more and I found out one more thing that might be useful to fix this problem:

I have two accounts, one account has Euro as the base currency and the other is USD.

When I backtest with Euro, the problem disappears, but with USD it happens. 

 

I can do my backtesting using Euro, so it solves my temporary problem, however it would still be good to address it. Can you try reproducing the bug with base currency set to USD and tell me if you can reproduce it?


@daniel.podrazka

daniel.podrazka
18 Apr 2023, 15:27

Video showing the issue

I made a short video that shows the problem (I used the cTrader bot that I posted above). Please observe how the pointer progresses. It looks like there are times when some data is loaded and it progresses quickly for 3 days, and then it slows down again. When I comment out "_eurUsdBars = MarketData.GetBars(TimeFrame, "EURUSD");" Then the bot takes 1 second or less to execute for this period of the last month.

It's some problem related to how the data is stored/cached in the backend for data sources other than the instance symbol. It's like it's trying to load the data again on each minute bar.

 

 


@daniel.podrazka

daniel.podrazka
17 Apr 2023, 22:16

Any Updates?

@Spotware any updates on this? I feel like my request to provide a working version of your software is being ignored which makes me question credibility of your solutions.


@daniel.podrazka

daniel.podrazka
14 Apr 2023, 20:41

RE: RE:

robert.john.edgar said:

firemyst said:

Then why not just create your own function that does the same thing?

Should be straight forward.

Just a simple for-loop going through each bar in the data series except the current bar, and compare the values?

Well if you read my original post you will see that's exactly what I am doing, but I had wondered whether I was missing something obvious and was just reinventing the wheel, hence why I posted on this forum to hear from people with more experience at coding cBots about how they were dealing with what should be a common issue.

 

Rob

There is a simple solution to that although a bit ugly:

Call the function twice, once for period=0 and once for period=1 and combine the result:

where period=1 == True and period=0 == False


@daniel.podrazka

daniel.podrazka
14 Apr 2023, 14:14

Provide 4.5.9 executable

This issue is impeding my work. Please, provide the 4.5.9 version, so I can use it until this issue is resolved. I tried using the 4.1 that is available on cTrader, but 4.1 doesn't work with my bots.


@daniel.podrazka

daniel.podrazka
13 Apr 2023, 16:18

RE:

Spotware said:

Dear traders,

Unfortunately we were not able to reproduce the issue. Please provide us with the following information

  1. Symbol and timeframe of the specific instance
  2. Backtesting/Optimization dates
  3. Data source (Tick/m1 Bars/ Instance timeframe bars)

Best regards,

cTrader Team

  1. Symbol and timeframe of the specific instance: USDPLN, h1
  2. Backtesting/Optimization dates: 23/01/2021 to 12/04/2023
  3. Data source (Tick/m1 Bars/ Instance timeframe bars): m1 bars from Server ( open prices )

Additional info: I tried setting the instance symbol to the same symbol as for MarketData.GetBars and then backtesting worked fast, but any other symbol is slow.

 


@daniel.podrazka

daniel.podrazka
13 Apr 2023, 11:08 ( Updated at: 13 Apr 2023, 11:16 )

RE: RE: Same issue with MarketData.GetBars

whaaaaatever.ken said:

Spotware said:

Dear trader,

Can you please share with us your cBot code so that we can reproduce the behavior? Also please let us know which versions you are comparing.

Best regards,

cTrader Team

Thank you for your reply.
I have included the cbot code below with only the relevant code extracted.
Please try to optimize by varying Num from 0 to 100.
It will take a very long time.
It did not take as long as it did a month ago.

The version of Ctrader is 4.6.5.

 

//////////////////////////////////////////////

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.None)]
    public class NewcBot3 : Robot
    {
        [Parameter(DefaultValue = 0, MinValue = 0, MaxValue = 100, Step = 1)]
        public int Num { get; set; }

        protected override void OnStart()
        {
        }

        protected override void OnBar()
        {
            Print(Symbols.GetSymbol("CADJPY").Bid);
        }
    }
}

I have the same issue with MarketData.GetBars. My code is taking around 30 times longer to execute which is a huge problem for me. I tested it on two identical machines, one of them was running 4.5.9 and the other 4.6.6. The 4.6.6 was very slow. I updated the version on the other machine to test if this was causing the problem and it did. Right after update, backtesting slowed down. It worked fine on 4.5.9 but now I cannot downgrade to the old version anymore. Please, provide us with the 4.5.9 version until this issue is fixed.

Here's example code demonstrating the issue:

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.None)]
    public class NewcBot3 : Robot
    {
        [Parameter(DefaultValue = 0, MinValue = 0, MaxValue = 100, Step = 1)]
        public int Num { get; set; }
 private Bars _eurUsdBars;
        protected override void OnStart()
        {
          _eurUsdBars = MarketData.GetBars(TimeFrame, "EURUSD");
        }

        protected override void OnBar()
        {
        
               Print("test");
        }
    }
}


@daniel.podrazka