Questions from Beginners MQL5 MT5 MetaTrader 5 - page 618
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
Can you tell me why this might be the case? :
Fun_1() and Fun_2() are similar.
Can you please tell me what could be causing this? :
Fun_1() and Fun_2() are similar.
academically - the functions are not pure and change the global state.
briefly - both functions read and write a global variable or file.
academically - the functions are not pure and change the global state.
in short - both functions read and write a global variable or file.
Yes, each of them writes a file. So?
and do not work together :-)
PS. it's impossible to say more accurately about the source of the underground knocks without sources. Somewhere there is a mistake - correct it
To save space and improve perception - in one function. It still doesn't work.
for future - if you may need function result (at least worked/not worked), do not make it void. At a cursory glance it is hard to determine that there is a criterion of "triggered" - it is void, no matter how you throw everything is good.
on the debugger's rights:
You have a bunch of global variables Count_XXX, Range_XXX, which you convert (plus dSSxx[] arrays), use them to decide whether to log or not and then pass them somewhere, either by reference or by value...
there's obviously something wrong with their recalculation - Count_dSS gets 0 when you call it again. Print can help to figure it out or breakpoints and watch.
for future - if you may need result of function (at least it worked or not), don't make it void. At a glance, it is hard to determine what is the criterion for "triggered" - it is void, no matter how you throw it, everything is good.
on the debugger's rights:
you have a bunch of global variables Count_XXX, Range_XXX, which you convert (plus arrays dSSxx[]), based on them you decide whether to log or not and then pass somewhere either by reference or by value...
there's obviously something wrong with their recalculation - Count_dSS gets 0 when you call it again. Print can help to figure it out or breakpoints and watch.
A simplified version:
// There are two dynamic arrays A[][2] and B[][2]
// we are looking for matches by the first dimension index "0".
// Array A Array B
// 31 25 19 66
// 44 15 62 30
// 62 47 54 71
// 31 94
// We want to get:
// Array dSSd[][4] Array dSSw[][4]
// 31 25 31 94 31 94 31 25
// 62 47 62 30 62 30 62 47
Which re-call do you mean?
A simplified version:
I am referring to a function similar to the first one (which may be different in detail). You asked the same question - why do these functions work separately, but one after the other (regardless of the order) does not. More precisely, only the first function works and records something.
well - fuck the global state, i.e. the first call of the first of these functions changed either the global variables or the contents of the arrays. Why? You should know better, why should it change when writing to a file:-) Honestly - break through
I, for example, find it hard and reluctant. Get a debugger or put printers on all suspicious places already. You understand the naming logic and have some idea how it should work (not coincident with reality :-) )
PS/ from the explanation of what's in the input and what's out, I see that instead of two arrays dSSx[][4] is enough and one dSS[][3] :-)
I am referring to a function similar to the first one (which may be different in detail). You asked the same question - why do these functions work individually, but one after the other (regardless of the order) does not. More precisely, only the first function works and records something.
So - the global state is fucked, i.e. the first call of the first of these functions changed either global variables or contents of arrays. Maybe you know better why they should change it when writing to the file:-). Honestly - break through
I, for example, find it hard and reluctant. Get a debugger or put printers on all suspicious places already. You understand the naming logic and have some idea how it should work (not coinciding with reality :-) )
PS/ from the explanation of what's in the input and what's out, I see that instead of two arrays dSSx[][4] is enough and one dSS[][3] :-)