Topics
06 Jul 2024, 04:39
 154
 0
03 Jul 2024, 12:59
 233
 2
Replies

kenneyyfx
06 Jul 2024, 01:19

Spotware

Error | Failed to get symbol 'BTCUSD' quotes: Symbol BTCUSD has no quotes at 01/01/2020 00:00:00

This error has been the cause of my headache for the past couple of days. 

I am using cTrader Desktop 5.0.25 and the error shows up at the start of backtesting with visual mode ticked (thats how i get to see the error) when visual mode is turned off the error does not show up.

This error (in both visual & non visual backtesting modes) causes my bot not to place valid trades

I am backtesting BTCUSD M5 from 01/01/2020 - 05/07/2024 using m1 bars from server (open prices)

See below

Please help, this is very urgent and a huge show stopper !!!


@kenneyyfx

kenneyyfx
04 Jul 2024, 12:45 ( Updated at: 04 Jul 2024, 12:57 )

RE: RSI indicator faulty

PanagiotisCharalampous said: 

Hi there,

I have printed the RSI values and the values are there. So probably the problem is with your logic.

Best regards,

Panagiotis

Hi and thanks for getting back to me.  

YOU ARE RIGHT - MY LOGIC !!!    - i spend too many hours a day coding, that i couldnt even see what was right in front of me. Thank you so much!!! 


@kenneyyfx

kenneyyfx
03 Jul 2024, 14:49

What cTrader broker are you with?

Please tell us the cTrader broker that's doing this to you and whether this issue occured in cTrader cloud?


@kenneyyfx

kenneyyfx
03 Jul 2024, 13:16

RE: Ctrader Saved Optimisation Result

PanagiotisCharalampous said: 

Hi there,

Can you provide more information? What happens when you try to open the file? Can you share the file with us?

Best regards,

Panagiotis

Also, if you open the .optres file from the optimiser of a cbot that was NOT used to create the file originally, it loads the results but deletes the file thereafter. Please fix this (i.e. the file should not be deleted)


@kenneyyfx

kenneyyfx
13 Apr 2022, 19:59 ( Updated at: 14 Apr 2022, 18:26 )

RE:

amusleh said:

Hi,

As I said on my previous post you can't load data earlier than your back test start time, the only way to load data is to change your back test start time and it doesn't matter if it's a week or 6 months.

Here is an example that might help you:

using cAlgo.API;
using System;
using System.Globalization;

namespace NewcBot
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        private const string Time_FORMAT = "dd/MM/yyyy HH:mm:ss";

        private DateTime _startTime;

        [Parameter("Start Time", DefaultValue = Time_FORMAT)]
        public string StartTime { get; set; }

        protected override void OnStart()
        {
            if (!DateTime.TryParseExact(StartTime, Time_FORMAT, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out _startTime))
            {
                Print("Invalid start time");

                Stop();
            }

            LoadBarsData(TimeFrame.Hour);
            LoadBarsData(TimeFrame.Minute30);
            LoadBarsData(TimeFrame.Minute15);
            LoadBarsData(TimeFrame.Minute5);
        }

        protected override void OnTick()
        {
            if (Server.TimeInUtc < _startTime)
            {
                // Do your calculation here and continue

                return;
            }

            // Here do your trading
        }

        protected override void OnBar()
        {
            if (Server.TimeInUtc < _startTime)
            {
                // Do your calculation here and continue

                return;
            }

            // Here do your trading
        }

        private void LoadBarsData(TimeFrame timeFrame)
        {
            var bars = MarketData.GetBars(timeFrame);

            while (bars.LoadMoreHistory() > 0)
            {
            }

            Print("First Bar Open Time: {0:dd/MM/yyyy HH:mm:ss} | TimeFrame: {1}", bars[0].OpenTime, timeFrame);
        }
    }
}

You can change your back test start time to an earlier date for loading more data and use cBot start time parameter to skip trading before a specific date.

Hello,

This is what you wrote

"As I said on my previous post you can't load data earlier than your back test start time" ... 

I am NOT trying to load data earlier than my backtest start-time. I dont care about earlier data.  You keep deviating from the actual topic.

