Fractal y Bucles
-
Hello, I wanted to ask if anyone has managed to create a loop or some other logic to detect the last two lowest consecutive lows and the highest consecutive highs, or what logic you recommend me to use, since I have the idea but I do not clarify when it comes to pass it to code, Thanks for the help.
-
@yerlin you mean fractals? The indicator?
-
@roar Yes, If I am trying to use this indicator to mark a structure, because visually it looks simple, now my dilemma is to start the robot, because it starts from the first fractal, in this case I put a bearish example, look for the first bearish fractal, then look for the next fractal that is above this first one, and finally a third fractal that is above these two, but as you see in the image the fractal that is lower does not have it finds, and in fact it would be the first fractal that would have to have finds, but well that would be a lesser evil, it would be to end up drawing a horizontal line at the points where the price could end up arriving, then I must add a couple of conditions to validate or not those areas, but the theme of the loop to find these fractalities are those that complicates the logic to me.

-
@yerlin here's how to find the fractals you circled: https://fxdreema.com/shared/WL0eDd83d
-
Thank you very much, you have solved a lot!
Do you have any idea to first identify this minimum and where to start analyzing the bot?

-
@yerlin what are the criteria of that minimum? All-time low? Lowest of last x candles? Lowest during these 3 fractals?
My example loop goes through every candle until the last fractal, so you could start with:
lowest_price = iClose(NULL,0,0)*2
And then make this check during each loop iteration:
lowest_price = MathMin(lowest_price, iLow(NULL,0,loop_id))
-
@roar I understand that you mean that I first make the loop until the first sequence is found and once found, start another loop where I start from the minimum that the first loop found, right?
-
@yerlin it is possible to do everything in the single loop, we could add the lowest candle check in the "modify variables" blocks (need a new variable)

-
@roar Ok, perfect this afternoon I will be testing, I will inform you of the evolution of the project.
-
@roar Sorry to bother you, according to your loop I don't understand it because now less than getting the price of that fractal I would like to save the number of that candle, but having this kind of conditions that I have never touched in FXDrema makes it complicated... v1 == iLow(NULL,0,loop_id)
Could you help me with a couple of conditions I would like to add?
-
@yerlin to get the candle number, you can save the loop_id variable to some other variable.
I can help you.
-
I wrote the condition in mql5 code because its faster, but you can also use the drop-down menus to get exactly same result

-
@roar a ok, now I understand I will make an example and then if you want to correct me.
Because my manual trading is in search of structural breaks, and by means of the filtered values of the fractals I think that my manual trading, I could automate it almost 100%.
The idea would be to go step by step first find the lowest consecutive points, as I explained yesterday in the image, once achieved the next step would be to mark the highest point between those fractals, the next block would be to check if the price has broken any of those highs between fractals, if so that high is invalidated and we look for the previous one, I think that this strategy can be robotized and continue adding zones, candlestick patterns, to form my operative but as I said the logic of programming today is a little big for me, but still I try to learn day by day, I will try to make a couple of examples and I will send it back to you to see if I can understand everything.
and again thank you very much for giving me light in this dark tunnel

-
I have managed to get the ID of each selected fractal, now I am having difficulties to do what I told you if within the first 3 suppose that the 3 or 2 fractal are lower in price reset me all and start from that point, not from candle 0. Because otherwise my way to the basics would be to create another loop.
Firts exemple:
https://fxdreema.com/shared/MNIjDJCCb
Second:
-
@yerlin so you want to get 3 descending fractals one after another, no "bad fractals" in between?
So the loop needs to identify these blue ones?

-
@roar exactly, Exactly, and once obtained I could work with the candle ids.

-
@yerlin ok, so if a "bad fractal" is found, we will set that fractal as 1st and then reset the loop to the beginning of 2nd fractal search: https://fxdreema.com/shared/kTqNEJhVc
The magic happens in blocks #17 and #20
-
@roar You are a fucking GENIUS, I will continue, soon I will share my progress and if I have any questions I will let you know anyway!
-
@roar As far as I can see, when it detects a minor fractal, you send it to restart the loop again with blocks 17 and 20, is that so?
-
@yerlin yes, the minor fractal is considered as the 1st in sequence, and we start again looking for 2nd one