ATR Modified
Author: sabino
Creation Date: 10/11/2009 9:08 PM
profile picture

sabino

#1
Would like the modified ATR upper limit to continue on after the lower ATR limit has created a stop out. The upper limit should create a buy (after a sell has occurred in the lower limit) and when prices turn around and rise above it - then the lower should kick in and start the cycle over again. Other problem have noted is that the upper limit goes off scale once price rises to a certain level (any suggestion - see BBBY for off scale example). Expected the upper limit to mirror the lower but for some stocks it seems to not follow the general path of the lower ATR.
CODE:
Please log in to see this code.

profile picture

Cone

#2
Is the idea to create a stop and reverse strategy? Long only? (If so, you can pretty much remove all the code (75%) that was written to support a single discretionary position for the TASC article.)

What are the rules, specifically?
profile picture

sabino

#3
The original TASC ATR code(see page 11 at:http://www.kirkreport.com/09/ATR.pdf which was taken from www.traders.com) created an ATR line that followed only below prices and the code executed a Stop out if that lower ATR was violated; a slight modification of that code reflected above, put a 2nd ATR line "above" the price bars. Would like to get back in with a buy stop if, after having been stopped out, the ATR line that is "above" the price bars continued to follow prices "down" and at some point was broken to the upside. Problematic since both the upper and the lower ATR lines end (with the code depicted) once the lower ATR line is broken. Not a programmer so just trying to use the strategies that are already available at (TASC) to best advantage, but might be trying to do something that would require a completely new code. Stop and reverse is correct except reverse and get back in only when prices turn around and cross the ATR that is now above the declining prices.
profile picture

Cone

#4
You just need to create the "atr bands" and use them for your buy and sell signals. Hopefully this is what you're looking for. If you want to use a market order exit based on the closing price crossing the stop price, then we'll need to do a small modification.

CODE:
Please log in to see this code.
profile picture

sabino

#5
Thank you - just what I was trying to achieve; seem to yield more profitable results by moving the bands a little further from price as per the following:[CODE] DataSeries upper = Close + 1.19*( _upperFactor.Value * atrMod );
DataSeries lower = Close - 4.5*( _lowerFactor.Value * atrMod );[CODE]
profile picture

Cone

#6
Why would you enter a constant multiplier like that when you can just adjust the Strategy Parameters?
profile picture

sabino

#7
I tried adjusting the Strategy Parameters and could come up with none that would move the ATR uppper and lower lines away from prices bars to the degree that was possible using multiplicative constants from the 10/18 post above.(If the upper and lower ATR lines are too close to price then the ATR strategy seldom beats a simple buy and hold strategy and frequently does much worse.)See daily charts of GT,DRYS,CPKI,CLMT and CI where the multiplicative factor approach beats the buy and hold by a fair amount. If you can suggest some values for the Strategy Parameters that will move the ATR lines an equivalent distance would be happy to use them.
profile picture

Cone

#8
QUOTE:
could come up with none that would move the ATR uppper and lower lines away from prices bars to the degree that was possible

That's because of the range that I put in the code. You can change the range in the code or even click on the parameter's link to enter any value you want.

QUOTE:
If you can suggest some values for the Strategy Parameters that will move the ATR lines an equivalent distance
If you want to find the best values, open up the range and perform an Optimization!


Please see the User Guide!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).