Help with Fractals
-
Hello, I would deeply appreciate some assistance here. This is my first time on this website, and so far it looks much better than all the other EA builders I've seen.
I am trying to create a piece of code that performs an action (drawing a trendline, but that's not relevant for this post) when three fractal high and then fractal low pairs form, each pair having a lower high and a lower low than the last. So something like this :

I created 6 variables, one for each FH/L , but I don't know how to assign the variables chart based values that make it possible to later compare them so as to ensure that FH2 is lower than FH1 on the chart, and FH3 is lower than FH2 (and the same for the fractal lows).
Thank you.
-
You can use objects (such as Arrow Down) to draw your fractal highs based on your specified conditions (such as the attached image).

Then, to compare between FH2 and FH1:- Use the loop operation block - "Loop for Chart Objects" > "For each Object".
- Include 2 conditions under this block,
- The same condition as the image and
- Candle(3) high < (is below) Price level 1 of the object taken from the loop
You may need another separate object (Arrow Up) for your fractal lows and just switch the above conditions to the opposite.
-
Interesting but I don't think that is how fractals work double:
iFractals(
string symbol, // symbol
int timeframe, // timeframe
int MODE_LOWER or MODE_UPPER, // line index
int shift // shift
);
This code will give you the value of an arrow, shift is a number to choose how far back is the arrow. Put this into a comment, work out how to use it, and then you will have to have a set of conditions (or code), to decide whether the arrows are on the way DN or UP. -
@jstap Thanks for your reply! I'm not sure I understand though - where would that code go on the website, and what do you mean by the arrows?
-
By arrows, I mean the ones created by the fractal indicator, this would go into custom code.
iFractals(NULL,0,MODE_UPPER,0) put this in a comment as text code input, you will see the value returned, then check and work out what you want to do next with it.
-
Thank you! I think I'm too much of a newbie at coding to understand what you are saying, but hopefully when I open the builder and mess around a bit, I'll get it

-
Fx most the most part prevents the need for any coding, occasionally though there is no choice. learn the simple first, then you can move on to coding stuff
-
@xiawu said in Help with Fractals:
You can use objects (such as Arrow Down) to draw your fractal highs based on your specified conditions (such as the attached image).

Then, to compare between FH2 and FH1:- Use the loop operation block - "Loop for Chart Objects" > "For each Object".
- Include 2 conditions under this block,
- The same condition as the image and
- Candle(3) high < (is below) Price level 1 of the object taken from the loop
You may need another separate object (Arrow Up) for your fractal lows and just switch the above conditions to the opposite.
Thanks, Ill check that out.