Hi Guys,
See below. I am using MT4 Build 509 on an Australian Global Prime ECN broker.
1. I cannot seem to use the loop variable i as the buffer array index directly. Have to change it to something else:
Yes you can . . . unless you have i globally declared also and are messing with it in another function, probably calcCSS . . . do yourself a favour, don't use i or j or h . . . use a meaningful variable name and keep them unique, it makes finding issues easier and makes your code easier to read.
Thanks. The uniqueness suggestion I appreciate.
But still MQL4 is quite crappy: most other well used languages would not have these issues.
I did not declare i globally: to me such loop var should only be declared locally. Yes, calcCSS does have i declared
as local :(
Now any insights on #2 question?
Thanks. The uniqueness suggestion I appreciate.
But still MQL4 is quite crappy: most other well used languages would not have these issues.
I did not declare i globally: to me such loop var should only be declared locally. Yes, calcCSS does have i declared
as local :(
Now any insights on #2 question?
might be this is giving a solution
see https://www.mql5.com/en/code/7716
it takes some time before it is ready if you have a lot of historydata
but it will work
Thanks. The uniqueness suggestion I appreciate.
But still MQL4 is quite crappy: most other well used languages would not have these issues.
I did not declare i globally: to me such loop var should only be declared locally. Yes, calcCSS does have i declared
as local :(
When you say "as local" do you mean as part of the function definition or inside the function ?
Print i after . . .
shift = i;
and after . . .
calcCSS( tf, i );
and I think you will see it being changed, you need to find out why.
Now any insights on #2 question?
When you say "as local" do you mean as part of the function definition or inside the function ?
Print i after . . .
and after . . .
and I think you will see it being changed, you need to find out why.
See my point about i . . .
Well, I guess, best is that I stick to the unique var names here :)
Will apply same to the arrUSD [ i + j*maxBars] problem.
BTW, in calcCSS (tf, shift) I have int i =0 defined insides it.
PS. Had I not been misled twice by WHRoeder, first with his telling me that I need iBarShift when in fact my shift (or i) was already defined as shift on the respective TFs in calc functions using iMA, iATR and iClose, I wouldn't be messing around so much. Then, he made me beat about the bush a second time with his dismissal of EMTPY_VALUE problem, which SDC solved nicely for me. Some people are quite irresponsible here, others just fine !
might be this is giving a solution
see https://www.mql5.com/en/code/7716
it takes some time before it is ready if you have a lot of historydata
but it will work
Downloaded, will try. Thanks for the suggestion.
BTW, you are right about that crappy tonny software !!!
Please do not feed the troll.
When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.
PS. Had I not been misled twice by WHRoeder, first with his telling me that I need iBarShift when in fact my shift (or i) was already defined as shift on the respective TFs in calc functions using iMA, iATR and iClose, I wouldn't be messing around so much. Then, he made me beat about the bush a second time with his dismissal of EMTPY_VALUE problem, which SDC solved nicely for me. Some people are quite irresponsible here, others just fine !
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Guys,
See below. I am using MT4 Build 509 on an Australian Global Prime ECN broker.
1. I cannot seem to use the loop variable i as the buffer array index directly. Have to change it to something else:
shift = i, for example. Reversing shift and i give same result: a dark screen. No compiler errors.
2. Same dark screen with complex expression as the buffer index based on another loop variable and int maxBars, e.g., instead of arrUSD[i], I use arrUSD [ i + j*maxBars]. No compiler errors. This hangs my MT4.
What I am doing here is trying to avoid over-write of buffer when I calculate the indi for further TFs in the same sub-window, so the new indi values are shifted accordingly for each new TF.