Inconsistent History

Created at 13 Feb 2016, 19:30
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MZ

MZen

Joined 29.12.2014

Inconsistent History
13 Feb 2016, 19:30


Hi,

as a part of my project I use 1 min history to calculate indicator on all time frames.

So, I extract 1 min data during  initialization process.

I noticed, however very strange inconsistency in number of elements. As for today if I start indicator in 1 min chart it gives me 16325 elements. I switch to 2 min chart and get 9161 element, switch back to 1 min and got 2000 elements.

Below is a simple code to see it.

What is wrong with the code? Or  - with cAlgo?

Alex

----------------------------------------------------------------------------------------------------------------

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class InconsistentHistory : Indicator
    {
        [Parameter("Source")]
        public DataSeries Source { get; set; }

        public int indexSeries;


        private MarketSeries series1min;


//---------------------------------------------------------------------------------------------------------------
        protected override void Initialize()
        {

            series1min = MarketData.GetSeries(TimeFrame.Minute);
            indexSeries = series1min.High.Count - 1;
            int indexData = Source.Count - 1;


            Print(indexSeries + "   " + indexData);
        }
//---------------------------------------------------------------------------------------------------------------
        public override void Calculate(int index)
        {


        }

//---------------------------------------------------------------------------------------------------------------
    }

}


@MZen
Replies

MZen
15 Feb 2016, 18:13

RE:

It is interesting that in case when  number of historical values for 1 minute MarketSeries goes to 2000, Calculate got called with index starting from 0 to 2000, for every value.

Just add to Calculate

Print (indexSeries);

to see it yourself.

This is something I could not imagine would happened.


@MZen

MZen
16 Feb 2016, 17:34

RE: RE:

MZen said:

It is interesting that in case when  number of historical values for 1 minute MarketSeries goes to 2000, Calculate got called with index starting from 0 to 2000, for every value.

Just add to Calculate

Print (indexSeries);

to see it yourself.

This is something I could not imagine would happened.

Sorry, add next line to see dynamics

Print (series1min.High.Count);


@MZen

algoforce
16 Feb 2016, 18:21

calgo is broken, I found info here /forum/cbot-support/8088


@algoforce

Spotware
17 Feb 2016, 15:51

Dear Trader,

The GetSeries method retrieves around 10000 values.

By default the Source retrieves 2000 values. If a User scrolls back in the chart the source will retrieve more values.

We will provide users with the ability to set the amount of the values they would like to retrieve in the future. Stay tuned.

 


@Spotware

MZen
19 Feb 2016, 21:09

RE:

Spotware said:

Dear Trader,

The GetSeries method retrieves around 10000 values.

By default the Source retrieves 2000 values. If a User scrolls back in the chart the source will retrieve more values.

We will provide users with the ability to set the amount of the values they would like to retrieve in the future. Stay tuned.

 

Isn't it funny!? You call it cAlgo, which meant to be able to operate without human interaction. Instead USER NEED TO SCROLL THE CHART TO REVEAL MORE VALUES!!!!!!

 


@MZen