Ok, at least I was almost on the right track but since I didn't know about EMPTY_VALUE and how to use it I was thinking of trying to loop back to detect the change in value since the resistance and the support value stays the same until the previous indicators.
Anyhow, thanks I'll have to read up some more on this, I am getting closer but it's still a little foggy. :)
Seems like it's taking me too long to learn things. I think I need to read more of other peoples codes and try to understand them to get better design ideas.
RaptorUK: There are 2 buffers (arrays) that hold the price values of the Fractals . . . val1 & val2. If you want to find previous fractal values you simply loop, incrementing a shift value, and check the buffer values till you find ones that aren't EMPTY_VALUE ( https://docs.mql4.com/customind/SetIndexEmptyValue )
Ok, just thinking out loud here:
So I can loop back v1[i] and v2[i] with something 1++ code,
I don't understand val1>0 isn't it always greater then 0 except for High[0] ?
And why does val1 only mark the high fractal and not all the High[i] 's AHHH I think I see because the if statement tells it to only do the High[i]'s
So ok let me think some more.
val1 is the fractals, however v1[i] are only the fractal high's ok I think I got this part worked out.
So then I could loop v1[i] 1++ somehow(i'll have to work that part out) to the previous point before the EMPTY_VALUE and this would be the previous High[i] fractal.
val1 is the fractals, however v1[i] are only the fractal high's ok I think I got this part worked out.
So then I could loop v1[i] 1++ somehow(i'll have to work that part out) to the previous point before the EMPTY_VALUE and this would be the previous High[i] fractal.
I got something wrong, I can put 0 in for EMPTY_VALUE and it prints 0 continuously so that's not right well maybe that is right but not my desired effect.
I thought the for loop would have taken me back just one signal and printed the signal level for me. but I get nothing or 0
After a few days thinking this through and trying many things, and yet I tried to make these changes to the indicator version also by adding a 3rd buffer and attempt to signal with price on charts but that's been a no go too.
Well, wait I take this back the short version EA I do not have the EMPTY_VALUE buffer so that likely is not going to work anyhow, and so the idea was to test the EA so I could see the print functions to see the results, but the indicator version I would have to wait for so I have to post back on that as it turns out.
Anyhow here is the indicator version, but I do not feel confident about this because I'm not exactly sure if I should attempt to loop inside the while statement or create a new loop and recreating val1 = .... again also.
I guess I was thinking that since the while statement and v1[i] stores the highs and i -- counts down from Bars highest then I would simply count back up again while v1[i] == EMPTY_VALUE
I though this would increment i++ up 1 level to the previous high, well actually I guess it would go past that to the next EMPTY_VALUE
So I need to do this in the opposite way v1[i] = High[i]; i++
Then shouldn't this take me to the previous High, but I'm not sure how to initialise it properly.
I'm changing it to an if( I just want to see anything print at this point so I can at least see what the indicator is doing.
All I get is 0's so there is actually NO values when = Print (v1[i]); Which is strange because how do I have the indicator even working at this point then ?
Agent86: I'm changing it to an if( I just want to see anything print at this point so I can at least see what the indicator is doing.
All I get is 0's so there is actually NO values when = Print (v1[i]); Which is strange because how do I have the indicator even working at this point then ?
Oh well, I'll keep on it.
Maybe you are just seeing values for v1[0] ? print i at the same time . .
hmm interesting I didn't post all of it but all the lines read the same = 0
I thought I should still see an actual value for v1[0] ?
how can it always be 0 when the indicator must be if(>0) ?
I may be getting into yet another area that I am ignorant about.
I thought I might be able to print so I might try and understand what and why all my attempts are failing; and so that I might increment i++ in some way to get to the next fractal and then somehow figure out how to use this information for something.
I can print High[i] or v1[i] and it's always 0
Printing High[0] or High[1] also 0
Although I understand what you posted and printing of i value which seems to be stuck because of the i-- loop which always takes it to 0, but even so it should still print a value for i, as least I thought.
And I understand why it's printing [-1] because i=Bars. I get this, but =0 ?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Anyhow, thanks I'll have to read up some more on this, I am getting closer but it's still a little foggy. :)
Seems like it's taking me too long to learn things. I think I need to read more of other peoples codes and try to understand them to get better design ideas.
Thanks for the response.
There are 2 buffers (arrays) that hold the price values of the Fractals . . . val1 & val2. If you want to find previous fractal values you simply loop, incrementing a shift value, and check the buffer values till you find ones that aren't EMPTY_VALUE ( https://docs.mql4.com/customind/SetIndexEmptyValue )
So I can loop back v1[i] and v2[i] with something 1++ code,
I don't understand val1>0 isn't it always greater then 0 except for High[0] ?
And why does val1 only mark the high fractal and not all the High[i] 's AHHH I think I see because the if statement tells it to only do the High[i]'s
So ok let me think some more.
val1 is the fractals, however v1[i] are only the fractal high's ok I think I got this part worked out.
So then I could loop v1[i] 1++ somehow(i'll have to work that part out) to the previous point before the EMPTY_VALUE and this would be the previous High[i] fractal.
Am I getting closer ?
Ok, just thinking out loud here:
val1 is the fractals, however v1[i] are only the fractal high's ok I think I got this part worked out.
So then I could loop v1[i] 1++ somehow(i'll have to work that part out) to the previous point before the EMPTY_VALUE and this would be the previous High[i] fractal.
Am I getting closer ?
Correct . . . :-)
Thanks
Anyhow:
I thought the for loop would have taken me back just one signal and printed the signal level for me. but I get nothing or 0
After a few days thinking this through and trying many things, and yet I tried to make these changes to the indicator version also by adding a 3rd buffer and attempt to signal with price on charts but that's been a no go too.
Well, wait I take this back the short version EA I do not have the EMPTY_VALUE buffer so that likely is not going to work anyhow, and so the idea was to test the EA so I could see the print functions to see the results, but the indicator version I would have to wait for so I have to post back on that as it turns out.
well I ditched trying to get the 3rd buffer / signal to be created for now and just want to see if I can print the result of the previous signalAnyhow here is the indicator version, but I do not feel confident about this because I'm not exactly sure if I should attempt to loop inside the while statement or create a new loop and recreating val1 = .... again also.
EMPTY_VALUE the way I put in the code initializes the indicator, but thats all nothing printing
Can you explain how this for loop works ?
for(val1=High[i]; v1[i] == 0 ;i++)
Can you explain how this for loop works ?
for(val1=High[i]; v1[i] == 0 ;i++)
I though this would increment i++ up 1 level to the previous high, well actually I guess it would go past that to the next EMPTY_VALUE
So I need to do this in the opposite way v1[i] = High[i]; i++
Then shouldn't this take me to the previous High, but I'm not sure how to initialise it properly.
I'll keep working on it.
All I get is 0's so there is actually NO values when = Print (v1[i]);
Which is strange because how do I have the indicator even working at this point then ?
Oh well, I'll keep on it.
I'm changing it to an if( I just want to see anything print at this point so I can at least see what the indicator is doing.
All I get is 0's so there is actually NO values when = Print (v1[i]);
Which is strange because how do I have the indicator even working at this point then ?
Oh well, I'll keep on it.
Maybe you are just seeing values for v1[0] ? print i at the same time . .
I didn't post all of it but all the lines read the same = 0
I thought I should still see an actual value for v1[0] ?
how can it always be 0 when the indicator must be if(>0) ?
I may be getting into yet another area that I am ignorant about.
I thought I might be able to print so I might try and understand what and why all my attempts are failing; and so that I might increment i++ in some way to get to the next fractal and then somehow figure out how to use this information for something.
I can print High[i] or v1[i] and it's always 0
Printing High[0] or High[1] also 0
Although I understand what you posted and printing of i value which seems to be stuck because of the i-- loop which always takes it to 0, but even so it should still print a value for i, as least I thought.
And I understand why it's printing [-1] because i=Bars. I get this, but =0 ?