ATR has a different scale to that of quote prices. It would not make sense to put them on the same graph.
the ATR indicator is built-in in mt4. is there a way to put in on the chart like in tradingview rather than in a separate oscillator window?
you mean like with bands ?
With bands it would be called a Keltner channel.
like so ?
#property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 2 //--- plot top_volatility #property indicator_label1 "top_volatility" #property indicator_type1 DRAW_LINE #property indicator_color1 clrGreenYellow #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- plot bottom_volatility #property indicator_label2 "bottom_volatility" #property indicator_type2 DRAW_LINE #property indicator_color2 clrCrimson #property indicator_style2 STYLE_SOLID #property indicator_width2 1 input int period=14;//atr period //--- indicator buffers double top_volatilityBuffer[]; double bottom_volatilityBuffer[]; int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,top_volatilityBuffer); SetIndexBuffer(1,bottom_volatilityBuffer); //--- return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- int from=rates_total-prev_calculated; if(from>period){ from=rates_total-period-2; } for(int i=from;i>=0;i--){ double atr=iATR(_Symbol,_Period,period,i+1);//the volatility of the previous //projected on the current top_volatilityBuffer[i]=Open[i]+atr; bottom_volatilityBuffer[i]=Open[i]-atr; } //--- return value of prev_calculated for next call return(rates_total); }
ATR has a different scale to that of quote prices. It would not make sense to put them on the same graph.
yeah i didn't really understand i was watching a youtube video and it came up
https://www.youtube.com/watch?v=dfijk5dkito&ab_channel=TheMovingAverage
the indictaor i'm talking about is at about 3:30
this guy does great videos btw just on tradingview not on mt4
![The Best ATR Indicator for Setting Stoploss The Best ATR Indicator for Setting Stoploss](https://c.mql5.com/36/61/the-best-atr-indicator-for-setting.jpg)
- 2021.03.27
- www.youtube.com
the indictaor i'm talking about is at about 3:30 this guy does great videos btw just on tradingview not on mt4
Then you missed a key part out of the name. He mentions "Average True Range Trailing Stop". You left out "Trailing Stop" which is a key component.
Another name for "ATR Trailing Stop" is the "Chandelier Exit". Do a search in the CodeBase and in the Market.
Then you missed a key part out of the name. He mentions "Average True Range Trailing Stop". You left out "Trailing Stop" which is a key component.
Another name for "ATR Trailing Stop" is the "Chandelier Exit". Do a search in the CodeBase and in the Market.
thanks a lot i'll check that out!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use