ATR on chart

 
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?
 
buildmt4ea: 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?

ATR has a different scale to that of quote prices. It would not make sense to put them on the same graph.

 
buildmt4ea:
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 ?

 
Lorentzos Roussos #:you mean like with bands ?
With bands it would be called a Keltner channel.
 
Fernando Carreiro #:
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);
  }

 
Fernando Carreiro #:

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
  • 2021.03.27
  • www.youtube.com
The ATR indicator also known as the average true range indicator is one of the best tools a day trader can use to set their stop loss and take profit levels ...
 
Lorentzos Roussos #:

like so ?

thanks i will try that

 
buildmt4ea #: 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

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.

 
buildmt4ea #: the indictaor i'm talking about is at about 3:30

Also remember that indicators can not trade. You need an EA (or script) for an automatic chandelier trailing stop.

 
Fernando Carreiro #:

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!

 
William Roeder #:

Also remember that indicators can not trade. You need an EA for an automatic chandelier trailing stop.

thank you sm for that, i love this community, many ppl are considerate of new traders like me

Reason: