Download MetaTrader 5
To add comments, please log in or register
Looking for like-minded people? You will find lots of them on the Forum!
Jinsong Zhang
15031
Jinsong Zhang 2010.07.29 12:04 

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.
Jinsong Zhang
15031
Jinsong Zhang 2010.07.29 12:12  

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

Jinsong Zhang
15031
Jinsong Zhang 2010.07.29 12:18  

version:5.00 build 298

Jinsong Zhang
15031
Jinsong Zhang 2010.07.30 06:12  

Is there anyone could answer?

Alexey Da
Moderator
6511
Alexey Da 2010.07.30 10:14  
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
Jinsong Zhang
15031
Jinsong Zhang 2010.07.31 06:08  
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?
Rashid Umarov
Admin
11560
Rashid Umarov 2010.07.31 07:38  
song_song:
So, is there any function like "All history" in Mql5?

Use

HistorySelect(0,TimeCurrent());
chinaski
836
chinaski 2012.05.04 14:37  

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
Rashid Umarov
Admin
11560
Rashid Umarov 2012.05.07 17:35  
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.
/
To add comments, please log in or register