paladin80: What does it mean to consider an indicator in the tester? (1) Maybe the indicator of another timeframe should be displayed during visualization, or (2) in the EA code, in the function of the indicator you need to calculate a value for another timeframe?
there are several indicators linked to several timeframes in the EA, if I use comment() function, then it displays only indicator values for tested timeframe, other indicator values remain unchanged, I suppose that during the test indicators of other timeframes are not taken into account.
where numbers 1, 5, 15, 30, 60, 240, correspond to timeframes m1, m5, m15, m30, H1, H4
As a result, when testing at 4 o'clock, only p240 is displayed, the rest of values hangs on the start, on the hour, only p60 changes value and so on...
Going back to my question, is there a way to correct display of values in the tester for different timeframes and take into account values from different timeframes or current for the tested timeframe?
I have several indicators linked to several timeframes, if I use the comment() function, then only indicator values for the tested timeframe are displayed, other indicator values remain unchanged, I assume that indicators of other timeframes are not taken into account in the test either.
...
First, show me the part of the code where you find in the EA the indicator values for other timeframes. I suspect there may be an error there.
Hello! Could you please tell me how to record that an order is opened only once (while the condition is met) and when the order closes (even if the condition is still met) no more orders are executed!
Hello , help with code !!! I need an order to open based on a condition once an hour at the beginning of the hour ( on a new hourly bar) and regardless of the result a new opening was only after 1 hour or 2 or 3 etc. and also only at the beginning of the hour (on a new hourly bar) depending on the condition ?????
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 19.02.2008 |//| Описание : Возвращает количество секунд после открытия последней позиций. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//+----------------------------------------------------------------------------+datetime SecondsAfterOpenLastPos(string sy="", int op=-1, int mn=-1) {
datetime t;
int i, k=OrdersTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderOpenTime()) t=OrderOpenTime();
}
}
}
}
}
}
return(TimeCurrent()-t);
}
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 19.02.2008 |//| Описание : Возвращает количество секунд после закрытия последней позиций. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента ("" - любой символ, |//| NULL - текущий символ) |//| op - операция (-1 - любая позиция) |//| mn - MagicNumber (-1 - любой магик) |//+----------------------------------------------------------------------------+datetime SecondsAfterCloseLastPos(string sy="", int op=-1, int mn=-1) {
datetime t;
int i, k=OrdersHistoryTotal();
if (sy=="0") sy=Symbol();
for (i=0; i<k; i++) {
if (OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol()==sy || sy=="") {
if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
if (op<0 || OrderType()==op) {
if (mn<0 || OrderMagicNumber()==mn) {
if (t<OrderCloseTime()) t=OrderCloseTime();
}
}
}
}
}
}
return(TimeCurrent()-t);
}
paladin80: First, show the part of the code where you find the indicator values for other timeframes in the EA. The suspicion is that there might be an error lurking there.
int pic1=GetExtremumZZBar("",PERIOD_M1,0,12,5,3);
int pic5=GetExtremumZZBar("",PERIOD_M5,0,12,5,3);
int pic15=GetExtremumZZBar("",PERIOD_M15,0,12,5,3);
int pic30=GetExtremumZZBar("",PERIOD_M30,0,12,5,3);
int pic60=GetExtremumZZBar("",PERIOD_H1,0,12,5,3);
int pic240=GetExtremumZZBar("",PERIOD_H4,0,12,5,3);
Kim's function
//+----------------------------------------------------------------------------+//| Автор : Ким Игорь В. aka KimIV, http://www.kimiv.ru |//+----------------------------------------------------------------------------+//| Версия : 07.10.2006 |//| Описание : Возвращает номер бара экстремума ЗигЗага по его номеру. |//+----------------------------------------------------------------------------+//| Параметры: |//| sy - наименование инструмента (NULL или "" - текущий символ) |//| tf - таймфрейм ( 0 - текущий ТФ) |//| ne - номер экстремума ( 0 - последний) |//| dp - ExtDepth |//| dv - ExtDeviation |//| bs - ExtBackstep |//+----------------------------------------------------------------------------+int GetExtremumZZBar(string sy="", int tf=0, int ne=0, int dp=12, int dv=5, int bc=3) {
if (sy=="" || sy=="0") sy=Symbol();
double zz;
int i, k=iBars(sy, tf), ke=0;
for (i=0; i<k; i++) {
zz=iCustom(sy, tf, "ZigZag", dp, dv, bc, 0, i);
if (zz!=0) {
ke++;
if (ke>ne) return(i);
}
}
Print("GetExtremumZZBar(): Экстремум ЗигЗага номер ",ne," не найден");
return(-1);
}
int pic1=GetExtremumZZBar(NULL,PERIOD_M1,0,12,5,3);
int pic5=GetExtremumZZBar(NULL,PERIOD_M5,0,12,5,3);
int pic15=GetExtremumZZBar(NULL,PERIOD_M15,0,12,5,3);
int pic30=GetExtremumZZBar(NULL,PERIOD_M30,0,12,5,3);
int pic60=GetExtremumZZBar(NULL,PERIOD_H1,0,12,5,3);
int pic240=GetExtremumZZBar(NULL,PERIOD_H4,0,12,5,3);
//---int GetExtremumZZBar(string sy, int tf, int ne, int dp, int dv, int bc) {
...
}
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 does it mean to consider an indicator in the tester? (1) Maybe the indicator of another timeframe should be displayed during visualization, or (2) in the EA code, in the function of the indicator you need to calculate a value for another timeframe?
there are several indicators linked to several timeframes in the EA, if I use comment() function, then it displays only indicator values for tested timeframe, other indicator values remain unchanged, I suppose that during the test indicators of other timeframes are not taken into account.
where numbers 1, 5, 15, 30, 60, 240, correspond to timeframes m1, m5, m15, m30, H1, H4
As a result, when testing at 4 o'clock, only p240 is displayed, the rest of values hangs on the start, on the hour, only p60 changes value and so on...
Going back to my question, is there a way to correct display of values in the tester for different timeframes and take into account values from different timeframes or current for the tested timeframe?
I have several indicators linked to several timeframes, if I use the comment() function, then only indicator values for the tested timeframe are displayed, other indicator values remain unchanged, I assume that indicators of other timeframes are not taken into account in the test either.
...
how to make an order open once per hour and only at the beginning of the hour
or
https://docs.mql4.com/ru/dateandtime/minute
only naturally check if an order is opened so that another one is not opened
First, show the part of the code where you find the indicator values for other timeframes in the EA. The suspicion is that there might be an error lurking there.
Kim's function