Having trouble placing SL on next higher or lower fractal/swing structure
-
My bot is designed to enter after the formation of a fractal/swing structure.
For a fractal-up, the SL should be at the price of the very next higher fractal-up to the left.
For a fractal-down, the SL should be at the price of the very next lower fractal-down to the left.SL is same timeframe as entry.
See below for example: the green line is the entry, and the red is the stoploss.
How can I implement something like this?

-
The only way to do this is by creating a custom loop searching for those fractals. Are you familiar with variables and custom loops?
-
I have never managed to get these values in a loop, although the value is in the data window when you hover the mouse over I struggle to get this value returned. I would check ID2 for a fractal, If there is one check the value, and if <> the previous saved in a variable save the new price, this will give you the SL value.
-
@l-andorrà Not quite familiar with it
-
As jstap says, it is not an easy thing to do. Can you please specify how long in the past those 'previous higher' fractals are supposed to be searched for? Because the longer the distance in the past, the more complicated and less efficient to be optimized.