CT
Trying to get two market series in one window but they are shifted.
25 Jul 2016, 09:26
Trying to get two market series in one window but they are shifted.
Here is the code
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 OtherSeriesPlot : Indicator
{
[Parameter(DefaultValue = 50)]
public int Parameter { get; set; }
public int diff;
private MarketSeries series2;
public int number;
[Parameter(DefaultValue = "EURUSD")]
public string Symbol2 { get; set; }
[Output("Main")]
public IndicatorDataSeries Result { get; set; }
protected override void Initialize()
{
series2 = MarketData.GetSeries(symbol2, TimeFrame);
}
public override void Calculate(int index)
{
diff = MarketSeries.Close.Count - series2.Close.Count;
Result[index] = series2.Close[index - diff] / series2.Close[index - diff - Parameter] * MarketSeries.Close[index - Parameter];
}
}
}
Here is what it looks like (the US30 put over the NAS100)
What I want is for the two series to line up, how do I do this?

ctid225861
25 Jul 2016, 14:06
Forget what I just posted. I want to know how to get two series to have the dates and times in line. Here is a simpler version of the code I'm having difficulty with.
using System; using cAlgo.API; using cAlgo.API.Internals; using cAlgo.API.Indicators; using cAlgo.Indicators; namespace cAlgo { [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class OtherSeriesstudy : Indicator { private MarketSeries series2; private Symbol symbol2; [Parameter(DefaultValue = "EURUSD")] public string Symbol2 { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } public int diff; protected override void Initialize() { symbol2 = MarketData.GetSymbol(Symbol2); series2 = MarketData.GetSeries(symbol2, TimeFrame); } public override void Calculate(int index) { diff = MarketSeries.Close.Count - series2.Close.Count; Result[index] = series2.Close[index - diff]; } } }@ctid225861