help coding Keltner band

Questions directed to our Support Team. Responses can be expected within 24 hours.

help coding Keltner band

Postby jawfiaa » Tue Jun 03, 2014 7:31 pm

I am adding Keltner band as one of the trading rules in my strategy. I wanted to code that lower Keltner band dropped 3%. And the calculation for keltner channel is:
Lower Channel Line: 20-day EMA - (2 x ATR(10)).
So I code it in SS this way: (mov(close, 20, Exponential)-(2.5*atr(20))) < (mov(close, 20, Exponential)-(2.5*atr(20)))*0.97
But SS is returning no results even with different numbers and variables and longer time periods. Am I doing something wrong here ?
jawfiaa
 
Posts: 7
Joined: Tue Jun 03, 2014 12:41 am

Re: help coding Keltner band

Postby Overload » Wed Jun 04, 2014 9:11 am

A value can't be less than itself. Or, in your specific case, a value can't be less than itself * 0.97. I think what you want to test is whether the Keltner Band can be less than yesterday's Keltner Band * 0.97. To do that, you'll need to use the ref() formula, which allows you to make an alternate day reference. Try this:

(mov(close, 20, Exponential)-(2.5*atr(20))) < ref(mov(close, 20, Exponential)-(2.5*atr(20)), -1)*0.97

Hopefully this helps.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: help coding Keltner band

Postby jawfiaa » Wed Jun 04, 2014 10:56 pm

Thank you Pete for the help! it did work
I should have captured this simple mistake but I just joined SS and still in the learning stage.
jawfiaa
 
Posts: 7
Joined: Tue Jun 03, 2014 12:41 am


Return to Technical Support

cron