|
Dave W.
2015-01-09 13:07:21
|
|
Hi. As I was trying to figure out why the Trend Strength Index indicator was not working for me, I noticed this line in the function:
result = cFunctions.CompileFormula("tsi = sma(sma(Absolute(close - ref(close, -10) / atr(10)),10), 100);").GetVectorDouble("tsi");
If I'm reading this right, the "ref(close, -10)" refers to the future, true? If so, I think this is an error, correct?
-----------------------------------------------------
I'm recoding the Trend Strength Index using the TA library functions. Does this look right to you? If so, I'll post it to the sharing server.
cFunctions.SetForwardAndBackwardBars(int.MaxValue, 0);
VectorD Ratio = 0; // Initialize the variable
VectorD TrendStrengthIndex = 0; // Initialized the variable
VectorD close = cFunctions.Close;
Ratio = TA.Absolute( (close - TA.Ref(close, ShortLookback) ) ) / TA.Atr( ShortLookback );
TrendStrengthIndex = TA.Avg( TA.Avg(Ratio,ShortLookback), LongLookback);
result = TrendStrengthIndex;
|
|