OPEN-SOURCE SCRIPT

[Defaust] Fractals

[Defaust] Fractals Indicator

Overview

The [Defaust] Fractals Indicator is a technical analysis tool designed to help traders identify potential reversal points in the market by detecting fractal patterns. This indicator is a fork of the original fractals indicator, with adjustments made to the plotting for enhanced visual clarity and usability.

What Are Fractals?

In trading, a fractal is a pattern consisting of five consecutive bars (candlesticks) that meet specific conditions:
  • Up Fractal (Potential Sell Signal): Occurs when a high point is surrounded by two lower highs on each side.
  • Down Fractal (Potential Buy Signal): Occurs when a low point is surrounded by two higher lows on each side.


Fractals help traders identify potential tops and bottoms in the market, signaling possible entry or exit points.

Features of the Indicator

Customizable Periods (n): Allows you to define the number of periods to consider when detecting fractals, offering flexibility to adapt to different trading strategies and timeframes.
Enhanced Plotting Adjustments: This fork introduces adjustments to the plotting of fractal signals for better visual representation on the chart.

Visual Signals: Plots up and down triangles on the chart to signify down fractals (potential bullish signals) and up fractals (potential bearish signals), respectively.

Overlay on Chart: The fractal signals are overlaid directly on the price chart for immediate visualization.

Adjustable Precision: You can set the precision of the plotted values according to your needs.

Pine Script Code Explanation

Below is the Pine Script code for the [Defaust] Fractals Indicator:



Explanation:

  • Input Parameter (n): Sets the number of periods for fractal detection. The default value is 2, and it must be at least 2 to ensure valid fractal patterns.
  • Flag Initialization: Boolean variables are used to store intermediate conditions during fractal detection.
  • Loops: Iterate through the specified number of periods to evaluate the conditions for fractal formation.
  • Conditions:
  • Up Fractals: Checks if the current high is greater than previous highs and if future highs are lower or equal to the current high.
  • Down Fractals: Checks if the current low is lower than previous lows and if future lows are higher or equal to the current low.
  • Flag Combination: Logical and and or operations are used to combine the flags and determine if a fractal exists.


Adjusted Plotting:

The plotting of fractal symbols has been adjusted for better alignment and visual clarity.
The offset parameter is set to -n to align the plotted symbols with the correct bars.
The color and size have been fine-tuned for better visibility.

How to Use the Indicator

Adding the Indicator to Your Chart
  1. Open TradingView:
  2. Go to TradingView.
  3. Access the Chart:
  4. Click on "Chart" to open the main charting interface.
  5. Add the Indicator:
  6. Click on the "Indicators" button at the top.
  7. Search for "[Defaust] Fractals".
  8. Select the indicator from the list to add it to your chart.


Configuring the Indicator

  • Periods (n):

Default value is 2.
Adjust this parameter based on your preferred timeframe and sensitivity.
A higher value of n considers more bars for fractal detection, potentially reducing the number of signals but increasing their significance.

Interpreting the Signals

– Up Fractal (Downward Triangle): Indicates a potential price reversal to the downside. May be used as a signal to consider exiting long positions or tightening stop-loss orders.
– Down Fractal (Upward Triangle): Indicates a potential price reversal to the upside. May be used as a signal to consider entering long positions or setting stop-loss orders for short positions.

Trading Strategy Suggestions
Up Fractal Detection:
The high of the current bar (n) is higher than the highs of the previous two bars (n - 1, n - 2).
The highs of the next bars meet certain conditions to confirm the fractal pattern.
An up fractal symbol (downward triangle) is plotted above the bar at position n - n (due to the offset).

Down Fractal Detection:

The low of the current bar (n) is lower than the lows of the previous two bars (n - 1, n - 2).
The lows of the next bars meet certain conditions to confirm the fractal pattern.
A down fractal symbol (upward triangle) is plotted below the bar at position n - n.

Benefits of Using the [Defaust] Fractals Indicator

Early Signals: Helps in identifying potential reversal points in price movements.
Customizable Sensitivity: Adjusting the n parameter allows you to fine-tune the indicator based on different market conditions.
Enhanced Visuals: Adjustments to plotting improve the clarity and readability of fractal signals on the chart.

Limitations and Considerations

Lagging Indicator: Fractals require future bars to confirm the pattern, which may introduce a delay in the signals.
False Signals: In volatile or ranging markets, fractals may produce false signals. It's advisable to use them in conjunction with other analysis tools.
Not a Standalone Tool: Fractals should be part of a broader trading strategy that includes other indicators and fundamental analysis.

Best Practices for Using This Indicator

Combine with Other Indicators: Use in combination with trend indicators, oscillators, or volume analysis to confirm signals.
Backtesting: Before applying the indicator in live trading, backtest it on historical data to understand its performance.
Adjust Periods Accordingly: Experiment with different values of n to find the optimal setting for the specific asset and timeframe you are trading.

Disclaimer

The [Defaust] Fractals Indicator is intended for educational and informational purposes only. Trading involves significant risk, and you should be aware of the risks involved before proceeding. Past performance is not indicative of future results. Always conduct your own analysis and consult with a professional financial advisor before making any investment decisions.

Credits
This indicator is a fork of the original fractals indicator, with adjustments made to the plotting for improved visual representation. It is based on standard fractal patterns commonly used in technical analysis and has been developed to provide traders with an effective tool for detecting potential reversal points in the market.
Fractal

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?


更多:

免責聲明