Valeriy Yastremskiy Maybe it's because the code is incomplete, as I removed all unnecessary functions.
//+----------------------------------------------------------------------------+//| AverageRange.mq4 |//| Ким Игорь В. aka KimIV |//| http://www.kimiv.ru |//| |//| 14.09.2005 Скрипт для расчёта: |//| средней волатильности инструмента High-Low |//| среднего размера тела свечи ABS(Open-Close) |//| среднего размера тени свечи |//| |//| 17.11.2007 Возможность использования заданного количества баров |//+----------------------------------------------------------------------------+#property copyright"Ким Игорь В. aka KimIV"#property link"http://www.kimiv.ru"#property show_inputs
externdatetime BeginDateCalc = D'2013.01.01';
externdatetime EndDateCalc = D'2013.12.31';
externint NumberOfBars = 100;
//+----------------------------------------------------------------------------+//| script program start function |//+----------------------------------------------------------------------------+void start() {
int i;
int b = 0;
int bb = 0;
int h = 0;
int l = 0;
int s = 0;
int t = 0;
string st = "";
for (i = Bars; i > 0; i--) {
if ((Time [i] >= BeginDateCalc && Time [i] <= EndDateCalc && NumberOfBars <= 0)
|| (NumberOfBars > 0 && NumberOfBars >= i)) {
if (bb == 0) bb = i;
s += (High [i] - Low [i]) / Point;
t += MathAbs (Open [i] - Close [i]) / Point;
if (Open [i] > Close [i]) {
h += (High [i] - Open [i]) / Point;
l += (Close [i] - Low [i]) / Point;
} else {
h += (High [i] - Close [i]) / Point;
l += (Open [i] - Low [i]) / Point;
}
b++;
}
}
st = "Начало: " + TimeToStr (Time [bb], TIME_DATE | TIME_MINUTES) + "\n";
st = st + "Конец: " + TimeToStr (Time [bb - b + 1], TIME_DATE | TIME_MINUTES) + "\n";
st = st + "Использовано баров: " + b + "\n";
st = st + "Средняя волатильность: " + s / b + " п.\n";
st = st + "Средний размер тела: " + t / b + " п.\n";
st = st + "Средний размер верхней тени: " + h / b + " п.\n";
st = st + "Средний размер нижней тени: " + l / b + " п.";
Comment (st);
}
//+----------------------------------------------------------------------------+
To be honest, I don't understand Kim's logic, why the conditions of bar time exceeding the set value and the number of calculated bars are negative with OR the number of calculated bars is greater than the number of bars Barz)))) And at the same time it just corrects the custom parameters)
And it doesn't even display an alert that the user has messed up)
Logically, if NumberOfBars is specified (greater than 0), the time is ignored and just the latest bars are taken into account
But a user can make a mistake with dates or if there is a hole in the quote, then nothing is printed, it just returns DivideByZero :-)
voidOnStart(){
double first=0.00001;
double point=0.00001;
for(uint i=0;i<10;++i){
double value=NormalizeDouble(first+i*point,5);
int res=(int)((value-first)/point);
if (res!=i)
PrintFormat("Alert: (%.5 f-%.5 f)/%.5 f!=%u, but ==%i",value,first,point,i,res);
}
}
2021.09.1211:06:26.041 Script test EURGBP,H1: removed
2021.09.1211:06:26.038 test EURGBP,H1: uninit reason 02021.09.1211:06:26.038 test EURGBP,H1: Alert: (0.00007-0.00001)/0.00001!=6, but ==52021.09.1211:06:26.038 test EURGBP,H1: Alert: (0.00003-0.00001)/0.00001!=2, but ==12021.09.1211:06:26.038 test EURGBP,H1: initialized
2021.09.1211:06:25.998 Script test EURGBP,H1: loaded successfully
How to make the indicator window completely hide the price chart?
I cannot do it through ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,0,0). I have to first set the size of the indicator and then add the height of the price window to it:
int chart_height=(int)ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0);
IndicatorSetInteger(INDICATOR_HEIGHT,200+chart_height);
However, if you open the order window at the bottom, the size of the indicator window becomes larger than the screen size and the terem shows the price again.
I don't know how to measure the order window, besides, it keeps changing.
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.
Aleksei Stepanenko thank you.
Valeriy Yastremskiy Maybe it's because the code is incomplete, as I removed all unnecessary functions.To be honest, I don't understand Kim's logic, why the conditions of bar time exceeding the set value and the number of calculated bars are negative with OR the number of calculated bars is greater than the number of bars Barz)))) And at the same time it just corrects the custom parameters)
And it doesn't even display an alert that the user has messed up)
Logically, if NumberOfBars is specified (greater than 0), the time is ignored and just the latest bars are taken into account
But a user can make a mistake with dates or if there is a hole in the quote, then nothing is printed, it just returns DivideByZero :-)
can anyone know how to convert quotes from mt5 to mt4? or any ways to take advantage of better history from mt5 to mt4... except TDS2😊
Hi
can anyone know how to convert quotes from mt5 to mt4? or any ways to take advantage of better history from mt5 to mt4... except TDS2😊
Export/import
so mt5 has a different quote format. mt4 won't read them. that's the problem...😎
so mt5 has a different quote format. mt4 won't read them. that's the problem...😎
MT5 export to csv and mt4 reads everything
Why do I need division by Point?
...
I strongly recommend it:
Otherwise you get an oops)))
How to make the indicator window completely hide the price chart?
I cannot do it through ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,0,0). I have to first set the size of the indicator and then add the height of the price window to it:
However, if you open the order window at the bottom, the size of the indicator window becomes larger than the screen size and the terem shows the price again.
I don't know how to measure the order window, besides, it keeps changing.
What to do?
Please help!
Help translate this code into mql5...
I want to understand how to work with handles.
I would appreciate your help.
Please help!
Help translate this code into mql5...
I want to understand how to work with handles.
I would appreciate your help.
The only question is about this line
-50 redundant and array