OPEN-SOURCE SCRIPT

Fibonacci ATR Fusion - Strategy [presentTrading]

Open-script again! This time is also an ATR-related strategy. Enjoy! :)
If you have any questions, let me know, and I'll help make this as effective as possible.

█ Introduction and How It Is Different

The Fibonacci ATR Fusion Strategy is an advanced trading approach that uniquely integrates Fibonacci-based weighted averages with the Average True Range (ATR) to identify and capitalize on significant market trends.

Unlike traditional strategies that rely on single indicators or static parameters, this method combines multiple timeframes and dynamic volatility measurements to enhance precision and adaptability. Additionally, it features a 4-step Take Profit (TP) mechanism, allowing for systematic profit-taking at various levels, which optimizes both risk management and return potential in long and short market positions.

BTCUSD 6hr Performance
สแนปชอต

█ Strategy, How It Works: Detailed Explanation

The Fibonacci ATR Fusion Strategy utilizes a combination of technical indicators and weighted averages to determine optimal entry and exit points. Below is a breakdown of its key components and operational logic.

🔶 1. Enhanced True Range Calculation

The strategy begins by calculating the True Range (TR) to measure market volatility accurately.



  • High and Low: Highest and lowest prices of the current trading period.
  • Previous Close: Closing price of the preceding trading period.
  • max: Selects the largest value among the three calculations to account for gaps and limit movements.


🔶 2. Buying Pressure (BP) Calculation

Buying Pressure (BP) quantifies the extent to which buyers are driving the price upwards within a period.



  • Close: Current period's closing price.
  • True Low: The lower boundary determined in the True Range calculation.


🔶 3. Ratio Calculation for Different Periods

To assess the strength of buying pressure relative to volatility, the strategy calculates a ratio over various Fibonacci-based timeframes.



  • n: Length of the period (e.g., 8, 13, 21, 34, 55).
  • Sum of BP: Cumulative Buying Pressure over n periods.
  • Sum of TR: Cumulative True Range over n periods.


This ratio normalizes buying pressure, making it comparable across different timeframes.

🔶 4. Weighted Average Calculation

The strategy employs a weighted average of ratios from multiple Fibonacci-based periods to smooth out signals and enhance trend detection.



  • w1, w2, w3, w4: Weights assigned to each ratio period.
  • Ratio_p1 to Ratio_p5: Ratios calculated for periods p1 to p5 (e.g., 8, 13, 21, 34, 55).


This weighted approach emphasizes shorter periods more heavily, capturing recent market dynamics while still considering longer-term trends.

🔶 5. Simple Moving Average (SMA) of Weighted Average

To further smooth the weighted average and reduce noise, a Simple Moving Average (SMA) is applied.



- m: SMA period (e.g., 3).

This smoothed line serves as the primary signal generator for trade entries and exits.

🔶 6. Trading Condition Thresholds

The strategy defines specific threshold values to determine optimal entry and exit points based on crossovers and crossunders of the SMA.



  • Long Entry Threshold (T_LE): Level at which a long position is triggered.
  • Short Entry Threshold (T_SE): Level at which a short position is triggered.
  • Long Exit Threshold (T_LX): Level at which a long position is exited.
  • Short Exit Threshold (T_SX): Level at which a short position is exited.


These conditions ensure that trades are only executed when clear trends are identified, enhancing the strategy's reliability.

Previous local performance
สแนปชอต

🔶 7. ATR-Based Take Profit Mechanism

When enabled, the strategy employs a 4-step Take Profit system to systematically secure profits as the trade moves in the desired direction.



- ATR Value: Calculated using ATR over a specified period (e.g., 14).
- TPxATR: User-defined multipliers for each take profit level.
- TPx_percent: Percentage of the position to exit at each TP level.

This multi-tiered exit strategy allows for partial position closures, optimizing profit capture while maintaining exposure to potential further gains.

█ Trade Direction

The Fibonacci ATR Fusion Strategy is designed to operate in both long and short market conditions, providing flexibility to traders in varying market environments.

  • Long Trades: Initiated when the SMA of the weighted average crosses above the Long Entry Threshold (T_LE), indicating strong upward momentum.
  • Short Trades: Initiated when the SMA of the weighted average crosses below the Short Entry Threshold (T_SE), signaling robust downward momentum.


Additionally, the strategy can be configured to trade exclusively in one direction—Long, Short, or Both—based on the trader’s preference and market analysis.

█ Usage

Implementing the Fibonacci ATR Fusion Strategy involves several steps to ensure it aligns with your trading objectives and market conditions.

1. Configure Strategy Parameters:
- Trading Direction: Choose between Long, Short, or Both based on your market outlook.
- Trading Condition Thresholds: Set the Long Entry, Short Entry, Long Exit, and Short Exit thresholds to define when to enter and exit trades.

2. Set Take Profit Levels (if enabled):
- ATR Multipliers: Define how many ATRs away from the entry price each take profit level is set.
- Take Profit Percentages: Allocate what percentage of the position to close at each TP level.

3. Apply to Desired Chart:
- Add the strategy to the chart of the asset you wish to trade.
- Observe the plotted Fibonacci ATR and SMA Fibonacci ATR indicators for visual confirmation.

4. Monitor and Adjust:
- Regularly review the strategy’s performance through backtesting.
- Adjust the input parameters based on historical performance and changing market dynamics.

5. Risk Management:
- Ensure that the sum of take profit percentages does not exceed 100% to avoid over-closing positions.
- Utilize the ATR-based TP levels to adapt to varying market volatilities, maintaining a balanced risk-reward ratio.

█ Default Settings

Understanding the default settings is crucial for optimizing the Fibonacci ATR Fusion Strategy's performance. Here's a precise and simple overview of the key parameters and their effects:

🔶 Key Parameters and Their Effects

1. Trading Direction (`tradingDirection`)
- Default: Both
- Effect: Determines whether the strategy takes both long and short positions or restricts to one direction. Selecting Both allows maximum flexibility, while Long or Short can be used for directional bias.

2. Trading Condition Thresholds
  • Long Entry (long_entry_threshold = 58.0): Higher values reduce false positives but may miss trades.
  • Short Entry (short_entry_threshold = 42.0): Lower values capture early short trends but may increase false signals.
  • Long Exit (long_exit_threshold = 42.0): Exits long positions early, securing profits but potentially cutting trends short.
  • Short Exit (short_exit_threshold = 58.0): Delays short exits to capture favorable movements, avoiding premature exits.


3. Take Profit Configuration (`useTakeProfit` = false)
- Effect: When enabled, the strategy employs a 4-step TP mechanism to secure profits at multiple levels. By default, it is disabled to allow users to opt-in based on their trading style.

4. ATR-Based Take Profit Multipliers
TP1 (tp1ATR = 3.0): Sets the first TP at 3 ATRs for initial profit capture.
TP2 (tp2ATR = 8.0): Targets larger trends, though less likely to be reached.
TP3 (tp3ATR = 14.0): Optimizes for extreme price moves, seldom triggered.

5. Take Profit Percentages
TP Level 1 (tp1_percent = 12%): Secures 12% at the first TP.
TP Level 2 (tp2_percent = 12%): Exits another 12% at the second TP.
TP Level 3 (tp3_percent = 12%): Closes an additional 12% at the third TP.

6. Weighted Average Parameters
  • Ratio Periods: Fibonacci-based intervals (8, 13, 21, 34, 55) balance responsiveness.
  • Weights: Emphasizes recent data for timely responses to market trends.
  • SMA Period (weighted_avg_sma_period = 3): Smoothens data with minimal lag, balancing noise reduction and responsiveness.


7. ATR Period (`atrPeriod` = 14)
Effect: Sets the ATR calculation length, impacting TP sensitivity to volatility.

🔶 Impact on Performance

- Sensitivity and Responsiveness:
- Shorter Ratio Periods and Higher Weights: Make the weighted average more responsive to recent price changes, allowing quicker trade entries and exits but increasing the likelihood of false signals.
- Longer Ratio Periods and Lower Weights: Provide smoother signals with fewer false positives but may delay trade entries, potentially missing out on significant price moves.

- Profit Taking:
- ATR Multipliers: Higher multipliers set take profit levels further away, targeting larger price movements but reducing the probability of reaching these levels.
- Fixed Percentages: Allocating equal percentages at each TP level ensures consistent profit realization and risk management, preventing overexposure.

- Trade Direction Control:
- Selecting Specific Directions: Restricting trades to Long or Short can align the strategy with market trends or personal biases, potentially enhancing performance in trending markets.

- Risk Management:
- Take Profit Percentages: Dividing the position into smaller percentages at multiple TP levels helps lock in profits progressively, reducing risk and allowing the remaining position to ride further trends.

- Market Adaptability:
- Weighted Averages and ATR: By combining multiple timeframes and adjusting to volatility, the strategy adapts to different market conditions, maintaining effectiveness across various asset classes and timeframes.

---
If you want to know more about ATR, can also check "SuperATR 7-Step Profit".
Enjoy trading.
Average True Range (ATR)presenttradingSimple Moving Average (SMA)strategytakeprofitTrend Analysistrendtradingtruerangeweighted

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?


Watch patiently/ then trade
และใน:

คำจำกัดสิทธิ์ความรับผิดชอบ