My Backtest date range is from 01/10/2021 - 12/04/2022.  MarketData.GetBars() returns data outside of this range. That's the issue here. This is wrong!!! There is a bug in your system

I only need the amount of data relative to my backtest session date range. I am not getting those bars in code.


@kenneyyfx

kenneyyfx
13 Apr 2022, 15:08 ( Updated at: 14 Apr 2022, 18:26 )

RE:

amusleh said:

Hi,

I followed your discussion with Panagiotis on Telegram, the issue is with your misunderstanding of how cTrader backtester works.

When you load another time frame, symbol, or current time frame bars data cTrader uses the back tester start date as the farthest point in time that it will load the data.

So for example, if you start a back test and set the start/end time to 01/01/2020 and 01/01/2022, and try to load more bars data of current symbol time frame or any other bars, the amount of data that you will be able to load is limited to your backtest session start/end time range, even if the data is available cTrader will not load the data before your back test start time or after it's end time, because cTrader thinks you need only the amount of data relative to your backtest session start/end time and this is true for most cases.

If you want to load more historical data then change your back test session start time.

For example, lets back test this cBot:

using cAlgo.API;

namespace NewcBot
{
    [Robot(AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        protected override void OnStart()
        {
            LoadBarsData(TimeFrame.Hour);
            LoadBarsData(TimeFrame.Minute30);
            LoadBarsData(TimeFrame.Minute15);
            LoadBarsData(TimeFrame.Minute5);
        }
        
        private void LoadBarsData(TimeFrame timeFrame)
        {
            var bars = MarketData.GetBars(timeFrame);
            
            while (bars.LoadMoreHistory() > 0)
            {
            }

            Print("First Bar Open Time: {0:dd/MM/yyyy HH:mm:ss} | TimeFrame: {1}", bars[0].OpenTime, timeFrame);
        }
    }
}

Set the start and time to: 19/11/2021 and 12/04/2022

Check the logs tab what it prints for each time frame.

Then move the start time few months back, and backtest it again, and check the cBot logs tab.

The only way you can load more data is to change the start time of back test based on amount of data you want to load.

Now if you are saying I just want to use the data for some calculation and not for trading, then you can skip the time you don't want to trade by checking the Server.Time.

Hello,

Thank you for your response. I'm afraid it does not help.

All i want to do is run a backtest based on data for the LAST 6 MONTHS.

MarketData.GetBars() omits the last 6months

How would you go about getting data for the last 6months (i.e. from yesterday to 1st of October 2021)? 

I have a strong feeling there is a bug in the application - the bars fetched for the backtest (via MarketData.GetBars()) do not coincide with those on the chart. There is a disconnect somewhere.   

We are no longer talking about Bars.LoadMoreHistory(). We are talking about INCLUDING bars for the last 6months in our backtest. This is where the error lies


@kenneyyfx

kenneyyfx
12 Apr 2022, 21:21 ( Updated at: 14 Apr 2022, 18:26 )

RE: RE:

kenneyyfx said:

amusleh said:

Hi,

If Bars LoadMoreHisotry method is returning missing data then please tell me which broker you are using? and which symbol and time frame has this issue.

 

Hello,

Now you understand what i am talking about.

Broker : FxPro

Asset : XAUUSD

Timeframe : M5 But i call Bars.LoadHistory() on ALL timeframes and not 1 returns this years data. 

If the broker is able to do this using the cTrader platform then it means Spotware facilitated this. This is naughty!

Hello, 

This is my code that should return data including those for the last 6 months - but tends to return data of which the last 6months has been gutted out. Hmm

Pease let me now your thoughts.

Regards

Kenneth

var barSet = new List<Bars>();

List<TimeFrame> lotf = new List<TimeFrame>
{
        TimeFrame.Monthly, TimeFrame.Weekly, TimeFrame.Day3, TimeFrame.Day2, TimeFrame.Daily, TimeFrame.Hour12, TimeFrame.Hour8,
        TimeFrame.Hour6, TimeFrame.Hour4, TimeFrame.Hour3, TimeFrame.Hour2, TimeFrame.Hour, TimeFrame.Minute45, TimeFrame.Minute30,
        TimeFrame.Minute20, TimeFrame.Minute15, TimeFrame.Minute10, TimeFrame.Minute5,
};

RefreshData();

for (int i= 0; i < lotf.Count; i++)
{
        var tmpBars = MarketData.GetBars(lotf[i]);

        barSet.Add(tmpBars);

        Print(tmpBars.TimeFrame.ShortName.ToUpper(), " ", tmpBars.Count, " bars - starting from ", tmpBars.First().OpenTime.ToShortDateString() , " - ", tmpBars.Last().OpenTime.ToShortDateString());
}
 


@kenneyyfx

kenneyyfx
12 Apr 2022, 19:11 ( Updated at: 14 Apr 2022, 18:26 )

RE:

amusleh said:

Hi,

If Bars LoadMoreHisotry method is returning missing data then please tell me which broker you are using? and which symbol and time frame has this issue.

 

Hello,

Now you understand what i am talking about.

Broker : FxPro

Asset : XAUUSD

Timeframe : M5 But i call Bars.LoadHistory() on ALL timeframes and not 1 returns this years data. 

If the broker is able to do this using the cTrader platform then it means Spotware facilitated this. This is naughty!


@kenneyyfx

kenneyyfx
12 Apr 2022, 11:45 ( Updated at: 14 Apr 2022, 18:26 )

RE:

amusleh said:

Hi,

The amount of historical data that is available for a symbol depends on when your broker started using cTrader, this same data is also used in your broker cTrader back tester.

If there is not enough historical data available for your broker then you can switch to another older cTrader broker.

Usually most symbols has at least a year or two historical data for most brokers.

There is no reason for Spotware or your broker to impose limitations on amount of historical data that is available for your indicators or cBots.

A symbol price OHLC or tick data is generated when traders trade that symbol on that broker, cTrader uses each bid tick to generate trend bar or OHLC data, so for the time that your broker was not using cTrader how can it provide historical price data? because there was no data at all.

The longer your broker was using cTrader the more historical data it will have for symbols.

You can try different cTrader brokers demo accounts to check which broker has the longest historical data, it differs for each broker.

It's not related at all to being ECN or not.

Thanks for getting back to me but all what you said has no bearing on Bars.LoadMoreHistory() not returning the most recent data i.e. from now to the last 6 months.

All that data has been gutted out. Bars.LoadMoreHistory() is returning LAST YEARS DATA and not this years data. That's the issue here


@kenneyyfx

kenneyyfx
11 Apr 2022, 21:34 ( Updated at: 14 Apr 2022, 18:26 )

RE:

amusleh said:

Hi,

You can load as much data as available for a symbol from your broker by using Bars.LoadMoreHistory, if it doesn't load more data then it means you have already loaded all available data for the symbol time frame.

Here is an indicator example that loads all available data for a symbol:

using cAlgo.API;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewIndicator : Indicator
    {
        protected override void Initialize()
        {
            // If new bars loaded indicator will be
            // re-initialized otherwise LoadMoreHistory will
            // return 0 and the loop will be stopped.
            // For cBots loading more data will
            // not reload the running cBot instance
            while (Bars.LoadMoreHistory() > 0)
            {
            }

            Print("First Bar Open Time: {0:dd/MM/yyyy HH:mm:ss}", Bars[0].OpenTime);
        }

        public override void Calculate(int index)
        {
        }
    }
}

Result:

11/04/2022 13:01:25.493 | First Bar Open Time: 01/10/2010 00:00:00

 

Thanks for getting back to me. Reading between the lines from your response - you are saying, the brokers (or Spotware) deliberately refuse to supply Bar history data for the last 6 months because cBots would win too much money ??

Bars.LoadMoreHistory() does not return data within the last 6months - only data that has gone stale.

So Spotware is pandering to their paymasters (the Brokers) by deliberately feeding cBots stale data so their bots would lose money (once gone live) resulting in their paymasters making money.

I thought this platform is an ECN platform??? 


@kenneyyfx

kenneyyfx
11 Apr 2022, 15:31 ( Updated at: 14 Apr 2022, 18:26 )

Spotware.  Bars.LoadMoreHistory()  does not return bars later than 30/09/2021 - This is bad!!!

Can you provide sample code on how to get data for a specific date range?

Thanks

 

 


@kenneyyfx