TradingView
asenski
14 נוב׳ 2020 03:50

Minimum Average True Range 

SPDR S&P 500 ETF TRUSTArca

תיאור

I use ATR a lot when designing trading strategies, this way the strategy adjusts to the instrument in most cases instead of me plugging in special numbers.

However, ATR itself could get spiked by some violent moves. For this I have created MinATR which I am publishing here.

It is effectively ATR + minimum ATR over the last "Min Length" bars. (this is a parameter which I have defaulted to 50).

So use this the same way you use ATR, but it will also show the min ATR over the last "Min Length" periods.
תגובות
GreatStockMark
I used it and liked it. I have one observation. minATR is not taking today's price range into consideration as minimum ATR even though today is the lowest in the selected time length. Any idea why it is not considering current date price range in determining the minimum ATR?
asenski
@GreatStockMarketer, Good observation!

I do normally make calculations for the day, I want them to be constant, so I only do calculations on closed bars, not currently developing ones.
Otherwise at the open you will often have a super minimal ATR, even though the price could move significantly that day.

That said I am not actually doing anything special other than taking the ``lowest(atr, minlength)``.

In general the goal of this indicator is not to find sudden changes, but rather find a "multiplier" we can use to have consistent calculations for stops/profit targets/etc.

Can you post a chart, or tell me the stock symbol you were looking at so I can take a peek as well?

Cheers!
GreatStockMark
@asenski, Thanks for the reply. I checked around 9 PM in the night thinking that current bar is closed. Let me try to get one example and post it.
asenski
@GreatStockMarketer, just to clarify one thing:

I actually use the prior day's ATR / MinATR, which is set in stone. I think as it is right now the current day does update as it unfolds, but you don't really want to look at that.

If you're looking for momentum indicators - two things 1) look at lower time frame, not daily, and 2) use actual momentum indicators such as RSI.
stevenwalter0
This looks good. I agree with your thoughts on using the ATR in everything. I use it the same, as kind of a universal tape measure. I will be interested to see any other indicators you create.
asenski
@stevenwalter0, Thank you, Steven! I've done some really interesting indicators over the years, but it's a challenge to port them to Pine Script.

Good news is that Pine Script seems to be constantly improving and may be one day I'll be able to implement some of the more advanced stuff in here as well.

Cheers!
stevenwalter0
@asenski, Ok that sounds great, i'll be following you. Yes we've gotten the array function and now can have dynamic lengths used in functions so I'm excited to try out new ideas. Thanks for your additions!
IvanLabrie
I'll be using this one, thanks Asen!
asenski
@IvanLabrie, Thank you, Ivan! Glad you find it useful!
עוד