- ago
Can't find the documentation on IndicatorBase.CalculatePartialValue
0
118
Solved
2 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.05% )
- ago
#1
You're right, we will need to document that method at some point, thanks for mentioning it.
0
Glitch8
 ( 12.05% )
- ago
#2
A summary, it's meant to calculate a partial update for streaming charts, that's the only place it's called. And we've only implemented it so far in 3 indicators, RSI, SMA and MFI. You assign the calculated value to the "StreamingValue" property.

Here is a reference implementation used in SMA:

CODE:
//calculate partial value public override bool CalculatePartialValue() { StreamingValue = Double.NaN; TimeSeries source = Parameters[0].AsTimeSeries; if (Double.IsNaN(source.StreamingValue)) return false; Int32 period = Parameters[1].AsInt; if (period >= source.Count) return false; double sum = 0; for (int n = 0; n < period - 1; n++) { var i = source.Count - 1 - n; sum += source[i]; } sum += source.StreamingValue; StreamingValue = sum / period; return true; }
0
Best Answer

Reply

Bookmark

Sort