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
for(i=0; val1==val3; i++)
This code leaves the possibility of an endless loop IMO.
I'll check in tomorrow
for(i=0; val1==val3; i++)
This code leaves the possibility of an endless loop IMO.
If val3 = 0 and val1 = 0 it should cycle until it gets a value
ii val3 = iFractal(momentarily) then val1 should cycle until val1=0 (and this is my problem right here)
it really is sort of an endless loop or lockup point, although I do get a print statement to return the iFractal value for val1 i'm not really sure where this is
I'll have to experiment some more with what others have posted for testing this, but I think your right
Perhaps it's not exactly as intended, but this is the concept I want to achieve to just increment to the previous fractal value
I'll keep working on it
Honestly, this is my first time seeing this, for the loop termination condition. Its is tricky one...
So it would appear that in theory it will only work once as long as val3 == 0 and then and only then will i++ incriment backwards until val1 is no longer == val3 which is what I want to do, however if val3 == a value then val1 will inciment back to a value of 0 where it's not longer == to val3 and then the loop will end.
This is not exactly what I wanted after all so back to the drawingboard again LOL
Thanks all
When you get an iFractal the value is > 0, yes ?
So, for example, if you want to know where the last UPPER and LOWER iFractals were just do something like this . . .
I think I can work this out, I hope. he he
Thanks
The 0 candle can't be a Fractal so val3 will always be 0, so why not use . . .
. . . and get rid of val3.
I prefer a while in this case though, seemed to fit better to what you were trying to do . .
When you get an iFractal the value is > 0, yes ?
So, for example, if you want to know where the last UPPER and LOWER iFractals were just do something like this . . .
For example:
2011.10.07 09:05:36 sup_res EURUSD,M5: Last UPPER Fractal at 6 Last LOWER Fractal at 0
So it will show the current UPPER high fractal and print the location which is good
I can also change val1=i to val1=iFractal(NULL, 0, MODE_UPPER,i) and this will give me the value for the last iFractal
So I'm making some progress on understanding this but I still need to recode in order to go back to the previous iFractal
Once an iFractal forms then this while statement will continue to print the currently formed and latest iFractal which is cool
So lets say a new iFractal forms I want to reference this current fractal from the while statement which is really the previous 1 and not the current
So lets say iFractal LOWER_MODE forms now and I want to reference the previous iFractal UPPER_MODE and compare those values.
But from your advise I think I might be able to work this out these are all great ideas that are helping me a lot.
As I get more familiar with how code works I'm really starting to enjoy using what I know for my trading ideas.
Thanks
This seems to tell me where the last iFractal is, but not both previous iFractals
There is an error in my code . . .
The 0 candle can't be a Fractal so val3 will always be 0, so why not use . . .
. . . and get rid of val3.
I prefer a while in this case though, seemed to fit better to what you were trying to do . .
When adding a for(statement) within an if(statement) can you add additional if(statements) and refer to the values in the loop ?
And do those additional if(statements) have to occur inside the loop or can you be outside the loop and still refer to the looped values such as val2 ?
Please advise what is considered normal for loops inside of other code blocks ? And how to extract values of the loops ?
Thanks