StockFetcher Forums · Filter Exchange · Setting a stop loss based on 'Average True Range' (ATR)<< >>Post Follow-up
Caspian101
5 posts
msg #121391
Ignore Caspian101
8/25/2014 11:16:21 AM

If you're a regular trader, setting the right stop losses is very important to preserving the profitability of stocks. In this simple filter, I have used the 'Average True Range' (ATR) as a measure of a stock's volatility to set stop loss percentages.

You can just input your various stock tickers in the first line and run the filter; it will then suggest four percentage stops for your various stocks based on the ATR of each stock:

- Min (the actual ATR over your time period)
- Tight (the ATR times 1.5) - Good for short term swing trade protection
- Med (the ATR times 2) - Good for holding over the slightly longer term and giving the stock room to breathe
- Loose (the ATR times 2.5) - Good for holding stock for slightly longer

The code in the filter isn't especially elegant, so if you can make it more efficient, please feel free to do so. Hope this is helpful!

Fetcher[
symlist(TSLA, GOOG, AAPL, SPY) /*Enter your tickers here, separated by commas */

SET {SATR, AVERAGE TRUE RANGE(5)} /*You can adjust the ATR value away from 5 (days) according to your trading styte; this is set to 5 for shorter term, swing trades, you might want to set it to longer.*/
SET {CSP, close}
SET {MSL, CSP-SATR}
SET {MSLP1, MSL/CSP}
SET {MSLP2, 1 - MSLP1}
SET {MSLP3, MSLP2 * 100}
SET {SL_MIN, MSLP3} /*This is the actual volatility of the stock, based on ATR and closing price*/
SET {SL_TIGHT, MSLP3 * 1.5} /*This is setting a stop at one and a half times the ATR (Volatility)*/
SET {SL_MED, MSLP3 * 2} /*This is setting a stop at two times the ATR (Volatility)*/
SET {SL_LOOSE, MSLP3 * 2.5} /*This is setting a stop at two and a half times the ATR (Volatility)*/

ADD COLUMN SL_MIN /*Min Stop Loss in percent*/
ADD COLUMN SL_TIGHT /*Tight Stop Loss in percent*/
ADD COLUMN SL_MED /*Med Stop Loss in percent*/
ADD COLUMN SL_LOOSE /*Loose Stop Loss in percent*/
]



duke56468
683 posts
msg #121392
Ignore duke56468
8/25/2014 3:28:50 PM

Thanks for the useful filter Caspian.

StockFetcher Forums · Filter Exchange · Setting a stop loss based on 'Average True Range' (ATR)<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2016 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus