Need help with fractals
-
I need my EA look for this patter, for buying (down fractal follow by an up fractal then another down fractal but this must be above the first down fractal) and for selling (up fractal follow by an down fractal then an up fractal but this must be below the first up fractal).
-
someone?
-
@ricpap
Here: https://fxdreema.com/shared/ExqnpJBZ
This only does as you described, I think it can be improved by setting some limit to the time distance between the fractals -
Here is what I did. First, I used this custom indicator - https://www.mql5.com/en/code/7982 It works like the one in MetaTrader, but it is a custom indicator. Why? Because only for custom indicators in "More settings" there are extra settings.
https://fxdreema.com/shared/EqWKTmPod
Small problem is that in all Condition blocks my "My settings" are closed, which is because I use the current Symbol and Period settings... and "My settings" stays open if one of these is something different.
In block 1 I'm detecting that the newest fractal is Up (red dot above the chart):

Block 2 is to limit the signal to 1 per bar.
In block 3 I want to know if the newest Up fractal is < than the previous Up fractal. See that I'm looking for "Value by Visible ID", where Visible ID is the relative number of the fractal on the chart - 0 is the latest one, 1 is the previous:

In block 4 I check whether the position relative to the current candle of the previous Up (red) fractal is bigger than the position of the latest Down (blue) fractal. Or in other words, whether the previous red dot is left of the latest blue dot:

In block 5 I check whether the previous blue dot is more left than the previous red dot. Because it looks that the indicator can place two consecutive Up arrows, or Down arrows.
