Libraries: TradeTransactions - page 6

 
Greetings all, I came here by a footnote from the topic "Typical errors and ways to eliminate them when working with the trading environment".

I would like to use the library and approach to calculate "my" positions after sending market orders sent asynchronously.
Most examples and discussions do not take into account the situation when trading takes place on accounts where other Expert Advisors are working in parallel, and accordingly all Events and OnTradeTransaction results are common.
Will this logic work on HEDGING accounts with other EAs. In particular, if the experts will trade on the same instrument, but with their own magician?
Will this library work with a multicurrency Expert Advisor that opens trades on different instruments from the set one?
 
Sergey Genikhov:
Will this library work with a multicurrency Expert Advisor that opens trades on different instruments from the set one?

It will.

 
Remind me, please, I think I have already corrected a similar error, but I came across it again and lost a lot of hours. It seems that in Convert.mqh the size of the target array is reduced. I needed to put the uchar[39] array into the resource, but in the ArrayToStruct function the receiver of uint[] type is stubbornly considered to be of size 9, i.e. the last 3 characters are missing.
 
Stanislav Korotky:
Remind me, please, I think I have already corrected a similar error, but I came across it again and lost a lot of hours. It seems that in Convert.mqh the size of the target array is reduced. I should have put the uchar[39] array into the resource, but the ArrayToStruct function persistently considers the receiver of uint[] type as size 9, i.e. the last 3 characters are missing.

Yes, it is cut off. Try this

    const int SizeTarget = ::ArrayResize(Dst_Array, SizeSource * sizeof(SOURCE) / sizeof(TARGET) +
                                                    (bool)(SizeSource * sizeof(SOURCE) % sizeof(TARGET)));
 

According to MQ recommendations, in the ResourceData file, in the GetFullName method the TERMINAL_DATA_PATH constant should be used instead of TERMINAL_PATH.

Both paths are the same for me, despite the fact that the terminal is launched without portable mode (apparently because UAC is disabled and I have write permissions to Programme Files). But if you connect via RDP, all sources are taken from Roaming. Many users probably have all sources in TERMINAL_DATA_PATH (different from TERMINAL_PATH) by default.

 
Stanislav Korotky:

Based on MQ's recommendations, in the ResourceData file, the GetFullName method should use the TERMINAL_DATA_PATH constant instead of TERMINAL_PATH.

I guess so. I use portable, so I didn't pay attention. These codes are used by units. Like you, users have long ago corrected the paths to the right ones.

It's hard to do KB support, the work list has become thick.

 
fxsaber:

Yes, it's cropped. Try this

I made alignment (addition) by 4 bytes in my calling code, and I did not edit Convert.mqh - after all, it is taken from your include folder and can be overwritten, so it is better to correct it in the KB (by the way, I did not really understand which project is the main one for header files Convert.mqh, Resource.mqh and ResourceData.mqh - maybe I am writing in the wrong place).

 
Stanislav Korotky:

I made alignment (addition) by 4 bytes in my calling code, and I did not edit Convert.mqh - after all, it is taken from your include folder and can be overwritten, so it is better to correct it in the KB (by the way, I did not really understand which project is the main one for header files Convert.mqh, Resource.mqh and ResourceData.mqh - maybe I am writing in the wrong place).

TradeTransactions is not used.


HistoryTicks - I can't imagine trading in MT4 without it. Probably, it should be considered as the main one. But I cannot update it in KB.

Forum on trading, automated trading systems and testing trading strategies

Libraries: HistoryTicks

fxsaber, 2020.01.09 14:43

Didn't notice that the version in KB is old. Unfortunately, there is no way to update. The KB automaton gives this
MQL4\Include\fxsaber\HistoryTicks\ArrayResize.mqh(110,14) : error 165: 'ArrayResize_Real' - function already defined and has body
MQL4\Include\fxsaber\HistoryTicks\ArrayResize.mqh(172,14) : error 165: 'ArrayResize_Real' - function already defined and has body
MQL4\Include\fxsaber\HistoryTicks\ArrayResize.mqh(110,14) : error 165: 'ArrayResize_Real' - function already defined and has body
MQL4\Include\fxsaber\HistoryTicks\ArrayResize.mqh(172,14) : error 165: 'ArrayResize_Real' - function already defined and has body
In ME everything compiles without errors.


In HistoryTicks the responsibility is orders of magnitude greater since it's real. It has been licked in practice.

 
fxsaber:

解决该错误,用 随附的 替换 Include \ fxsaber \ TradeTransactions \ Convert.mqh

const RESOURCEDATA<double>ResourceDouble("::Double_"+__FILE__);

const RESOURCEDATA<datetime>ResourceTime("::Time_"+__FILE__);

const RESOURCEDATA<string>ResourceString("::String_"+__FILE__);


'Data' - struct undefined Convert.mqh 85 49

in template 'int CONVERT::ArrayToStruct(const SOURCE&[],TARGET&[])' specified with [SOURCE=uint,TARGET=datetime] Convert.mqh 70 14
'Data' - struct undefined Convert.mqh 43 38
in template 'int CONVERT::StructToArray(const SOURCE&[],TARGET&[])' specified with [SOURCE=datetime,TARGET=uint] Convert.mqh 29 14
string cannot be used as union member Convert.mqh 11 12
in template 'int CONVERT::ArrayToStruct(const SOURCE&[],TARGET&[])' specified with [SOURCE=uint,TARGET=string] Convert.mqh 70 14
'Data' - struct undefined Convert.mqh 85 49
in template 'int CONVERT::ArrayToStruct(const SOURCE&[],TARGET&[])' specified with [SOURCE=uint,TARGET=string] Convert.mqh 70 14
string cannot be used as union member Convert.mqh 13 12
in template 'int CONVERT::StructToArray(const SOURCE&[],TARGET&[])' specified with [SOURCE=uint,TARGET=string] Convert.mqh 29 14
string cannot be used as union member Convert.mqh 13 12
in template 'int CONVERT::StructToArray(const SOURCE&[],TARGET&[])' specified with [SOURCE=uint,TARGET=string] Convert.mqh 29 14
string cannot be used as union member Convert.mqh 13 12
in template 'int CONVERT::ArrayToStruct(const SOURCE&[],TARGET&[])' specified with [SOURCE=string,TARGET=uint] Convert.mqh 70 14
'Data' - struct undefined Convert.mqh 43 38
in template 'int CONVERT::StructToArray(const SOURCE&[],TARGET&[])' specified with [SOURCE=string,TARGET=uint] Convert.mqh 29 14



Is it didn't work in MT4 build 1320 ?


 
roaddust:

Is it didn't work in MT4 build 1320 ?

Try this.