Isn't it true that SYMBOL_PRICE_VOLATILITY and ATR are different things in general?
like in school, check what is measured and what is counted from....
the first one is a reference parameter from the specification (or translated by DC), not related to timeframes and measured in %.
the second is statistical for an arbitrary period of a specific timeframe, measured in quote units.
for familiar Forex SYMBOL_PRICE_VOLATILITY is not used and is not broadcasted. But we have not only Forex here.
For example, exchange instruments have a similar thing in their specifications and general conditions - the upper limit of price change per session, after which trading will be automatically suspended. It is large, rare, but it is there
Maxim Kuznetsov #: but is it ok that SYMBOL_PRICE_VOLATILITY and ATR are different things in general ?
Maxim, it's good that you reacted to this topic. Frankly speaking, I am far away from the volatility topic and I still can't understand why this volatility is needed and why this topic is raised many times but is not fully disclosed. The only thing I have understood is that there is supposedly a dependence of price chart reversal at a significant increase in volatility. Besides, I have read several topics related to the application of the ATR volatility indicator, but having installed it on the chart, I have not seen anything so valuable. Could you tell me in a concise form what is so valuable for a trader? I would be very grateful.
MrBrooklin #: The only thing I understood was that there is supposedly a dependence of price chart reversal at a significant increase in volatility. Besides, I have read several topics related to the application of the ATR volatility indicator, but having installed it on the chart, I have not seen anything so valuable. Could you tell me in a concise form what is so valuable for a trader? I would be very grateful.
If you write a multi-volume book about Forex (or about TA in general), 2/3 of volumes will be about volatility in one way or another :-)
The simplest practical application of ATR is to add the "shift" parameter to the code you have given, because the "shift" parameter will be added to the code.
And everything will be the same as in the old days:
Night, the icy ripples of the canal,
The pharmacy, thestreet, thestreetlight.
The market is cyclical, periodic and the ATR (average true range, amplitude of volatility) repeats itself time after time.
Intraday: shift your indicator reading to the right by PeriodSeconds(PERIOD_D1)/PeriodSeconds(PERIOD_CURRENT)-ATR_PERIOD/2. That is, by the number of bars for 1 day minus the "delay" from ATR averages.
get the average range (distance from Open to the farthest high/low, price spread) as it was yesterday at the same time. Now you can compare the current candlestick size with it and draw conclusions whether trading is more active or vice versa. It is already good
In passing, purely technical: in 99% of cases in TA we use window functions, i.e. averages, comparisons for some period. They all fail in three cases: when small values within windows are almost identical, when values at the ends of windows are too different, and when values are large but "all over the place". This roughly correlates with small and significant ATR and its reversals. That is, when the range is small, the indicators are too sensitive and react to the slightest noise, and when it rises sharply (or falls sharply), it is also nonsense
Maxim Kuznetsov #: Within a day: shift your indicator readings to the right by PeriodSeconds(PERIOD_D1)/PeriodSeconds(PERIOD_CURRENT)-ATR_PERIOD/2. That is, by the number of bars for 1 day minus the "delay" from ATR averages ...
Thank you, Maxim, for your attention and answer! Now I have something to think about.
Thank you. However, no one has answered what the function of the indicator with the number of periods 0 produces and why only 3 elements are copied and how, if necessary, and whether it is necessary to copy all of them:
int copy_buffer = CopyBuffer(Handle_ATR, 0, 0,3, atr_array_value);
Such a case...
I must say that I have become more aware of the essence of volatility. I used to think it was the deviation of prices from the average price. But both ATR and theory say it's a corridor of prices.
maxvoronin74 #: Thank you. However, no one has answered what the function of the indicator with the number of periods 0 produces and why only 3 elements are copied and how to copy all of them, if necessary, and whether it is necessary:
Such a case...
I must say that I have become more aware of the essence of volatility. I used to think it was the deviation of prices from the average price. But both ATR and theory say it's a corridor of prices.
It doesn't give anything away. The minimum can be 1:
//+------------------------------------------------------------------+//| Average True Range |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
if(rates_total<=ExtPeriodATR)
return(0);
int i,start;
//--- preliminary calculationsif(prev_calculated==0)
{
ExtTRBuffer[0]=0.0;
ExtATRBuffer[0]=0.0;
//--- filling out the array of True Range values for each periodfor(i=1; i<rates_total && !IsStopped(); i++)
ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
//--- first AtrPeriod values of the indicator are not calculateddouble firstValue=0.0;
for(i=1; i<=ExtPeriodATR; i++)
{
ExtATRBuffer[i]=0.0;
firstValue+=ExtTRBuffer[i];
}
//--- calculating the first value of the indicator
firstValue/=ExtPeriodATR;
ExtATRBuffer[ExtPeriodATR]=firstValue;
start=ExtPeriodATR+1;
}
else
start=prev_calculated-1;
//--- the main loop of calculationsfor(i=start; i<rates_total && !IsStopped(); i++)
{
ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodATR;
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
If you enter a value less than 1, it will default to 14:
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+voidOnInit()
{
//--- check for input valueif(InpAtrPeriod<=0)
{
ExtPeriodATR=14;
PrintFormat("Incorrect input parameter InpAtrPeriod = %d. Indicator will use value %d for calculations.",InpAtrPeriod,ExtPeriodATR);
}
else
ExtPeriodATR=InpAtrPeriod;//--- indicator buffers mappingSetIndexBuffer(0,ExtATRBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtTRBuffer,INDICATOR_CALCULATIONS);
//---IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- sets first bar from what index will be drawnPlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpAtrPeriod);
//--- name for DataWindow and indicator subwindow labelstring short_name=StringFormat("ATR(%d)",ExtPeriodATR);
IndicatorSetString(INDICATOR_SHORTNAME,short_name);
PlotIndexSetString(0,PLOT_LABEL,short_name);
}
This is how it is done in the indicator. Of course, you can do anything you want, but a period less than 1 will not give anything in the calculations.
Why do you need a zero calculation period? What is the point?
Why do you need a zero calculation period? What is the point?
I was wondering how to get the volatility of the current candle using the indicator's standard tools.
As for the second part of the question,"why only 3 elements are copied and how, if necessary, and whether it is necessary to copy all of them", is there any explanation?
I was wondering how to get the volatility of the current candle using the indicator's standard tools.
As for the second part of the question,"why only 3 elements are copied and how, if necessary, and whether it is necessary to copy all of them", is there any explanation?
The person wanted to show in the example how to copy three bars. You can copy as many bars as you need. But for an Expert Advisor, as well as usually, it is enough to know the current volatility. This is only one zero, current bar.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
What's the point? What's the point?
I'm telling you, I wrote it in my sleep. )) Corrected.
Regards, Vladimir.
Corrected version:
With respect, Vladimir.
Isn't it true that SYMBOL_PRICE_VOLATILITY and ATR are different things in general?
like in school, check what is measured and what is counted from....
the first one is a reference parameter from the specification (or translated by DC), not related to timeframes and measured in %.
the second is statistical for an arbitrary period of a specific timeframe, measured in quote units.
for familiar Forex SYMBOL_PRICE_VOLATILITY is not used and is not broadcasted. But we have not only Forex here.
For example, exchange instruments have a similar thing in their specifications and general conditions - the upper limit of price change per session, after which trading will be automatically suspended. It is large, rare, but it is there
but is it ok that SYMBOL_PRICE_VOLATILITY and ATR are different things in general ?
Maxim, it's good that you reacted to this topic. Frankly speaking, I am far away from the volatility topic and I still can't understand why this volatility is needed and why this topic is raised many times but is not fully disclosed. The only thing I have understood is that there is supposedly a dependence of price chart reversal at a significant increase in volatility. Besides, I have read several topics related to the application of the ATR volatility indicator, but having installed it on the chart, I have not seen anything so valuable. Could you tell me in a concise form what is so valuable for a trader? I would be very grateful.
Regards, Vladimir.
The only thing I understood was that there is supposedly a dependence of price chart reversal at a significant increase in volatility. Besides, I have read several topics related to the application of the ATR volatility indicator, but having installed it on the chart, I have not seen anything so valuable. Could you tell me in a concise form what is so valuable for a trader? I would be very grateful.
If you write a multi-volume book about Forex (or about TA in general), 2/3 of volumes will be about volatility in one way or another :-)
The simplest practical application of ATR is to add the "shift" parameter to the code you have given, because the "shift" parameter will be added to the code.
The market is cyclical, periodic and the ATR (average true range, amplitude of volatility) repeats itself time after time.
Intraday: shift your indicator reading to the right by PeriodSeconds(PERIOD_D1)/PeriodSeconds(PERIOD_CURRENT)-ATR_PERIOD/2. That is, by the number of bars for 1 day minus the "delay" from ATR averages.
get the average range (distance from Open to the farthest high/low, price spread) as it was yesterday at the same time. Now you can compare the current candlestick size with it and draw conclusions whether trading is more active or vice versa. It is already good
In passing, purely technical: in 99% of cases in TA we use window functions, i.e. averages, comparisons for some period. They all fail in three cases: when small values within windows are almost identical, when values at the ends of windows are too different, and when values are large but "all over the place". This roughly correlates with small and significant ATR and its reversals. That is, when the range is small, the indicators are too sensitive and react to the slightest noise, and when it rises sharply (or falls sharply), it is also nonsense
you can go on and on... :-)
Within a day: shift your indicator readings to the right by PeriodSeconds(PERIOD_D1)/PeriodSeconds(PERIOD_CURRENT)-ATR_PERIOD/2. That is, by the number of bars for 1 day minus the "delay" from ATR averages ...
Thank you, Maxim, for your attention and answer! Now I have something to think about.
Regards, Vladimir.
Corrected version:
With respect, Vladimir.
Such a case...
I must say that I have become more aware of the essence of volatility. I used to think it was the deviation of prices from the average price. But both ATR and theory say it's a corridor of prices.Thank you. However, no one has answered what the function of the indicator with the number of periods 0 produces and why only 3 elements are copied and how to copy all of them, if necessary, and whether it is necessary:
Such a case...
I must say that I have become more aware of the essence of volatility. I used to think it was the deviation of prices from the average price. But both ATR and theory say it's a corridor of prices.It doesn't give anything away. The minimum can be 1:
If you enter a value less than 1, it will default to 14:
This is how it is done in the indicator. Of course, you can do anything you want, but a period less than 1 will not give anything in the calculations.
Why do you need a zero calculation period? What is the point?
No output. The minimum can be 1:
If you enter a value less than 1, the default value of 14 will be set:
Thank you. Now it is clear.
Artyom Trishkin #:
Why do you need a zero calculation period? What is the point?
I was wondering how to get the volatility of the current candle using the indicator's standard tools.
As for the second part of the question,"why only 3 elements are copied and how, if necessary, and whether it is necessary to copy all of them", is there any explanation?Thank you. I see now.
I was wondering how to get the volatility of the current candle using the indicator's standard tools.
As for the second part of the question,"why only 3 elements are copied and how, if necessary, and whether it is necessary to copy all of them", is there any explanation?