new Methods
new Methods
16 Dec 2013, 09:43
GetIndexByTime and GetindexbyExactTime are 2 new methods that I can't seem to find much information on? Nothing in the API reference not too many examples. How does it work? When should you use it?
Replies
lec0456
17 Dec 2013, 07:33
Ok, so in this post you use a function:
private int GetIndexByDate(MarketSeries series, DateTime time) { for (int i = series.Close.Count - 1; i > 0; i--) { if (time == series.OpenTime[i]) return i; } return -1; }
We don't need to use this function or multitime frames anymore? because its implemented as a method, correct?
@lec0456
Spotware
17 Dec 2013, 09:11
RE:
lec0456 said:
Ok, so in this post you use a function:
private int GetIndexByDate(MarketSeries series, DateTime time) { for (int i = series.Close.Count - 1; i > 0; i--) { if (time == series.OpenTime[i]) return i; } return -1; }We don't need to use this function or multitime frames anymore? because its implemented as a method, correct?
Yes that is correct.
@Spotware
Spotware
16 Dec 2013, 11:16
The "index" that is the parameter to the Calculate method, is the index of the series that the instance is attached to. The series of other timeframes / symbols have different indexes. So, to get the index of a specific series you would need to use a method such as GetIndexByTime and GetindexbyExactTime.
example:
The difference between the two is that GetIndexByTime returns the closest index to the open time, whereas the GetindexbyExactTime will only return an index if there is one at the exact time and will return -1 otherwise.
@Spotware