Page 1 of 1

Signal Noise Ratio

Posted: Mon Jun 01, 2015 9:40 pm
by HWG
I'm attempting to code up a Signal Noise Ratio as seen in Trend Following with Managed Futures by Greyserman and Kaminski

The formula is essentially:

Abs((Price(t) - Price(n)) / Sum of Abs(Price(t-k) - Price (t-k-1)

An example if N = 100 I'm looking at the $ price change from today vs 100 days ago divided by the sum of all the absolute price changes for the same period.

I made an indicator with a parameter of lookbackdays for N then have two indicators

AbsPriceChange:

AbsoluteValue(instrument.close-instrument.close[1])

SNR

AbsoluteValue(instrument.close-instrument.close[lookbackdays])/sum(AbsPriceChanges,lookbackdays)

However, if I added to graph and ran a system with it in there I get the following error:

While evaluating the calculated indicator SNRindicator, there was a problem: element count for array is greater than the starting offset.

I'm not really sure what that means. Any thoughts/help? Thanks.

Re: Signal Noise Ratio

Posted: Sun Dec 20, 2015 4:48 pm
by Benson
How did you go with this? I'm getting a divide by zero error when calculating the indicator (I assume due to an instance of zero price movement over the lookback period for an instrument).

I coded in :

IF absoluteValue(instrument.close-instrument.close[atrLookBackNoise]) =0 then
noisePriceMovement = -1
else
noisePriceMovement = absoluteValue(instrument.close-instrument.close[atrLookBackNoise])

noisePriceMovement obviously being the denominator of the indicator expression.

But it is still giving me the error

Re: Signal Noise Ratio

Posted: Sun Dec 20, 2015 11:15 pm
by Roger Rines
A few years back, the following Blox was added to Blox Marketplace section:
Kaufman's Adaptive Moving Average

It contains the Perry Kaufman's KAMA Indicator. At the heart of his indicator is a noise calculation he uses to make his KAMA indicator adjust the period length of his average calculation. His indicator seems to be the same as what is posted in this thread.

Blox has a lot of comments. If you find something causes a problem look in the TBB Help file to see if any of the names have changed. If that doesn't work, post your issue and I'll take a look.

Re: Signal Noise Ratio

Posted: Mon Dec 21, 2015 4:54 am
by Benson
Thanks a bundle. The key issue was the elegance (or lack thereof) in my code.