I defined a struct:
and in my EA I define a tmp-var of that:
If now the debugger is on its step by step mode comes to that line it jumps at the line of the definition of that struct and seems to to be able to leave it ...
ok, try this:
struct TradeStr {
int Magic;
string TrdCat, NwsCur, Symb, Descr, Full, OrdCmt;
};
TradeStr ArrStr[];
struct TradeVal {
double IniTgt, IniStp, LstTrl, StpLev,
IniTrl, IniLots, PTS, PIP, BuCheck, SeCheck,
BuTrl, SeTrl, BuHigh, SeLow, PrSlipp, TrdRisk,
LotStep, MinLot, MaxLot, BaseLot, MaxDD,
TckVal, TckSze, PntVal;
datetime TmeOpn, TmeHi, TmeLo;
int Magic, DIG, Mode, TrdCat,
SeTckt, BuTckt, myIdx, Slipp; // 4 bytes 32 bit
bool UseMM, UseHiLo, TrdSet; // 1 byte
};
TradeVal ArrVal[];
int OnInit()
//int init()
{
//---
int a = 1;
TradeStr tmpE;
ArrayResize(ArrVal,100);
TradeVal tmpA;
ArrayResize(ArrStr,100);
TradeStr tmpF;
//---
return(INIT_SUCCEEDED);
}
I would expect the debugger-behaviour of ArrayResize(ArrStr,100); to be the same as ArrayResize(ArrVal,100); (1 step of F11).
Gooly
ok, try this:
I would expect the debugger-behaviour of ArrayResize(ArrStr,100); to be the same as ArrayResize(ArrVal,100); (1 step of F11).
Gooly
Ok I see. The problem is that your struct with a string is automatically assigned a constructor, see documentation :
If a structure contains variables of the string type and/or object of a dynamic array, the compiler assigns an implicit constructor to such a structure. This constructor resets all the structure members of string type and correctly initializes objects of the dynamic array.
So the constructor is called for the 100 elements of your array.
You can use F10 to step over this.
I have read the reverence I think too that it this might be the reason - but despite that:
1) the explanation can't explain both: step in like into a user-function but Shift-F11 'steps' out of the user-function where ArrayResize is placed - not just the 'trap'.
2) If you accidentally have missed to step over you are trapped and Shift-F11 puts you where you don't want to be :(
Gooly
I have read the reverence I think too that it this might be the reason - but despite that:
1) the explanation can't explain both: step in like into a user-function but Shift-F11 'steps' out of the user-function where ArrayResize is placed - not just the 'trap'.
2) If you accidentally have missed to step over you are trapped and Shift-F11 puts you where you don't want to be :(
Gooly
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I defined a struct:
and in my EA I define a tmp-var of that:
If now the debugger is on its step by step mode comes to that line it jumps at the line of the definition of that struct and seems to to be able to leave it ...