Replies

trentgale
08 Feb 2020, 06:07 ( Updated at: 21 Dec 2023, 09:21 )

I'm getting the same issue, this used to work in 3.6 optimisation (without the Bars interface and related code), but now doesn't work at all with either.

I have added in the obsolete MarketSeries as reference to what used to work.

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

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class testing : Robot
    {
        protected override void OnStart()
        {
            TryGetBars();
            TryGetSeries();
        }

        public void TryGetBars()
        {
            try
            {
                Bars barsMinute = MarketData.GetBars(TimeFrame.Minute);
                Print("barsMinute.Count: {0}", barsMinute.OpenPrices.Count.ToString());
            } catch (Exception ex)
            {
                Print(ex);
            }
        }

        public void TryGetSeries()
        {
            try
            {
                MarketSeries seriesMinute = MarketData.GetSeries(TimeFrame.Minute);
                Print("seriesMinute.Count: {0}", seriesMinute.Open.Count.ToString());
            } catch (Exception ex)
            {
                Print(ex);
            }
        }
    }
}

If I run any other timeframe apart from m1 in optimisation I get the following log:

But in RealTime or backtesting:

 

As you can see, I am not referencing another symbol, nor was the OP.

Regards,

Trent


@trentgale