Price Deviates From Average Price By Using ATR (Amibroker And Tradestation Code)
The strategy in plain English:
Buy when the close is below a moving average deducted from the Average True Range, and sell when the opposite is true. Buy and sell at the close the day of the signal.
- Calculate a ten-day moving average.
- Deduct the ten-day ATR multiplied by 1.5.
- If the close is below the price level in number 2, then buy at the close.
- Sell at the close when the opposite signal is generated.
Click here to see the original article. We tested on the S&P 500.
Amibroker code:
Buy = C < MA(C,10) – (ATR(10)*1.5);
buyPrice = Close;
Sell = C>MA(C,10) + (ATR(10)*1.5);
sellPrice = Close ;
Tradestation code:
If c < ( average((Close),10) – (1.5*(AvgTrueRange( 10 ))) )
then buy this bar at c;
If c > ( average((Close),10) + (1.5*(AvgTrueRange( 10 ))) )
then Sell this bar at c;
Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.
