Signal Noise Ratio

How do you know when a trend has started? Ended? This forum is for discussions about trend indicators and signals.
Post Reply
HWG
Roundtable Fellow
Roundtable Fellow
Posts: 84
Joined: Fri Jun 04, 2010 10:21 am
Location: Omaha, NE
Contact:

Signal Noise Ratio

Post 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.
Benson
Full Member
Full Member
Posts: 19
Joined: Sat Nov 14, 2015 1:44 am

Re: Signal Noise Ratio

Post 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
Roger Rines
Roundtable Knight
Roundtable Knight
Posts: 2038
Joined: Wed Oct 06, 2004 10:52 am
Location: San Marcos, CA

Re: Signal Noise Ratio

Post 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.
Benson
Full Member
Full Member
Posts: 19
Joined: Sat Nov 14, 2015 1:44 am

Re: Signal Noise Ratio

Post by Benson »

Thanks a bundle. The key issue was the elegance (or lack thereof) in my code.
Post Reply