Interesting: Most likely they are. I have half of my code tied to a timer too, now I have to wait for a new build or come up with crutches :(
Exactly, just changed OnTimer to OnTick and everything went as before, but optimization by cores is performed one by one, not simultaneously. It seems to me that developers will fix such obvious errors quickly (I hope).
Exactly, just changed OnTimer to OnTick and everything went as before, but optimization by cores is performed one by one, not simultaneously. It seems to me that developers will fix such obvious errors quickly (I hope).
I also thought that obvious bugs (tester work) on custom events would be fixed quickly. Still have to use crutches... :(
Valmars: In my case, it didn't help.
There must be some peculiarities.
I tried it on Win 2003 Server SP2 x32 (AMD 2600+, one core). And I may say it was done on an "empty" Expert Advisor. Only two variables and a couple of functions were added (those defining timer state and catching the first start).
In the Championship 2010 discussion https://championship.mql5.com/2010/ru/users/capr, a participant posted his EA code. Tried to compile it (build 355). The compilation results show several warnings. I am interested in the following fragment. There is such a fragment in the code:
void CountOrderStop(string symbol)
{
datetime from=0;
datetime to=TimeCurrent();
//--- запросить всю историюHistorySelect(from,to);
//--- переменные для получения значений из свойств ордераulong ticket;
double open_price;
double initial_volume;
datetime time_setup;
// string symbol;string type;
long order_magic;
count_sell_stop=0;
count_buy_stop=0;
//--- количество текущих отложенных ордеровuint total=OrdersTotal();
//--- пройдем в цикле по всем ордерамfor(uint i=0;i<total;i++)
{
//--- получим тикет ордера по его позиции в спискеif(ticket=OrderGetTicket(i) && (GetOrderType(OrderGetInteger(ORDER_TYPE))=="buy stop limit" || GetOrderType(OrderGetInteger(ORDER_TYPE))=="buy stop" || GetOrderType(OrderGetInteger(ORDER_TYPE))=="buy limit") && OrderGetString(ORDER_SYMBOL)==symbol)
{
//--- получим свойства ордера
open_price= OrderGetDouble(ORDER_PRICE_OPEN);
time_setup= OrderGetInteger(ORDER_TIME_SETUP);
symbol= OrderGetString(ORDER_SYMBOL);
order_magic= OrderGetInteger(ORDER_MAGIC);
int positionID = OrderGetInteger(ORDER_POSITION_ID);
initial_volume= OrderGetDouble(ORDER_VOLUME_INITIAL);
type=GetOrderType(OrderGetInteger(ORDER_TYPE));
count_buy_stop=count_buy_stop+1;
}
if(ticket=OrderGetTicket(i) && (GetOrderType(OrderGetInteger(ORDER_TYPE))=="sell stop limit" || GetOrderType(OrderGetInteger(ORDER_TYPE))=="sell limit" || GetOrderType(OrderGetInteger(ORDER_TYPE))=="sell stop") && OrderGetString(ORDER_SYMBOL)==symbol)
{
//--- получим свойства ордера
open_price= OrderGetDouble(ORDER_PRICE_OPEN);
time_setup= OrderGetInteger(ORDER_TIME_SETUP);
symbol= OrderGetString(ORDER_SYMBOL);
order_magic= OrderGetInteger(ORDER_MAGIC);
int positionID = OrderGetInteger(ORDER_POSITION_ID);
initial_volume= OrderGetDouble(ORDER_VOLUME_INITIAL);
type=GetOrderType(OrderGetInteger(ORDER_TYPE));
count_sell_stop=count_sell_stop+1;
}
count_order = count_buy_stop + count_sell_stop;
}
//---
}
Of two constructions of the same type if(ticket= ... the compiler generates the "expression is not boolean" warning only for the last one (i.e. it "masks" a similar previous warning). If you comment out the if statement in the warning (for the purpose of checking the compiler!), the warning is generated for a similar construct which hasn't been changed but was absent in the protocol during the previous compilation.
I don't know if it's supposed to be that way, but when writing to a file
class tick{
public:
MqlTick data; //новые тиковые данныеbool refresh(); //метод обновления тиковых данных с проверкой на поступление новых данныхvoid write(); //запись тиковых данных в файл
.........
void tick::write(void){
if (file_handle>0)FileWrite(file_handle,data.bid);
}
Everything seems to be clear about the non-normalized price: I have not seen it for major events (so far), for crosses - for some events rarely, and for others more often - it means that the terminal gives me such data
Writes arrays of any type to a BIN type file, except for string arrays (can be an array of structures not containing strings and dynamic arrays).
intFileWriteArray( intfile_handle,//file handle voidarray[],// array intstart_item=0,// initial index in the array intitems_count=WHOLE_ARRAY// number of elements );
For example (the code should be updated to avoid overwriting existing records):
//+------------------------------------------------------------------+//| Test_FileWriteStruct.mq5 |//| Copyright 2010, MetaQuotes Software Corp. |//| http://www.mql5.com |//+------------------------------------------------------------------+#property copyright "Copyright 2010, MetaQuotes Software Corp."#property link "http://www.mql5.com"#property version "1.00"//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+class Tick
{
private:
int m_file_handle;
public:
MqlTick data; //новые тиковые данныеvoid Tick(){m_file_handle=FileOpen("tickrecords.dat",FILE_READ|FILE_WRITE|FILE_BIN);};
void ~Tick(){if(m_file_handle!=INVALID_HANDLE) FileClose(m_file_handle);};
bool refresh(); //метод обновления тиковых данных с проверкой на поступление новых данныхvoid write(); //запись тиковых данных в файл
};
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+bool Tick::refresh(void)
{
bool res=SymbolInfoTick(Symbol(),data);
if(!res) Print("Неудачный вызов SymbolInfoTick(), ошибка ",GetLastError());
return(res);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+void Tick::write(void)
{
if(m_file_handle!=INVALID_HANDLE)FileWriteStruct(m_file_handle,data,size);
elsePrint("Не удалось записать данные в файл. Ошибка ",GetLastError());
}
Tick tick;
//+------------------------------------------------------------------+//| Expert tick function |//+------------------------------------------------------------------+voidOnTick()
{
//---if(tick.refresh()) tick.write();
}
//+------------------------------------------------------------------+
For example (the code needs to be improved, so it doesn't overwrite already existing records):
OK, thank you very much, I was just writing to a text file for testing, I was beginning to doubt how MqlTick is essentially a structure :)
ZS: not bad - basically restored my class and code ;) - i am sorry, that you don't want to create your own offline charts in MT5 - i am writing for MT4+MT5, i got addicted to non-standard TF
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.
Most likely they are. I have half of my code tied to a timer too, now I have to wait for a new build or come up with crutches :(
Exactly, just changed OnTimer to OnTick and everything went as before, but optimization by cores is performed one by one, not simultaneously. It seems to me that developers will fix such obvious errors quickly (I hope).
This code does not trigger the timer
But this one does.
Exactly, just changed OnTimer to OnTick and everything went as before, but optimization by cores is performed one by one, not simultaneously. It seems to me that developers will fix such obvious errors quickly (I hope).
In my case, it didn't help.
There must be some peculiarities.
I tried it on Win 2003 Server SP2 x32 (AMD 2600+, one core). And I may say it was done on an "empty" Expert Advisor. Only two variables and a couple of functions were added (those defining timer state and catching the first start).
Where did code 10005 go and what does it mean ?
Something in between a requote (10004) and "request rejected" (10006) ?
In the Championship 2010 discussion https://championship.mql5.com/2010/ru/users/capr, a participant posted his EA code. Tried to compile it (build 355). The compilation results show several warnings. I am interested in the following fragment. There is such a fragment in the code:
Of two constructions of the same type if(ticket= ... the compiler generates the "expression is not boolean" warning only for the last one (i.e. it "masks" a similar previous warning). If you comment out the if statement in the warning (for the purpose of checking the compiler!), the warning is generated for a similar construct which hasn't been changed but was absent in the protocol during the previous compilation.
Is this a feature or a bug?
Errors, MetaTrader 5 MQL, Opened, Started: 2010.11.06 11:32, #25823
Give me an answer
I don't know if it's supposed to be that way, but when writing to a file
I sometimes get non-normalized prices:
81.42
81.41
81.41
81.40000000000001
81.40000000000001
81.40000000000001
81.40000000000001
81.41
81.40000000000001
81.41
81.41
why?
and for some reason couldn't write to file using FileWriteStruct( file_handle,data, sizeof(data));
and for some reason could not write to the file using FileWriteStruct( file_handle,data, sizeof(data));
I need to write into a binary file - https://www.mql5.com/ru/docs/files/filewritearray
FileWriteArray
Writes arrays of any type to a BIN type file, except for string arrays (can be an array of structures not containing strings and dynamic arrays).
intFileWriteArray(
intfile_handle,//file handle
voidarray[],// array
intstart_item=0,// initial index in the array
intitems_count=WHOLE_ARRAY// number of elements
);
For example (the code should be updated to avoid overwriting existing records):
You need to write to a binary file - https://www.mql5.com/ru/docs/files/filewritearray
For example (the code needs to be improved, so it doesn't overwrite already existing records):
OK, thank you very much, I was just writing to a text file for testing, I was beginning to doubt how MqlTick is essentially a structure :)
ZS: not bad - basically restored my class and code ;) - i am sorry, that you don't want to create your own offline charts in MT5 - i am writing for MT4+MT5, i got addicted to non-standard TF