buf=iFractals(NULL,0,MODE_UPPER,i); if(buf) { up++; price[up]=iFractals(NULL,0,MODE_UPPER,i); date[up]=Time[i]; }
I am pretty sure that fractals returns either EMPTY_VALUE or a price
either way, double buf will have a value and if(buf) will return true
price[3] is not being updated and is probably EMPTY_VALUE which will take it way off the chart
up is being incremented every tick and will soon be higher than the number of bars on the chart
To check if you have a new upper fractal, you can use something like
if(MathAbs(High[i]-iFractals(NULL,0,MODE_UPPER,i))<Point)
Start with something like that to identify the fractals and then build on that.
I am pretty sure that fractals returns either EMPTY_VALUE or a price
Hello GumRai,
iFractals returns either 0 or a price
(I only know because I looked at it yesterday)
Hello GumRai and honest_knave, thank you guys for helping me, the idea worked out perfectly. In my main code im using MathMax to compare values of the previous fractals, so the code with the rectangles worked great!
thank you guys again!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello guys, im doing this to learn and code an indicator that i want, im a newbie and im doing what i can to learn this..
Well, my problem in this code is i want to put an arrow after a touch in the rectangle, but the arrow appears everywhere. The arrow is just to see if i done the right thing..
My definition of a touch is, in this case i was looking at a resistance perspective, if the High enter in the area between xkl1 and xkl2 and close bellow xkl2 it would be a touch. Dont matter how many candles it takes to close bellow the area, the main thing is to not close above xkl1... In the second loop i use the number 25 as a limit just because it was just faster for me then search the bar index, because i dont know how do it properly i try it with iBarshift but doesnt work how i though it was.
Thanks for your time and patience, sorry about my poor english.