nested indicators freezing values
19 Jan 2015, 16:22
Hello!
I am experiencing a problem with an indicator value freezing on some past value and not updating... I am attaching the code and the screenshot... The indicator calculates the price ratio (spread coefficient) between two prices of two correlated symbols. I tried calculating it in two somewhat different ways, but the result is the same... Can anybody help with this freezing problem? Thanks in advance.
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 PriceSpreadRatio : Indicator {
[Parameter (DefaultValue = "GBPUSD")]
public string Symbol2 { get; set; }
[Output ("Result", Color = Colors.Green)]
public IndicatorDataSeries Result { get; set; }
private Symbol symbol2;
private MarketSeries series2;
protected override void Initialize () {
symbol2 = MarketData.GetSymbol (Symbol2);
series2 = MarketData.GetSeries (symbol2, TimeFrame);
}
public override void Calculate (int index) {
Result[index] = MarketSeries.Close[index] / series2.Close[index];
// this is another version of calculate, neither of them work
/*
var t = MarketSeries.OpenTime[index];
for (int i = series2.Close.Count - 1; i > 0; i--) {
if (t == series2.OpenTime[i]) {
Result[index] = MarketSeries.Close[index] / series2.Close[index];
}
}
//*/
}
}
}

Replies
Spotware
20 Jan 2015, 11:21
Hello igorkroitor,
For help with coding please contact one of our partners /consultants/ or post a job in Development Jobs section /jobs/
Cheers.
@Spotware

igorkroitor
19 Jan 2015, 16:47
Moderators, please delete this post, I've misplaced it, should be in the indicator development section...
@igorkroitor