23 October 2015
Red orders? We'll turn them green for you. Profits go to your bank card first — we'll split them afterward. No upfront payment, no account access required. 🟢 WhatsApp ⚪ Telegram
23 October 2015


2015.10.14 14:48:18.486 Data Folder: C:\Program Files\MetaTrader 5 2015.10.14 14:48:18.486 Windows 7 Professional (x64 based PC), IE 11.00, UAC, 8 x Intel Core i7 920 @ 2.67GHz, RAM: 8116 / 12277 Mb, HDD: 534262 / 753865 Mb, GMT+03:00 2015.10.14 14:48:18.486 MetaTrader 5 build 1190 started (MetaQuotes Software Corp.)




struct MqlTick { datetime time; // Time of a price last update double bid; // Current Bid price double ask; // Current Ask price double last; // Current Last price ulong volume; // Volume for the current Last price long time_msc; // Time of a price last update in milliseconds uint flags; // Tick flags };The parameters of each tick are filled in regardless of whether there are changes compared to the previous tick. Thus, it is possible to find out a correct price for any moment in the past without the need to search for previous values at the tick history. For example, even if only a Bid price changes during a tick arrival, the structure still contains other parameters as well, including the previous Ask price, volume, etc. You can analyze the tick flags to find out what data have been changed exactly:
//+------------------------------------------------------------------+ //| TemplTest.mq5 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mt5.info | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mt5.info" #property version "1.00" //+------------------------------------------------------------------+ //| Declare a template class | //+------------------------------------------------------------------+ template<typename T> class TArray { protected: T m_data[]; public: bool Append(T item) { int new_size=ArraySize(m_data)+1; int reserve =(new_size/2+15)&~15; //--- if(ArrayResize(m_data,new_size,reserve)!=new_size) return(false); //--- m_data[new_size-1]=item; return(true); } T operator[](int index) { static T invalid_index; //--- if(index<0 || index>=ArraySize(m_data)) return(invalid_index); //--- return(m_data[index]); } }; //+------------------------------------------------------------------+ //| Template class of a pointer array. In the destructor, it deletes | //| the objects, the pointers to which were stored in the array. | //| | //| Please note the inheritance from the TArray template class | //+------------------------------------------------------------------+ template<typename T> class TArrayPtr : public TArray<T *> { public: void ~TArrayPtr() { for(int n=0,count=ArraySize(m_data);n<count;n++) if(CheckPointer(m_data[n])==POINTER_DYNAMIC) delete m_data[n]; } }; //+--------------------------------------------------------------------------+ //| Declare the class. Pointers to its objects will be stored in the array | //+--------------------------------------------------------------------------+ class CFoo { int m_x; public: CFoo(int x):m_x(x) { } int X(void) const { return(m_x); } }; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ TArray<int> ExtIntArray; // instantiate TArray (specialize TArray by the int type) TArray<double> ExtDblArray; // instantiate TArray (specialize TArray by the double type) TArrayPtr<CFoo> ExtPtrArray; // instantiate TArrayPtr (specialize TArrayPtr by the CFoo type) //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- fill arrays with data for(int i=0;i<10;i++) { int integer=i+10; ExtIntArray.Append(integer); double dbl=i+20.0; ExtDblArray.Append(dbl); CFoo *ptr=new CFoo(i+30); ExtPtrArray.Append(ptr); } //--- output the array contents string str="Int:"; for(int i=0;i<10;i++) str+=" "+(string)ExtIntArray[i]; Print(str); str="Dbl:"; for(int i=0;i<10;i++) str+=" "+DoubleToString(ExtDblArray[i],1); Print(str); str="Ptr:"; for(int i=0;i<10;i++) str+=" "+(string)ExtPtrArray[i].X(); Print(str); //--- CFoo objects created via new should not be deleted, since they are deleted in the TArrayPtr<CFoo> object destructor }Execution result:
int ObjectsDeleteAll( long chart_id, // chart ID const string prefix, // object name prefix int sub_window=-1, // window index int object_type=-1 // object type for deletion );

Updated documentation.