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
Incluí o valor do buffer que quero calcular (a verde) para indicar que o icustom funciona correctamente.
Please note that "madaily" and "dllv", are locallu created variable within the scope of the function ArrayCalcMin(), and as soon as you return, those variables are discarded (destroyed). You will no longer be able to access them from outside the function.
Even you create functions with the same names outside of the function, they will not be the same ones. The ones create in the function will only have a local scope and will not update the global ones and the contents lost.
Edit: This post of mine as generated a new page, but please note that their are two more of my posts before this, that you will have to read in response to yours.
Since "minPos" is returning a value of 9, then it definitely is not returning the index of the last bar (or first array element) and therefore seems to be working correctly.
The "dllv" value however, is returning a value 0, so you will have print out the "madaily" contents, at least the first 30 elements or so, to see what the value at 9 and the surround values.
The best is to provide the full source of both Indicator and a small test Script, so that we can replicate it on our end, since we are currently at a point that I am unable to offer further advice without knowing more of the details on your side.
Thank you for the head's up. I've translated my previous post to english.
So I think that i'm getting closed to find the issue. The minPos is returning the position 9 (the last one) since the value is zero (or not filled).
I've printed the arrays until the 11 position (just in case) an this are the following results:
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array1 = 49.0231
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array2 = 35.7426
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array3 = 28.8379
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array4 = 29.6111
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array5 = 31.6637
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array6 = 37.6187
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array7 = 47.0411
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array8 = 57.8398
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array9 = 0
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array10 = 0
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array11 = 0
I've tried to rest a position in the bars calc but i doesn't solved the issue. is the a way to skip the last position or not take into account the zero?
Please find the code for the iCustom and for the ArrayMin in attachment.
Thank you Fernando.
AP
Thank you for the head's up. I've translated my previous post to english.
So I think that i'm getting closed to find the issue. The minPos is returning the position 9 (the last one) since the value is zero (or not filled).
I've printed the arrays until the 11 position (just in case) an this are the following results:
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array1 = 49.0231
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array2 = 35.7426
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array3 = 28.8379
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array4 = 29.6111
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array5 = 31.6637
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array6 = 37.6187
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array7 = 47.0411
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array8 = 57.8398
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array9 = 0
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array10 = 0
0 23:26:40.598 2018.01.04 16:05:00 FalconTemplate2-5 EURUSD,H4: array11 = 0
I've tried to rest a position in the bars calc but i doesn't solved the issue. is the a way to skip the last position or not take into account the zero?
please find the code of the icustom:
and this is the code to calculate the array min value with the proposed changes:
Thank you Fernando.
AP
Please don't paste the source code of the indicator as text. It's too long. Just attach it to the post as a file (or provide link to original)! Can your edit your post and do this so that it is not so long please?
Also, can you show the log with the print of the "malookback" value as well please?
EDIT: Please also provide your code in a form that will compile without errors. At the moment it cannot be compiled or used because it is dependent on the "LastOrderTime()" function.
Ok, I compile it using a fixed value of "malookback" of 20, so that it would compile.
After running it, the first thing I realised that I did not before, was that your are using the ArrayMinimum over the WHOLE array of 30000 elements, but only a few were actually set. In my case it was only 20.
So making the following change:
Second thing I noticed is that since you are using the default inputs of the Indicator, then the Mode 0 you are using is for the "Signal", and not the "Stochastic", just in case that was not the intention.
I also changed the code for the print out as follows:
And the log I obtained was as follows:
I also made the following changes to improve things a bit, including making the Array size adjust to the "malookback" count:
I have taken the liberty to rewrite your code in my own way and style, that does not use the Array. Since you are already stepping through the values one by one to fill the array, you might as well just check for the minimum without the extra resources of array management and manipulation:
And yes, I'm starting the loop at "1", not "0", for a reason; so that it does not execute the for loop, should the number of bars be less than "1".
I also changed the Function name as it is checking ("bool") and not actually building or getting an array.
I have taken the liberty to rewrite your code in my own way and style, that does not use the Array. Since you are already stepping through the values one by one to fill the array, you might as well just check for the minimum without the extra resources of array management and manipulation:
And yes, I'm starting the loop at "1", not "0", for a reason; so that it does not execute the for loop, should the number of bars be less than "1".
I also changed the Function name as it is checking ("bool") and not actually building or getting an array.
Dear Fernando,
Apologies for the late reply. Just until now that I was able to see your last posts.
Thank you again for your help and dedication, it truly help me understand how arrays work. I will check your last comments thoroughly, I have some doubts about some of them.
I will get back to you soon.
By the way, you code is pretty neat. :)
Regards!
Andrés P.
Times = Timeahora - Timeorder; int m = TimeMinute(Times), h = TimeHour( Times), d = TimeDay( Times),
TimeXXX() requires a datetime. Times is a duration in seconds.
"Free-of-Holes" Charts - MQL4 Articles 20 June 2006
No candle if open = close ? - MQL4 programming forum