Average True Range (ATR)
Stochastic ATR IIStochastic ATR(Higher timeframe)
- stochastic of macd of ATR.
- stochastic rsi of ATR
atr_channelThe original bollinger bands have a fixed deviation of 2%, this channel calculates the ATR % (Atr Percentage) and places the upper and lower bands
Up-Down RangeHere is an attempt to segregate ATR into ATR of up days and down days.
While setting trailing stops based on ATR, you probably need to consider more on how an instrument can drop during red days. Hence, ATR of only red days makes more compelling case than overall ATR. Another use case for this kind of indicator may be in options if you are selling puts and calls with the intent of pocketing premiums on expiry.
Parameters are as explained below:
Range Type : Different range types are tr (True Range) , close (difference between close prices), highlow (difference between high and low of candle)
Period : ATR Period
Moving Average Type : Moving Average Type for calculating ATR. Two additional types - min and max are added which calculates lowest and highest range in last n bars
HideFullAtr : Hides combined ATR if checked.
ATR+(Experimental)
I often use the ATR as a volatility filter, to get better entries or to just get a quick understand of the volatility when screening different stocks.
With this indicator you can use the ATR in a few different ways:
-- Dynamic ATR --
To get more comparability between stocks I use a dynamic/normalized ATR, so I've experimented with two different methods.
ATR% can be calculated using John Forman’s approach called Normalized ATR (ATR / Close * 100). Or it can be calculated using what I call "Non Forman",
where the normalization happens to the true range and not to the average true range (average of (TR / Close * 100)). I think this method is "cleaner",
though the difference between the two is minimal. For more on this see www.macroption.com
You can chose between normal ATR (not normalized), Forman's normazation method, and "Non-Forman" normalization.
-- Smoothed ATR --
I originally used an ATR on a higher timeframe to get an idea of the overall volatility. But with higher time frames you always end up lag (or repainting
issues when combining into an indicator). So I expertimented on smoothing the true range, by including several bars into the calculation. I most trade
on a daily time frame so to my default "smoothing" is calculating the true range based on the last 5 days. This pretty much equals how the weekly TR
would be calculated, but since it updates daily we get a different result.
You can chose between displaying the standard ATR, the smoothed ATR or both.
-- Thresholds --
To make it more clear and visually more appealing I added thresholds and I'm plotting warning zones for low volatily.
-- Moving Average Method --
I think the best results from ATR comes when using RMA. But since I wanted to experiment with different options, the moving averages can be done using
RMA, SMA, EMA, Hull MA, or WMA.
MA Candles - SupertrendConverting strategy to indicator for those who want to use it as indicator.
Concepts are simple :
Calculate moving average of High, Low, Open and Close and make candles of them
Calculate ATR and derive supertrend on the moving average candles.
Alerts :
Bullish Crossover - When supertrend turns green
Bearish Crossover - When supertrend turns red
Bullish Pullback - Supertrend is green but close crossed below Moving average high
Bearish Pullback - Supertrend is red but close crossed above Moving average low
Original strategy is present here:
ATRangerATRanger uses Average True Range plus a variety of Moving Averages of the ATR in band format.
This is another way to identify overbought and oversold (poking out of the bands, or bouncing from them as support or resistance.)
A variety of Time-Frames can be selected, as well as several Moving Average Types to draw the bands with. (SMA, WMA, VWMA, SMMA, HMA, EMA)
Open Source
ATR Without OutliersIt is an ATR indicator which filters out outliers.
Outliers are values which are higher than the standard deviation of the true range.
It may be better than normal ATR for stop loss, because it does not keep large values after pump or dump.
It is very useful for high volatile markets like crypto markets.
ACD - Layers 1 & 2An implementation of layers 1 & 2 of ACD strategy of Mark Fisher, based on the book "The Logical Trader".
This implementation contains:
- OR lines
- A lines
- C lines
- Daily pivot range
- N days pivot range
- Customizable trading session
Strategy summary (This implementation):
There is 3 main concepts, each of which represented as two price levels.
1) OR (Opening Range) is the range of the first bar of the day. In other words, it's just "high - low" of the first resolution (usually 15min.) bar of the day. So, OR lines (Aqua color) visualize this range for each trading session.
As stated by Mark Fisher in his book, this range is meant to be a statistically significant range such that when price breaks the range in one direction, This is UNUSUAL to infiltrate it again AND break through the other side. So we can consider it as a potential enter signal (long or short).
2) A lines (Blue color) are drawn above and below OR lines with difference of 10% 0f 10 days ATR. The ATR period and the A multiplier (usually 10%) is customizable.
3) C lines (Gray color) are drawn above and below OR lines at 15% of 10 Days ATR difference. These lines help detecting AND confirming that UNUSUAL situation.
These concepts form the layer 1, which you can spot potential opportunities with it.
There is also two ranges to show support and resistance levels based on price action of previous days. Pivot ranges are rolling ranges that calculated and last for each day separately. They only differ in calculation period - the first one is daily (yellow color area) and the other one (red color area) is customizable, but is usually 3 or 5 days.
Each range consists of two price levels, valid for the current trading session. One of theme is HL2 , and the other one is "HLC3 + abs(HLC3 - HL2 )".
These two ranges, "Daily pivot range" and "N days pivot range", form the layer 2, which you can see them as two dynamic support/resistance ranges - one for daily, and the other for N days. They help filtering opportunities spotted from layer 1.
There is 2 more layers in the ACD strategy, which is omitted in this free implementation.
Arnaud Legoux Moving Average With ATR BandsArnaud Legoux Moving Average With ATR Bands to get an idea of the volatility.
Tiger's Stop - Objective Stoploss SettingTrading is a lot about risk management too. I created this script to help with setting and moving a proper stop-loss. It plots an area that is a result of adding and subtracting both average true range and something I call "false range".
►The Average True Range is calculated as the candle's high-low. If there is a gap, it is added to complete the result.
►My own False Range just candle bodies. It is calculated as an absolute value of (close-open).
Then, Rolling Moving Average is applied on both ATR and False Range to get an idea of how far the price tends to extend out of pure randomness. The resulting value is multiplied by a Multiplier.
The next step is an addition of the values to the higher part of the candle for short or a lower part of the candle for long. I prefer a special calculation instead of using Highs and Lows because it allows for more precise observation and stop-loss set up for less wicky symbols.
►►►Additional Functions
• Smoothing - applies moving average to candles from which range distance is calculated. This can achieve good smoothness but higher values will lead to using outdated price in the SL area calculation.
• Enable/Disable - if you know the direction you are going to trade in, it is good to disable either Long Stop-Loss Area or Short Stop-Loss Area. Just untick it in the settings.
►►►Actual Using
Before using the script to set your stop-loss, check the historical data and find a similar set-up. Is it engulfing you use as a trigger? Find a different one and see how effective the stop-loss based on the ATR*multiplier was. This will help you to optimize Multiplier value. A picture shows such research for a double top. You should find more similar situations to find an optimal value.
Ultimately, the indicator still gives you relatively a lot of freedom with your stop-loss settings (at least, that is with the default settings). You need to decide how loose stop-loss you want to set. Average True Range is the furthermost part which will make for a very large stop-loss, on the other hand, False Range might be triggered by a villainous wick unnecessarily. The choice should depend on the specific symbol you trade and perhaps, you will learn to set stops regardless of the indicator.
A little trick : 1. You can set the loosest stop-loss and set a TradingView alert for where the tightest stop-loss would be. When alerted, you will get the opportunity to reconsider the trade and take a loss if needs be or exit if a candle closes there. 2. Mostly for cryptocurrencies, you can set the tightest stop-loss to protect yourself from sudden spikes. If the price approaches it slowly enough, you can move the stop-loss to the further part of the channel. This is not the same as moving stop-loss indefinitely with hopes of reversal if you plan it from the beginning and a smaller stop is meant to protect you from spikes that are not always predictable and drive to both directions.
►►►Advantages of trailing stop-loss
I usually stick with my original stop-loss instead of moving to break even. If my entry area was functional support once, it may work again and is, therefore, still a good entry zone. But an alternative used to preserve as much of the profit as possible is trailing.
Trailing is setting a specific value in ticks or a calculation of how to move the stop-loss whenever the price moves in your favor. Tiger's Stop can be used this way. Whenever there is a new value as the candle closes and that value is closer to price than your current stop-loss, you can update it. However, if it moves further from your price, don't change the stop-loss. This can be a little tiresome if you do it manually but should be worth the effort.
I usually start trailing only after the price moves significantly in my favor that allowing it to return to the entry price would not make any sense.
►►►Feedback and optimization
The preview chart is chosen entirely at random and the values are not optimized for any specific symbol. If you opt to use it, let me know which values work for you the best, I'll add it to the description when I update it.
Furthermore, let me know if you think any sort of alerts would be useful with my script.
Good luck!
ATR-warningLarge candles are not always a suitable place to trade, or it could be the perfect place to trade.
This script plots a small rectangle at the top of the chart when a candle is larger than the specified ATR.
KAMA Strategy - Kaufman's Adaptive Moving AverageThis strategy combines Kaufman's Adaptive Moving Average for entry with optional KAMA, PSAR, and Trailing ATR stops for exits.
Kaufman's Adaptive Moving Average is, in my opinion, a gem among the plethora of indicators. It is underrated considering it offers a solution that intuitively makes a lot of sense. When I first read about it, it was a real 'aha!' moment. Look at the top, pink line. Notice how during trending times it follows the trend quickly and closely, but during choppy, non-trending periods, the KAMA stays absolutely flat? Interesting! To trade with it, we simply follow the direction the KAMA is pointing. Is it up? Go long. Is it down? Go short. Is it flat? Hold on.
How does it manage to quickly follow real trends like a fast EMA but ignore choppy conditions that would whipsaw a fast EMA back and forth? It analyses whether recent price moves are significant relative to recent noise and then adapts the length of the EMA window accordingly. If price movement is big compared to the recent noise, the EMA window gets smaller. If price movement is relatively small or average compared to the recent noise, the EMA window gets bigger. In practice it means:
The KAMA would be flat if a 20 point upwards move occurred during a period that has had, on average, regular 20 point moves BUT
the KAMA would point up if a 20 point move occurred during a period that has, on average, had moves of only around 5 points.
In other words, it's a slow EMA during choppy flat / quiet flat periods, and a fast EMA as soon as significant volatility occurs. Perfect!
-----
The Strategy
The strategy is more than just a KAMA indicator. It contains:
KAMA exit (optional)
ATR trailing stop loss exit (optional)
PSAR stop loss exit (optional)
KAMA filter for entry and exits
All features are adjustable in the strategy settings
The Technical Details:
Check out the strategy's 'Inputs' panel. The buy and sell signals are based on the 'KAMA 1' there.
KAMA 1: Length -- 14 is the default. This is the length of the window the KAMA looks back over. In this instance, it c
KAMA 1: Fast KAMA Length -- 2 is the default. This is the tightest the EMA length is allowed to get. It will tend towards this length when volatility is high.
KAMA 1: Slow KAMA Length -- 20 is the default. This is the biggest the EMA length is allowed to get. It will tend towards this length when volatility is low.
KAMA Filter
The strategy buys when the KAMA begins to point up and sells when the KAMA points down. Generally, the KAMA is very good at filtering out the noise itself - it will go flat during noisy/choppy periods. But to add another layer of safety, its author, Perry Kaufman, proposed a KAMA filter. It works by taking the standard deviation of returns over the length of the the 'KAMA 1: Length' I mentioned above and multiplying it by an 'Entry Filter' (1 by default) and 'Exit Filter' (0.5 by default). The entry condition to go long is that the KAMA is pointing up and and it moved up more than 1 x St. Dev. of Returns. The exit condition is when the KAMA is pointing down and it moved down by more than 0.5 x St. Dev. of Returns.
Thanks
Thanks to ChuckBanger, cheatcountry, millerrh, and racer8 for parts of the code. I was able to build upon their good work.
-----
I hope this strategy is helpful to you.
Do you have any thoughts, ideas, or questions? Let me know in the comments or send me a message! I'd be glad to help you out.
If you need an indicator or strategy to be built or customised for you, let me know! I'll be glad to help and it'll probably be cheaper than you think!
Decomposed Average True RangeThis simple script decomposes the value of the Average True Range into a bullish component and a bearish component .
The script supports two plotting methods; Mirrored and Two Lines . If Mirrored is chosen, the indicator plots the bullish component as a positive number, and the bearish component as a negative number. If Two Lines is chosen, the indicator plots two lines, both of positive values. It is the same data, just visualized differently.
Side note: This is very similar to how the strength (average gain) part in the Relative Strength Index calculation works. However, the RSI uses the realized range (close - previous close) rather than true range. If we were to use the bullish component of the ATR as the average bullish gain part in the RSI calculation, and the bearish component of the ATR as the average bearish gain part in the RSI calculation, we would get very similar (but not equal) results to the standard RSI. This shows how the ATR and the RSI are related to each other.
MA, MATR, ChEx | All in One - 4CR CUPIn trade position setup, we always need to determine the market structure and manage the position sizing in a short period of decision time. Indicators such as moving average, initial stop loss and trailing stop loss are always helpful.
This indicator put all these handy tools into a single toolkit, which includes the following price action and risk management indicators:
MA - Moving Average
MATR - Moving Average less Average True Range
ChEx - Chandelier Exit
This script further enhances the setting so that you can easily customize the indicators.
For both the Moving Averages and the Moving Average less Average True Range , you can pick a type of moving average which suits your analysis style from a list of commonly used moving average formulations: namely, EMA , HMA , RMA, SMA and WMA , where EMA is selected as default.
The Moving Average less Average True Range , MATR, is usually applied as a reference to set the initial stop loss whenever opening a new position.
The abbreviation, MATR, is picked, so that this can serve as a handy reminder of a very good trading framework as elaborates as below:
M – Market Structure
A – Area of Value
T – Trigger
R – Risk Management (aka. Exit Strategy)
MA Candles Supertrend StrategySimple strategy which is derived by below method:
1. Calculate moving average of High, Low, Open and Close and make candles of them.
2. Derive supertrend on the moving average candles.
3. Generate buy and sell signals based on supertrend direction combined with higher timeframe high-low condition
Position Size Calculator - Fixed Dollar amount, point value ATRHello Traders,
A very simple code aiming to help you size your position, according to the amount you're accepting to lose AND the current volatility ATR.
Why is it important to use ATR size ? Markets move, and having fixed stoploss values will lead to getting stopped out in case of volatility increase.
You also need to size down your trades in case of more volatily, as more points can be taken or lost.
Hope it helps!
Kudos to Racer9 who inspired me :
ATR Stop PriceSet stop price and add-position price according to the cost and current ATR.
You may set an alert with the condition when the stock price crossing down the Stop Price.
Example:
stock price: $150
volatility multiple: 2
current ATR: $3
stop price = $150 - $3 * 2 = $144
add-position price = $150 + $3 * 2 / 2 = $153
HalfTrendA popular trend indicator based on ATR. Similar to the SuperTrend but uses a different trend's identification logic.
I am publishing a disclosed code without license. Remember that in the future you may see a lot of paid IO scripts called BuySellScalper, Trend Trader Karan, Trend Trader and etc (by other authors) which will be based on this script. I found the same script on Ebay for $10 with a free shipping. Beware, always check and follow one Russian wisdom: "Do not pay for something you can get for free".
ATR-DAY TRADER AHINSTEAD OF HAVING AN EXTRA TAB AT BOTTOM OF THE CHART THIS ATR DOES THE SAME WORK WITHOUT GIVING ANY ADDITIONAL TABS. IT JUST GIVES A VALUE AT THE LEFT HAND SIDE TOP, WHERE WE SEE ALL OUR INDICATOR SETTINGS DISPLAYED. AS ATR IS USED MAJORLY FOR SETTING UP PROPER STOPLOSS THE ONLY THING I PERSONALY NEED IN HANDY IS THE VALUE AT THE SIDE.
HOPE THAT THIS HELPS FOR MANY PEOPLE AROUND THERE WHO DO NOT WISH TO MAKE THE SCREEN COMPACT AND LOOK LOST WHILE TRADING BY ADDING TO MANY INDICATORS.
THANKS & REGARDS -
DAY TRADER AH
@HUZAIFA_786
G-ATR Box V.1Hello this is my new adapt indicator "G-ATR Box V.1"
It's just nearly normal ATR but I create in box color. My problem when I use ATR trailing stop my screen is not clean and when I use finonacci or trend line is hard to see.
How to use
Blue = Pre-buy : Waiting for another buy signal
Green = Buy : Holding the stock
Yellow = Weak uptrend : Waiting for Sell signal
Red = Sell
In this screen I compare G-ATR Box(above) with G-MACD color(below)
When the stock strong uptend all of G-ATR and G-MACD is very work and When weak uptrend G-ATR is action frist but beware Bear trap too
goodluck
Auto Position Sizing Risk RewardThe Auto Position Sizing Risk Reward indicator shows different Risk levels 1, 1.5, 2 and 3 based on your risk amount and uses an auto Stoploss level based on the ATR.
You can set the values for the "Note or Title", "Risk Amount", "Entry", "Target Price", "Stop Loss Distance", "Default Risk/Reward" and ATR settings.
The "auto" part comes into play when you haven't yet set an Entry value, which will make everything update according to the latest Closing price of the asset.
Once you set the Entry price, the Risk/Reward levels will stop updating their positions and stay in place. This allows you to dynamically see your potential Risk/Reward as the market progresses, as well as locking in your Risk/Reward levels once you are ready to enter a position.
Your Position Size as well as actual Stoploss level and Cost is displayed along with the other values in the textbox that floats next to the R/R levels.
This indicator was inspired by and relies heavily on the work done by zzzcrypto123 and NXT2017 in their indicators, but I felt that this version is unique enough to hopefully be of use to the general community.
I hope this helps you to trade better! Please feel free to improve it and provide suggestions.
Running Bound based on ATR multiplierThis script basically uses default ATR and then
Multiplies with ATR multiplier (3 for crypto and 2 for forex) - you can change the values from the settings if you like
Adds/subtracts from the current price
And tries to find a bound on both side of price