Discussion of article "Controlling the Slope of Balance Curve During Work of an Expert Advisor" - page 5

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Let's see how much these changes can affect the EA
So far, nothing has fundamentally changed. The same discrepancy in the results of simultaneous runs on all pairs. I will dig further.
That is, it turns out that the list of deals is absolutely the same in any testing mode - both for all pairs and when testing only one pair. Only the moments of balance control switching do not coincide?
Yes.
This is what I have already found today.
I went into the includnik and started to put prints in interesting places. And this is what I found out when running more than one pair. Usually the data is more or less adequate, but sometimes individual data from the array fly to the sky. Where can this happen from? Below is the variant of work with the parameter of transactions equal to 15:
2012.08.08 15:03:00 this.group_result_array[0]=3.105036941761521e+231
ER 0 Core 1 12:09:30 2012.08.08 08 15:03:00 this.group_result_array[1]=497.9999999999999
JG 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[2]=-1447.0
ON 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[3]=-75.0
ND 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[4]=-1173.0
DH 0 Core 1 12:09:30 2012.08.08 15:03:00 this.group_result_array[5]=4697.0
GS 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[6]=-56.99999999999999
DD 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[7]=187.0
JH 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[8]=-914.0
HQ 0 Core 1 12:09:30 2012.08.08 15:03:00 this.group_result_array[9]=-982.0
MJ 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[10]=805.0
GL 0 Core 1 12:09:30 2012.08.08 15:03:00 this.group_result_array[11]=385.0
ID 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.group_result_array[12]=-798.0
DJ 0 Core 1 12:09:30 2012.08.08 15:03:00 this.group_result_array[13]=1561.0
FR 0 Core 1 12:09:30 2012.08.08.08 15:03:00 X[0]=22183803.0 Y[0]=1561.0
FH 0 Core 1 12:09:30 2012.08.08 15:03:00 X[1]=22186960.0 Y[1]=763.0
GL 0 Core 1 12:09:30 2012.08.08.08 15:03:00 X[2]=22197303.0 Y[2]=1148.0
RE 0 Core 1 12:09:30 2012.08.08 15:03:00 X[3]=22207443.0 Y[3]=1953.0
OM 0 Core 1 12:09:30 2012.08.08.08 15:03:00 X[4]=22212063.0 Y[4]=971.0
MG 0 Core 1 12:09:30 2012.08.08.08 15:03:00 X[5]=22225383.0 Y[5]=57.0
FK 0 Core 1 12:09:30 2012.08.08 15:03:00 X[6]=22248723.0 Y[6]=244.0
QR 0 Core 1 12:09:30 2012.08.08 08 15:03:00 X[7]=22265943.0 Y[7]=187.0
MJ 0 Core 1 12:09:30 2012.08.08 15:03:00 X[8]=22335543.0 Y[8]=4884.0
JS 0 Core 1 12:09:30 2012.08.08 15:03:00 X[9]=22338363.0 Y[9]=3711.0
JD 0 Core 1 12:09:30 2012.08.08 15:03:00 X[10]=22349163.0 Y[10]=3636.0
OM 0 Core 1 12:09:30 2012.08.08 15:03:00 X[11]=22358283.0 Y[11]=2189.0
FF 0 Core 1 12:09:30 2012.08.08 15:03:00 X[12]=22400283.0 Y[12]=2687.0
GS 0 Core 1 12:09:30 2012.08.08 15:03:00 X[13]=22407303.0 Y[13]=3.105036941761521e+231
NL 0 Core 1 12:09:30 2012.08.08.08 15:03:00 var_0=3.960436915196813e+236 var_1=86864140528.35715
RD 0 Core 1 12:09:30 2012.08.08.08 15:03:00 this.current_slope=4.559346228613075e+225
By the way, I just found the above effect when testing on one of the pairs. It seems that somewhere something is not zeroed or accesses the area with already existing incorrect data. How can this be detected and eliminated? I guess we need to tighten the control of data coming into the arrays. How to do it?
2012.05.31 14:41:59 this.group_result_array[0]=-279.9
PF 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[1]=-275.4
MH 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[2]=-302.5
OQ 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[3]=-281.4999999999999
PE 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[4]=-274.4
QN 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[5]=-323.9999999999999
LL 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[6]=1.61390681602331e+116
QE 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[7]=-249.0
PO 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[8]=-249.0
CQ 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[9]=-250.0
OI 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[10]=-249.0
RO 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[11]=-249.0
ME 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[12]=-249.0
DK 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[13]=-250.0
CQ 0 Core 1 12:48:50 2012.05.31 14:41:59 this.group_result_array[14]=-249.0
IE 0 Core 1 12:48:50 2012.05.31 14:41:59 X[0]=22193876.0 Y[0]=-249.0
NL 0 Core 1 12:48:50 2012.05.31 14:41:59 X[1]=22194448.0 Y[1]=-499.0
JG 0 Core 1 12:48:50 2012.05.31 14:41:59 X[2]=22194812.0 Y[2]=-748.0
PN 0 Core 1 12:48:50 2012.05.31 14:41:59 X[3]=22195279.0 Y[3]=-997.0
CR 0 Core 1 12:48:50 2012.05.31 14:41:59 X[4]=22195447.0 Y[4]=-1246.0
LK 0 Core 1 12:48:50 2012.05.31 14:41:59 X[5]=22195632.0 Y[5]=-1496.0
MP 0 Core 1 12:48:50 2012.05.31 14:41:59 X[6]=22196242.0 Y[6]=-1745.0
OI 0 Core 1 12:48:50 2012.05.31 14:41:59 X[7]=22196301.0 Y[7]=-1994.0
PS 0 Core 1 12:48:50 2012.05.31 14:41:59 X[8]=22269123.0 Y[8]=1.61390681602331e+116
DH 0 Core 1 12:48:50 2012.05.31 14:41:59 X[9]=22276026.0 Y[9]=1.61390681602331e+116
HE 0 Core 1 12:48:50 2012.05.31 14:41:59 X[10]=22276174.0 Y[10]=1.61390681602331e+116
QR 0 Core 1 12:48:50 2012.05.31 14:41:59 X[11]=22287959.0 Y[11]=1.61390681602331e+116
NO 0 Core 1 12:48:50 2012.05.31 14:41:59 X[12]=22289679.0 Y[12]=1.61390681602331e+116
DD 0 Core 1 12:48:50 2012.05.31 14:41:59 X[13]=22307227.0 Y[13]=1.61390681602331e+116
EP 0 Core 1 12:48:50 2012.05.31 14:41:59 X[14]=22307921.0 Y[14]=1.61390681602331e+116
HM 0 Core 1 12:48:50 2012.05.05.31 14:41:59 var_0=5.571865878831281e+121 var_1=33339632014.93333
HE 0 Core 1 12:48:50 2012.05.31 14:41:59 this.current_slope=1.671243964641108e+111
By the way, I just found the above effect when testing on one of the pairs. It seems that somewhere something is not zeroed or accesses the area with already existing incorrect data. How can this be detected and eliminated? I guess we need to tighten the control of data coming into the arrays. How do you do that?
I found a place in the includnik "where the dog is in the hole"! The sorting of the array is glitchy. I inserted the print before and after sorting:
Here's the result that popped up when testing on ONE of the pairs:
MQ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[0]=-279.9 this.org_datetime_array[0]=22307921.0
QQ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[1]=-275.4 this.org_datetime_array[1]=22307227.0
QR 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[2]=-302.5 this.org_datetime_array[2]=22289679.0
QR 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[3]=-281.4999999999999 this.org_datetime_array[3]=22287959.0
PQ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[4]=-274.4 this.org_datetime_array[4]=22276174.0
PR 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[5]=-323.9999999999999 this.org_datetime_array[5]=22276026.0
IP 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[6]=5354.0 this.org_datetime_array[6]=22269123.0
MQ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[7]=-249.0 this.org_datetime_array[7]=22196301.0
GR 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[8]=-249.0 this.org_datetime_array[8]=22196242.0
GR 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[9]=-250.0 this.org_datetime_array[9]=22195632.0
GS 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[10]=-249.0 this.org_datetime_array[10]=22195447.0
NS 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[11]=-249.0 this.org_datetime_array[11]=22195279.0
DS 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[12]=-249.0 this.org_datetime_array[12]=22194812.0
QS 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[13]=-250.0 this.org_datetime_array[13]=22194448.0
OL 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[14]=-249.0 this.org_datetime_array[14]=22193876.0
OL 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[15]=-315.0 this.org_datetime_array[15]=22188593.0
EL 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[16]=-249.0 this.org_datetime_array[16]=22188401.0
LL 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[17]=-249.0 this.org_datetime_array[17]=22188390.0
KM 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[18]=-318.0 this.org_datetime_array[18]=22178692.0
NM 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[19]=-250.0 this.org_datetime_array[19]=22171680.0
QM 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[20]=-249.0 this.org_datetime_array[20]=22168711.0
OM 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[21]=-250.0 this.org_datetime_array[21]=22168595.0
KN 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[22]=-248.9 this.org_datetime_array[22]=22168313.0
CN 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[23]=-249.5 this.org_datetime_array[23]=22167843.0
PN 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[24]=-249.0 this.org_datetime_array[24]=22165238.0
FN 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[25]=-249.6 this.org_datetime_array[25]=22165036.0
MO 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[26]=-271.0 this.org_datetime_array[26]=22164783.0
GO 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[27]=-256.0 this.org_datetime_array[27]=22161600.0
QO 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[28]=-249.0 this.org_datetime_array[28]=22158602.0
OO 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[29]=-250.0 this.org_datetime_array[29]=22158129.0
PH 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[30]=-249.0 this.org_datetime_array[30]=22157426.0
MH 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[31]=-249.0 this.org_datetime_array[31]=22156983.0
KH 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[32]=-249.0 this.org_datetime_array[32]=22156408.0
FH 0 Core 1 13:48:51 2012.05.05.31 14:41:59 BEFORE SORTING org_result_array[33]=-249.0 this.org_datetime_array[33]=22154526.0
EI 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[34]=-249.0 this.org_datetime_array[34]=22153931.0
PI 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[35]=-271.0 this.org_datetime_array[35]=22153579.0
MH 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[36]=2387.0 this.org_datetime_array[36]=22153263.0
KI 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[37]=-274.0 this.org_datetime_array[37]=22135056.0
DJ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[38]=-273.0 this.org_datetime_array[38]=22132446.0
FJ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[39]=-277.0 this.org_datetime_array[39]=22132307.0
DJ 0 Core 1 13:48:51 2012.05.31 14:41:59 BEFORE SORTING org_result_array[40]=-597.0 this.org_datetime_array[40]=22093229.0
NG 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[0]=-279.9 this.org_datetime_array[0]=22307921.0
DF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[1]=-275.4 this.org_datetime_array[1]=22307227.0
FI 0 FI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[2]=-302.5 this.org_datetime_array[2]=22289679.0
HI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[3]=-281.4999999999999 this.org_datetime_array[3]=22287959.0
GF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[4]=-274.4 this.org_datetime_array[4]=22276174.0
MI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[5]=-323.9999999999999 this.org_datetime_array[5]=22276026.0
FG 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[6]=5354.0 this.org_datetime_array[6]=22269123.0
GG 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[7]=1.61390681602331e+116 this.org_datetime_array[7]=22269123.0
PF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[8]=-249.0 this.org_datetime_array[8]=22196301.0
PK 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[9]=7.86951818189098558e-151 this.org_datetime_array[9]=22196301.0
RG 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[10]=-249.0 this.org_datetime_array[10]=22196242.0
LG 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[11]=-250.0 this.org_datetime_array[11]=22195632.0
NF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[12]=-249.0 this.org_datetime_array[12]=22195447.0
IF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[13]=-249.0 this.org_datetime_array[13]=22195279.0
MF 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[14]=-249.0 this.org_datetime_array[14]=22194812.0
RI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[15]=-250.0 this.org_datetime_array[15]=22194448.0
NI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[16]=-249.0 this.org_datetime_array[16]=22193876.0
LI 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[17]=-315.0 this.org_datetime_array[17]=22188593.0
DH 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[18]=-249.0 this.org_datetime_array[18]=22188401.0
CH 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[19]=-249.0 this.org_datetime_array[19]=22188390.0
JK 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[20]=-318.0 this.org_datetime_array[20]=22178692.0
IK 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[21]=-250.0 this.org_datetime_array[21]=22171680.0
HK 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[22]=-249.0 this.org_datetime_array[22]=22168711.0
PJ 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[23]=-250.0 this.org_datetime_array[23]=22168595.0
RJ 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[24]=-248.9 this.org_datetime_array[24]=22168313.0
HJ 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[25]=-249.5 this.org_datetime_array[25]=22167843.0
QM 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[26]=-249.0 this.org_datetime_array[26]=22165238.0
MM 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[27]=-249.6 this.org_datetime_array[27]=22165036.0
HL 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[28]=-271.0 this.org_datetime_array[28]=22164783.0
LL 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[29]=-256.0 this.org_datetime_array[29]=22161600.0
HL 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[30]=-249.0 this.org_datetime_array[30]=22158602.0
PO 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[31]=-250.0 this.org_datetime_array[31]=22158129.0
MO 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[32]=-249.0 this.org_datetime_array[32]=22157426.0
RO 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[33]=-249.0 this.org_datetime_array[33]=22156983.0
NN 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[34]=-249.0 this.org_datetime_array[34]=22156408.0
MN 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[35]=-249.0 this.org_datetime_array[35]=22154526.0
PQ 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[36]=-249.0 this.org_datetime_array[36]=22153931.0
CQ 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[37]=-271.0 this.org_datetime_array[37]=22153579.0
DP 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[38]=2387.0 this.org_datetime_array[38]=22153263.0
LP 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[39]=-274.0 this.org_datetime_array[39]=22135056.0
IP 0 Core 1 13:48:51 2012.05.31 14:41:59 AFTER SORTING org_result_array[40]=-273.0 this.org_datetime_array[40]=22132446.0
YAY!!! I have defeated the problem! The problem was incorrect transfer of the array as an object element by reference to the sorting function.
If you first copy the object array into a regular array and then transfer this temporary array to the sorting function, no unexpected glitches occur. The data in the arrays do not fly to the sky and all lot switches coincide. Also, the final balance on a joint run of currency pairs coincides almost completely (the differences are microscopic).
Below are the results of the tests and the code I use to eliminate the glitch. (Note that the current data is different, even on single runs on the first pair, from the data that was obtained before the code fix -
solandr 2012.09.26 23:16 2012.09.26 23:16:04 # )
With lot control enabled
34 0 0 0 6487.33 first pair
0 36 0 5556.60 second pair
0 0 0 168 4374.44 third pair
34 36 168 16418.47 all three pairs
sum of balance on three pairs 16418.37 (Difference with joint run 0.1)
With lot control switched off
0 0 0 0 6702.44 first pair
0 0 0 0 5742.89 second pair
0 0 0 0 4358.22 third pair
0 0 0 0 16804.53 all three pairs
sum of balance on three pairs 16803.55 (Difference with the joint run 0.98).
Please change the includnik in the article, so that other people don't rack their brains for days with divergent tests. Thanks!
IMHO, you should write to service-desk instead of changing the includer.
It should not be like this. And unnecessary copying is unnecessary, from all points of view. And in general, you are good!
Give yourself a plus rating via service-desk)))
Message for MQ team:
Dear MT5 developers, I would like to draw your attention to some unexpected problem detected during testing on MT5 Build 695 (6 Sep 2012, Championship Terminal-2012, Account: 1101505, Server: MetaQuotes-Demo) running under Windows 7 Enterprise (licensed, English). The problem is inexplicable distortion of data (array as an object element) passed by reference to the sorting function.
Attached are the sources of ORIGINAL (with an error) and CORRECTED (without an error) source codes, as well as log files of the Expert Advisor's work, demonstrating the work of both code variants. The error with data distortion is stably reproduced under the same specified testing conditions. Please pay attention to the logs for 2012.02.24 08:03:40 (array data are mixed up) and 2012.05.31 14:41:59 (data "flew to the sky").
Thank you!
Message to the MQ team:
Dear MT5 developers, I would like to draw your attention to some unexpected problem detected during testing on MT5 Build 695 (6 Sep 2012, Championship Terminal-2012, Account: 1101505, Server: MetaQuotes-Demo) running under Windows 7 Enterprise (licensed, English). The problem is unexplained distortion of data (array as an object element) passed by reference to the sorting function.
Attached are the sources of ORIGINAL (with an error) and CORRECTED (without an error) source codes, as well as log files of the Expert Advisor's work, demonstrating the work of both code variants. The error with data distortion is stably reproduced under the same specified testing conditions. Please, pay attention to the logs for 2012.02.24 08:03:40 (array data are mixed up) and 2012.05.31 14:41:59 (data "flew to the sky").
Thank you!
Error on the user side in the GetTradeResultsArray function.
A dynamic array with X data is prepared, but it is filled with N (N<X), for example, if there is a deal with "alien" magic.
Before sorting, N data are output, but X is involved in sorting, of course X-N data are random numbers in memory.
Depending on the value, they are "raised" during sorting and output after sorting to the log.
Solution:
1) "Trim" the array after filling to N
2) Pass N to the sort function
3) Initialise the array X with obviously big/small data, which will be left "overboard" after sorting.