GetMarketSeries not loading enough data
GetMarketSeries not loading enough data
31 Oct 2017, 13:33
Dear Spotware,
please see following example:
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 Test : Indicator { private MarketSeries m3; private MarketSeries m15; private MarketSeries h1; protected override void Initialize() { // Initialize and create nested indicators m3 = MarketSeries; // Set Chart-TimeFrame to m3 ! m15 = MarketData.GetSeries(TimeFrame.Minute15); h1 = MarketData.GetSeries(TimeFrame.Hour); Print("First m3 OpenTime " + m3.OpenTime[0]); Print("First m15 OpenTime " + m15.OpenTime[0]); Print("First h1 OpenTime " + h1.OpenTime[0]); } public override void Calculate(int index) { // Calculate value at specified index // Result[index] = ... } } }
And here is the output.
Initial-output:
31/10/2017 11:20:11.796 First m3 OpenTime 25.10.2017 06:18:00
31/10/2017 11:20:11.796 First m15 OpenTime 25.06.2017 21:00:00
31/10/2017 11:20:11.796 First h1 OpenTime 26.05.2016 21:00:00
Output after scrolling in the chart to left (so more past data is loaded):
31/10/2017 11:22:34.514 First m3 OpenTime 14.06.2017 06:18:00 -> Changed, of course, because it is the Chart-TimeFrame
31/10/2017 11:22:34.514 First m15 OpenTime 25.06.2017 21:00:00 -> Did not change, but it should be loaded data also until something before or equal 14.06.2017 06:18:00, so there is NOT enough data loaded
31/10/2017 11:22:34.514 First h1 OpenTime 26.05.2016 21:00:00 -> Did not change, because it is still in past, so enough data
The same problem exists if using this in a bot, so if my backtesting date is from e.g. 01.01.2017 until 31.03.2017 m15 has also loaded data only until 25.06.2017 21:00:00.
By the way at first i thought there is something wrong with the downloaded data in roaming-dir (e.g. m15 is partly corrupt), but i cleaned / deleted everything and came up to the solution, that it simply does not load enough data.
Could you please help us / me with this challenge?
Thanks in advance.
andi21
Replies
PanagiotisCharalampous
06 Nov 2017, 17:18
Hi andi21,
We had a look at the issue. The reason that it behaves like this, ut is because MarketSeries for the selected symbol are updated on scrolling on the chart while other MarketSeries for other symbols are not. We will fix the issue in a future release of cAlgo where we will add a method to get series for a specified time span.
Best Regards,
Panagiotis
@PanagiotisCharalampous
andi21
06 Nov 2017, 17:57
Hi Panagiotis,
thank you for the answer.
MarketSeries for the selected symbol are updated on scrolling on the chart while other MarketSeries for other symbols are not
But in my example i am using only one symbol for all marketseries and the chart-symbol is also the same. So only one symbol is used over all.
Best Regards,
andi21
@andi21
PanagiotisCharalampous
06 Nov 2017, 18:07
Hi andi21,
Sorry I meant to say symbol and selected timeframe. So it actually updates only the market series displayed on the chart.
Best Regards,
Panagiotis
@PanagiotisCharalampous
andi21
31 Oct 2017, 13:48
I forgot to mention that if i am just showing / displaying a chart with the chart-timeframe set to m15, then there IS past data before 25.06.2017 21:00:00, so there IS past data available, but not loaded enough through .GetSeries().
@andi21