Tâche terminée
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Spécifications
Indicator features
- Must be able to adjust lookback (max bars) in the settings to reduce lag
- Calculated on every candle close instead of every tick
Indicator Input settings
- Maxbars (Bars to look back into history) [Code this input at the start of Step 1]
- Show Fractals on Chart (Enable/Disable) [Code this input at the start of Step 1]
- Fractals (Number of bars to start counting from left and right) [Code this input at the start of Step 1]
- Show Swing Lines on Chart (Enable/Disable) [Code this input at the start of Step 2]
- ATR Period- ATR Multiplier (To multiply the ATR based on candle close between the previous swing points and the new swing points) [Code this input at the start of Step 4]
- Show Market Break of Structure on Chart (Enable/Disable) [Code this input at the start of Step 5]
Indicator description
Step 1: Create a fractal indicator from scratch
An up fractal occurs when there is a low point with one HIGHER or EQUAL low candles on each side of it.
A down fractal occurs when there is a high point with one LOWER or EQUAL low candles on each side of it.
The reason for the need to create the simple fractal indicator from scratch is because the default fractals indicator doesn’t account for candles besides with EQUAL highs and lows.
As you can see in the above example, there should be a fractal where I placed the red arrow based on our custom fractal indicator, because the candle in front has the same high.
In the event of a case of equal highs, I want the fractal to be drawn on the first candle instead of the next one or third one (in rare cases).
Step 2: Code line connecting all the fractal points subsequent fractal points
In the illustration, I made the bodies grey so that the line is more visible.
This part should be straightforward because it's just a line connecting the current fractal to the next one. However, there will be special instances whereby a special candle would contain both an up fractal
and a down fractal. Such as those highlighted below.
For these special candles connect the current line to the up fractal if the “previous fractal was a down fractal” and connect the current line to the down fractal if the “previous fractal was an up fractal”.
Step 3: Disregard series of subsequent same-direction fractals
A series of same-direction fractals are highlighted above in the blue box.
In the event of 1 or more subsequent candles of the same direction, I want the line drawn to the lowest of a series of down fractals and the highest to the series of up fractals.
The finished result should look something like this below.
This scenario is also special whereby a series of down fractals is followed by a special single candle that contains both an up and a down fractal.
In such instances, I want the line drawn this way. The down fractal of that special candle with an up and down fractal, is not considered in the series of subsequent same-direction fractals.
Step 4: ATR Based Swings
Alright so for this step I would like for each swing leg to be the minimum current ATR of the current timeframe x ATR Multiplier (inside indicator settings).
So based on the current line already drawn, I want each swing leg to have a minimum length based on the ATR.
Step 5: Break Of Structure
So every time a break of structure happens a single candle must break and close above or below the previous swing point.
![](https://c.mql5.com/21/532/Step_5.png)
Step 6: Create a MT5 MQL5 version of it after completing a MT4 MQL4.
In Summary
I want the code to be fresh from the start, do not use any existing indicator to start, and after completion of each step, please send me the Indicator so I could check if everything is done correctly, so as to avoid
any errors. Once I checked every step is correct, we can proceed to the subsequent steps.
Throughout the project, if there is any doubts, I can explain to you again.