MarketData.GetSeries show different info
MarketData.GetSeries show different info
07 Jun 2019, 01:43
Hello:
I have this indicator. when I initialize it in a eurusd graph it shows me a different result of if I do it in another, gpbusd for example. The result should be identical because de Symbol alway is XAUUSD, but it shows different information depending on the graph where you insert it
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Collections.Generic;
namespace cAlgo
{
[Indicator(TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)]
public class Incidencia : Indicator
{
[Output("Resultado", Color = Colors.Crimson, PlotType = PlotType.Line)]
public IndicatorDataSeries Resultado { get; set; }
private MarketSeries marketSeriesXAUUSD;
protected override void Initialize()
{
// Serie del XAUUSD
this.marketSeriesXAUUSD = MarketData.GetSeries(MarketData.GetSymbol("XAUUSD"), MarketSeries.TimeFrame);
Print("Inicializado ");
}
public override void Calculate(int index)
{
// Print(this.marketSeriesXAUUSD.SymbolCode);
Resultado[index] = this.marketSeriesXAUUSD.Close[index];
}
}
}
Replies
PanagiotisCharalampous
07 Jun 2019, 10:07
Hi enrikeyo,
Thanks for posting in our forum. The reason you get this behavior is because the indices do not match. Here is the correct way to do it.
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; using System.Collections.Generic; namespace cAlgo { [Indicator(TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)] public class Incidencia : Indicator { [Output("Resultado", Color = Colors.Crimson, PlotType = PlotType.Line)] public IndicatorDataSeries Resultado { get; set; } private MarketSeries marketSeriesXAUUSD; protected override void Initialize() { // Serie del XAUUSD this.marketSeriesXAUUSD = MarketData.GetSeries(MarketData.GetSymbol("XAUUSD"), MarketSeries.TimeFrame); Print("Inicializado "); } public override void Calculate(int index) { // Print(this.marketSeriesXAUUSD.SymbolCode); Resultado[index] = this.marketSeriesXAUUSD.Close[marketSeriesXAUUSD.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index])]; } } }
Best Regards,
Panagiotis
@PanagiotisCharalampous
enrikeyo
07 Jun 2019, 12:31
RE:
Panagiotis Charalampous said:
Hi enrikeyo,
Thanks for posting in our forum. The reason you get this behavior is because the indices do not match. Here is the correct way to do it.
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; using System.Collections.Generic; namespace cAlgo { [Indicator(TimeZone = TimeZones.UTC, AutoRescale = false, AccessRights = AccessRights.None)] public class Incidencia : Indicator { [Output("Resultado", Color = Colors.Crimson, PlotType = PlotType.Line)] public IndicatorDataSeries Resultado { get; set; } private MarketSeries marketSeriesXAUUSD; protected override void Initialize() { // Serie del XAUUSD this.marketSeriesXAUUSD = MarketData.GetSeries(MarketData.GetSymbol("XAUUSD"), MarketSeries.TimeFrame); Print("Inicializado "); } public override void Calculate(int index) { // Print(this.marketSeriesXAUUSD.SymbolCode); Resultado[index] = this.marketSeriesXAUUSD.Close[marketSeriesXAUUSD.OpenTime.GetIndexByTime(MarketSeries.OpenTime[index])]; } } }Best Regards,
Panagiotis
Thank you, very much
@enrikeyo
guillermo
07 Jun 2019, 02:11 ( Updated at: 21 Dec 2023, 09:21 )
To illustrate further this issue, in the image bellow I have loaded the indicator in four H4 charts
of EURUSD, USDCAD, XAUUSD and AUDJPY. The line is different in all four charts, and only the one of XAUUSD is correct.
Please let us know if we are doing anything wrong in the use of MarketData.GetSeries or instead this is a bug that can be fixed in due course.
Thanks a lot,
Guillermo
@guillermo