struct Pair { int x, y; Pair(int a, int b): x(a), y(b) { } };Then we can use the coordinates field of the new type Pair instead of the two integer fields x and y in the Shape class. This construction of objects is called inclusion or compositional aggregation. The Pair ...
struct st01 011. { 012. MqlRates Rate[1]; 013. datetime memDT; 014. }m_MountBar; 015. struct st02 016. { 017. bool bInit; 018. double PointsPerTick; 019. MqlTick tick[1]; 020. }m_Infos; 021. //+---+ 022. void AdjustPositionToReplay(const bool bViewBuider) 023. { 024...
struct TrComPortParameters { uint DesiredParams; int BaudRate; // Data rate int DefaultTimeout; // Default timeout (in milliseconds) uchar ByteSize; // Data size(4-8) uchar StopBits; // Number of stop bits uchar CheckParity; // Parity check(0-no,1-yes) uchar Parity; // Parity ty...
Let's say we have an application structureData(DBmetaProgramming.mq5). structData { longid; stringname; datetimetimestamp; doubleincome; }; We can make its analog inherited fromDBEntity<DataDB>, but with substituted fields based onDBField, identical to the original set. structDataDB:publicDB...
struct MqlTradeRequestSync: public MqlTradeRequest { ... static bool AsyncEnabled; ... private: bool orderSend(const MqlTradeRequest &req, MqlTradeResult &res) { return AsyncEnabled ? ::OrderSendAsync(req, res) : ::OrderSend(req, res); } };...
structMqlRates { datetimetime;// Period start time doubleopen;// Open price doublehigh;// The highest price of the period doublelow;// The lowest price of the period doubleclose;// Close price longtick_volume;// Tick volume intspread;// Spread ...
structABC { intx; ABC() { x=rand(); } booloperator>(constABC&other)const { returnx>other.x; } }; voidOnStart() { ... ABCabc[10]; QuickSort(abc); ArrayPrint(abc); /* Sample output: [x] [0]1210 [1]2458 [2]10816
StructPrint(result,ARRAYPRINT_HEADER,2); ... The output of structures is provided by a helper functionStructPrintwhich is based onArrayPrint. Because of this, we will still get a "raw" display of data. In particular, the elements of enumerations are represented by numbers "as is". Later...
structtranslate{stringerr1;stringerr2;// ... other strings}; translate langs; We already have the variable containing the strings. Although, there are no strings there yet. Create the function that fills it with strings in the language selected in theLanguageinput. Let's name the functioninit...
Initialization | //+---+ void CLogger::init(void) { string path; MqlDateTime date; int i=0; TimeToStruct(TimeCurrent(),date); // Get current time StringConcatenate(path,"log\\log_",project,"\\log_",file,"_", date.year,date.mon,date.day); // Generate path and file name handle...