Bug of HistorySelect()

 

Run the script:

void OnStart()
{
HistorySelect(0,TimeCurrent());
Print(HistoryDealsTotal()," ",HistoryOrdersTotal());

}
then you do some deals, and  "History" tab can't refresh automatically after run the script.
 

And you can't use HistoryDealSelect() for new deals after run the script.

 

version:5.00 build 298

 

Is there anyone could answer?

 
If you had gone to History tab and set Custom period from ... to yesterday (for example) you would have got the same behaviour.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events - Documentation on MQL5
 
alexvd:
If you had gone to History tab and set Custom period from ... to yesterday (for example) you would have got the same behaviour.
So, is there any function like "All history" in Mql5?
 
song_song:
So, is there any function like "All history" in Mql5?

Use

HistorySelect(0,TimeCurrent());
 

THere is still a bug in HistorySelect:

If you cycle programmatically over all History orders in OnTrade, you mostly get a new history order once a position has been open

but not every time and this is a bug or not ? I mean open a position should be reflected by a history order..= 


 The code:

 

OnTrade 

HistorySelect( last_select_offset ,TimeCurrent());

   for(uint i=0;i< HistoryOrdersTotal() ;i++)

   {

// ...do record history order

  } 

  // new offset time

  last_select_offset= last_select_offset

 }


 

So the code above should detect ALL history orders since script has been attached but sometimes new history orders missing.

Please MQL5 time, have a look on it. Thank you. 

Documentation on MQL5: Trade Functions / HistorySelect
  • www.mql5.com
Trade Functions / HistorySelect - Documentation on MQL5
 
Please see my answer at https://www.mql5.com/en/forum/6662. I'm strongly sure that both questions have the same reason.
HistorySelect works not properly
  • www.mql5.com
HistorySelect works not properly.
Reason: