Kos: I haven't found any description of response codes (Retcode) for MqlTradeCheckResult structure of trade request results in the documentation. Will there be any?
Tnew[1] - out of array, the array is described as Tnew[1], so its elements can only be accessed as Tnew[0], because the index starts at zero.
What is the output? In this case Tnew[1]is an incorrect expression, but is it valid? Is Tnew[0] , Tnew[] a valid expression, or something else? The Expert Advisor's result does not seem to change when Tnew[1], Tnew[0], Tnew[] are used.
Renat, if I understood you correctly, the ENUM_TRADE_RETURN_CODES return codes for MqlTradeResult structure also apply to MqlTradeCheckResult structure
ias: What is the output? Tnew[1]is an incorrect expression in this case, but it is valid? Is Tnew[0] , Tnew[] a valid expression or something else? The result of the expert does not seem to change when using Tnew[1],Tnew[0],Tnew[].
The result cannot be the same, at least not if data is read from the array by an index that does not exist. What do you think is in Tnew[1]?
I'm not so sure about what is being written, when the EA leaves the range, it can report an error and move on. But what will be in Tnew[0] in this case?
Kos: Renat, if I understood you correctly, the ENUM_TRADE_RETURN_CODES return codes for MqlTradeResult structure also apply to MqlTradeCheckResult structure
Yes, the base of trade error codes is the same for the entire trade function space.
The descriptions for new functions will be corrected - we just didn't have time to do it right away.
The result cannot be the same, at least not if data is read from the array by an index that does not exist. What do you think is in Tnew[1]?
I'm not sure about writing, the Expert Advisor can report an error and move on when it leaves the range, but what will be in Tnew[0] in this case?
The result of expert work does not change when using datetime Tnew[1];Tnew[0];Tnew[];.does it follow that in Exp_TEMA.mq5 from the article "Creating an Expert Advisor that trades on different symbols" the , the function
//+X================================================================X+//| IsNewBar() function |//+X================================================================X+bool IsNewBar(int Number, string symbol, ENUM_TIMEFRAMES timeframe)
{
//----+staticdatetime Told[];
datetime Tnew[1];
//----+ Объвление переменной для хранения размеров массивов переменныхstaticint Size_ = 0;
//----+ Изменение размеров массивов переменныхif (Number + 1 > Size_)
{
uint size = Number + 1;
//----if (ArrayResize(Told, size) == -1)
{
string word = "";
StringConcatenate(word, "IsNewBar( ", Number,
" ): Ошибка!!! Не удалось изменить размеры массивов переменных!!!");
Print(word);
//---- int error = GetLastError();
ResetLastError();
if (error > 4000)
{
StringConcatenate(word, "IsNewBar( ", Number, " ): Код ошибки ", error);
Print(word);
}
//----
Size_ = -2;
return(false);
}
}
CopyTime(symbol, timeframe, 0, 1, Tnew);
if (Tnew[0] != Told[Number])
{
Told[Number] = Tnew[0];
return(true);
}
//----+return(false);
}
//+X================================================================X+
does not work?
What do you think Tnew[1] is?
After CopyTime(symbol, timeframe, 0, 1, Tnew); the address Tnew[1] should contain the start time of the previous bar.
The result of expert work does not change when using datetime Tnew[1];Tnew[0];Tnew[];.Should it follow that there is an Expert Advisor Exp_TEMA.mq5 from the article "Creating an Expert Advisor to trade on different symbols"? , the function
does not work?
What do you think Tnew[1] is?
After CopyTime(symbol, timeframe, 0, 1, Tnew); the address Tnew[1] should contain the start time of the previous bar.
Let's analyze in order
These two strings declare two arrays, one of which is dynamic, while the second one (Tnew) contains only one record.
staticdatetime Told[];
datetime Tnew[1];
This is an attempt to change the size of the dynamic array. It is assumed that the number of records in the array will be equal to size.
if (ArrayResize(Told, size) == -1)
This line copies one record (bar date) starting from bar number 0 into the Tnew array. This date then becomes available as Tnew[0] (because the array is numbered with ZERO).
CopyTime(symbol, timeframe, 0, 1, Tnew);
Here, the only record of array Tnew is compared to record numbered Number-1 in a cell of array Told (remember, the array is numbered from 0).
If these dates do not match, we write the value of Tnew array to the cell of Told array.
if (Tnew[0] != Told[Number])
{
Told[Number] = Tnew[0];
return(true);
}
Kos: I haven't found any description of response codes (Retcode) for the structure of MqlTradeCheckResult trade request check results in the documentation. Will they be available?
Very difficult to synchronise everything, I seem to have tried to account for everything in the indicator, but these holes are very difficult to deal with
2010.07.19 02:20:12 Checking of holes (EURUSD,M1) Number of holes in history 260 from the date 2010.07.09 21:35:00 2010.07.19 02:20:12 Checking of holes (EURUSD,M1) GBPUSD hole 2010.07.19 00:20:00 2010.07.19 02:20:12 Checking Holes (EURUSD,M1) Hole USDJPY 2010.07.19 00:15:00 2010.07.19 02:20:12 Hole Checking (EURUSD,M1) Hole EURGBP 2010.07.16 22:43:00 2010.07.19 02:20:12 Checking Holes (EURUSD,M1) GBPUSD Hole 2010.07.16 22:43:00 2010.07.19 02:20:12 Checking Holes (EURUSD,M1) GBPUSD Hole 2010.07.16 22:38:00 2010.07.19 02:20:12 Checking Holes (EURUSD,M1) AUDUSD Hole 2010.07.16 22:21:00
etc.....
//+------------------------------------------------------------------+//| Проверка дыр.mq5 |//| Привалов С.В. |//| https://www.mql5.com/ru/users/Prival |//+------------------------------------------------------------------+#property copyright "Привалов С.В."#property link "https://www.mql5.com/ru/users/Prival"#property version "1.00"#property indicator_separate_window#property indicator_buffers 1#property indicator_plots 1#property indicator_color1 Blueint MaxBars=7200; // точка стартаstring mas_0[]={"USDCHF","GBPUSD","EURUSD","USDJPY","USDCAD","AUDUSD","EURGBP","EURAUD","EURCHF","EURJPY","GBPJPY","GBPCHF"};
int count_symbol=12;
double Buffer[];
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
SetIndexBuffer(0,Buffer,INDICATOR_DATA);
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_HISTOGRAM);
//--- на старте сразу же пошлем асинхронные запросы на поднятие таймфреймов в памятьfor(int i=0; i<count_symbol; i++) CheckOtherSymbol(mas_0[i],MaxBars);
return(0);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+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<MaxBars) return(0); // ничего не считаем и ничего не рисуем на графике int start_pos=rates_total-MaxBars-1; // точка стартаif(close[start_pos]==0) return(0); // ничего не считаем и ничего не рисуем на графике //--- снова пошлем асинхронные запросы на поднятие таймфреймов в памятьfor(int i=0; i<count_symbol; i++)
{
if(!CheckOtherSymbol(mas_0[i],MaxBars)) return(0);
}
if(prev_calculated==0)
{
Print("Дата начала тестирования ",time[start_pos]);
Print("Символ ",_Symbol," приод ",_Period);
}
else start_pos=prev_calculated-1;
int sum=0;
//--- расчет индикатораfor(int i=start_pos;i<rates_total;i++)
{
Buffer[i]=0;
for(int j=0; j<count_symbol; j++)
{
if(!CheckTimeOtherSymbol(mas_0[j],time[i]))
{
Print("Дыра ",mas_0[j]," ",time[i]);
sum++;
}
}
}
Print("Количество дыр в истории ",sum, " от даты ",time[start_pos]);
//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+//+------------------------------------------------------------------+//| Проверка символов с асинхронным возбуждением |//+------------------------------------------------------------------+//| вход |//| symbol - символ |//| count_Bars - необходимое количество баров |//+------------------------------------------------------------------+bool CheckOtherSymbol(string symbol,int bars)
{
datetime ctm[1];
datetime checktime=TimeCurrent()-bars*PeriodSeconds(_Period); // требуемое времяbool res=true;
// скопируем время требуемого бараif(CopyTime(symbol,_Period,checktime,1,ctm)!=1) res=false;
if(!res) Print("Нет данных по символу ",symbol);
//--- вернем результатreturn(res);
}
//+------------------------------------------------------------------+//| Проверка синхронности символов |//+------------------------------------------------------------------+bool CheckTimeOtherSymbol(string symbol,datetime time)
{
datetime ctm[1];
bool res=false;
//--- скопируем время бараif(CopyTime(symbol,_Period,time,1,ctm)==1)
{
// сравним его с требуемымif(ctm[0]==time) res=true;
}
// if(!res) Print("Нет синхронизации по символу ",symbol," time[0]=",ctm[0]," нужно ",time);//--- вернем результатreturn(res);
}
//+------------------------------------------------------------------+
and second question: are there any other pitfalls in this multicurrency indicator which I haven't checked?
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.
I haven't found any description of response codes (Retcode) for MqlTradeCheckResult structure of trade request results in the documentation. Will there be any?
All descriptions are in the documentation.
Look at OrderSend function, MqlTradeResult structure and list of trade response codes.
Told - empty array with no size
Tnew[1] - out of array, the array is described as Tnew[1], so its elements can only be accessed as Tnew[0], because the index starts at zero.
All descriptions are in the documentation.
Look at OrderSend function, MqlTradeResult structure and list of trade response codes.
What is the output? Tnew[1]is an incorrect expression in this case, but it is valid? Is Tnew[0] , Tnew[] a valid expression or something else? The result of the expert does not seem to change when using Tnew[1],Tnew[0],Tnew[].
The result cannot be the same, at least not if data is read from the array by an index that does not exist. What do you think is in Tnew[1]?
I'm not so sure about what is being written, when the EA leaves the range, it can report an error and move on. But what will be in Tnew[0] in this case?
Renat, if I understood you correctly, the ENUM_TRADE_RETURN_CODES return codes for MqlTradeResult structure also apply to MqlTradeCheckResult structure
Yes, the base of trade error codes is the same for the entire trade function space.
The descriptions for new functions will be corrected - we just didn't have time to do it right away.
The result cannot be the same, at least not if data is read from the array by an index that does not exist. What do you think is in Tnew[1]?
I'm not sure about writing, the Expert Advisor can report an error and move on when it leaves the range, but what will be in Tnew[0] in this case?
The result of expert work does not change when using datetime Tnew[1];Tnew[0];Tnew[];.does it follow that in Exp_TEMA.mq5 from the article "Creating an Expert Advisor that trades on different symbols" the , the function
does not work?
What do you think Tnew[1] is?
After CopyTime(symbol, timeframe, 0, 1, Tnew); the address Tnew[1] should contain the start time of the previous bar.
The result of expert work does not change when using datetime Tnew[1];Tnew[0];Tnew[];.Should it follow that there is an Expert Advisor Exp_TEMA.mq5 from the article "Creating an Expert Advisor to trade on different symbols"? , the function
does not work?
What do you think Tnew[1] is?
After CopyTime(symbol, timeframe, 0, 1, Tnew); the address Tnew[1] should contain the start time of the previous bar.
Let's analyze in order
These two strings declare two arrays, one of which is dynamic, while the second one ( Tnew) contains only one record.
This is an attempt to change the size of the dynamic array. It is assumed that the number of records in the array will be equal to size.
This line copies one record (bar date) starting from bar number 0 into the Tnew array. This date then becomes available as Tnew[0] (because the array is numbered with ZERO).
Here, the only record of array Tnew is compared to record numbered Number-1 in a cell of array Told (remember, the array is numbered from 0).
If these dates do not match, we write the value of Tnew array to the cell of Told array.
I haven't found any description of response codes (Retcode) for the structure of MqlTradeCheckResult trade request check results in the documentation. Will they be available?
In the file MetaTrader 5\MQL5\Include\ErrorDescription.mqh
I have a question. Is the issue of graphics without holes not being considered ? https://www.mql5.com/ru/forum/100491
Very difficult to synchronise everything, I seem to have tried to account for everything in the indicator, but these holes are very difficult to deal with
2010.07.19 02:20:12 Checking of holes (EURUSD,M1) Number of holes in history 260 from the date 2010.07.09 21:35:00
2010.07.19 02:20:12 Checking of holes (EURUSD,M1) GBPUSD hole 2010.07.19 00:20:00
2010.07.19 02:20:12 Checking Holes (EURUSD,M1) Hole USDJPY 2010.07.19 00:15:00
2010.07.19 02:20:12 Hole Checking (EURUSD,M1) Hole EURGBP 2010.07.16 22:43:00
2010.07.19 02:20:12 Checking Holes (EURUSD,M1) GBPUSD Hole 2010.07.16 22:43:00
2010.07.19 02:20:12 Checking Holes (EURUSD,M1) GBPUSD Hole 2010.07.16 22:38:00
2010.07.19 02:20:12 Checking Holes (EURUSD,M1) AUDUSD Hole 2010.07.16 22:21:00
etc.....
and second question: are there any other pitfalls in this multicurrency indicator which I haven't checked?