ที่อัปเดต:

XGBoost Approximation Indicator with HTF Filter Ver. 3.2

9 707
XGBoost Approx Indicator with Higher Timeframe Filter Ver. 3.2
What It Is
The XGBoost Approx Indicator is a technical analysis tool designed to generate trading signals based on a composite of multiple indicators. It combines Simple Moving Average (SMA), Relative Strength Index (RSI), MACD, Rate of Change (ROC), and Volume to create a composite indicator score. Additionally, it incorporates a higher timeframe filter (HTF) to enhance trend confirmation and reduce false signals.

This indicator helps traders identify long (buy) and short (sell) opportunities based on a weighted combination of trend-following and momentum indicators.

How to Use It Properly
Setup and Configuration:

Add the indicator to your TradingView chart.
Customize input settings based on your trading strategy. Key configurable inputs include:
HTF filter (default: 1-hour)
SMA, RSI, MACD, and ROC lengths
Custom weightings for each component
Thresholds for buy and sell signals
Understanding the Signals:

Green "Long" Label: Appears when the composite indicator crosses above the buy threshold, signaling a potential buy opportunity.
Red "Short" Label: Appears when the composite indicator crosses below the sell threshold, signaling a potential sell opportunity.
These signals are filtered by a higher timeframe SMA trend to improve accuracy.
Alerts:

The indicator provides alert conditions for long and short entries.
Traders can enable alerts in TradingView to receive real-time notifications when a new signal is triggered.
Safety and Best Practices
Use in Conjunction with Other Analysis: Do not rely solely on this indicator. Combine it with price action, support/resistance levels, and fundamental analysis for better decision-making.
Adjust Settings for Your Strategy: The default settings may not suit all markets or timeframes. Test different configurations before trading live.
Backtest Before Using in Live Trading: Evaluate the indicator’s past performance on historical data to assess its effectiveness in different market conditions.
Avoid Overtrading: False signals can occur, especially in low volatility or choppy markets. Use additional confirmation (e.g., trendlines or moving averages).
Risk Management: Always set stop-loss levels and position sizes to limit potential losses.
Release Note
There us an update on the script, now it is Version 3.3
Calculations weights are now more balanced as Volume got 0.2 as of 20% contribution of the composite indicator.

Composite indicator is a simplified show of the results of multiple indicators. Calculations are the following:
compositeIndicator = (weightSMA * smaNormalized) +
(weightRSI * rsiNormalized) +
(weightMACD * macdNormalized) +
(weightROC * rocNormalized) +
(weightVolume * volumeNormalized)
So compositeIndicator are calculated from the last 50 bars, their values are normalized between the range of -1.0 and 1.0
Sell when the compositeIndicator is below (adjustable) -0.5 and buy when exceeds 0.5
I recommend to use the last bars or high/lows adding maximim 1% of balance risk.
Exit position either you get 2-3x your R:R or the indicator makes an alert for the another directon.
Release Note
Update notes:

22 Marc 2025

Barmerger set to off to make the scriopt more robust.
The script was converted to Pinescript 6.
Release Note
Overview
This indicator provides a sophisticated, "quant-style" approach to trend identification by combining a Dynamic Multi-Factor Model with signal smoothing techniques. Instead of using static weights for indicators like RSI, CCI, or ROC, this script uses a rolling correlation window to auto-optimize its internal logic based on recent market behavior.

How it Works
The core engine functions as a "Feature-Weighted Ensemble." It calculates five classic technical features and normalizes them into a unified range:

RSI (Momentum)

CCI (Trend/Deviation)

ATR (Volatility-adjusted Trend)

ROC (Velocity)

WaveTrend (Oscillator Flow)

1. Auto-Optimization Logic
Unlike traditional indicators, this script measures the Pearson Correlation of each individual feature against price action over a user-defined rolling window (default: 5 bars). If RSI is accurately predicting the trend, its weight increases. If it begins to lag, the "AI-like" weighting system automatically reduces its influence on the final signal.

2. Kalman Filter & Hysteresis Smoothing
To prevent "whipsaws" (false signals in choppy markets), the output is processed through:

Kalman Filter: A recursive mathematical algorithm that filters out "market noise" while maintaining minimal lag compared to traditional EMAs.

Hysteresis Buffer: A state-engine logic that requires the signal to break a specific threshold (e.g., +0.05 or -0.05) before a trend flip is confirmed. This ensures that minor oscillations around the zero line don't trigger unnecessary trades.

Strategy Statistics Pane
The indicator includes a real-time Performance Dashboard in the bottom-right corner, tracking:

Net Profit: Cumulative gain/loss based on signal flips.

Win Rate: The percentage of profitable direction changes.

Total Trades: Total count of signals since the beginning of the chart history.

Main Inputs
Optimization Window: Adjusts how fast the indicator "learns" from recent price action.

Signal Threshold (Hysteresis): Increase this value to filter more noise; decrease it for faster entries.

Kalman Filter Toggle: Enable this for a smoother aqua-line output and more stable signals.

How to Use
Trend Following: Use the "LONG" and "SHORT" triangle shapes for entry or bias confirmation.

Filtering: Use a higher "Hysteresis" value on lower timeframes (1m, 5m) to avoid over-trading during consolidation.

Publisher's Note:
This is an approximation of an XGBoost-like ensemble model. It does not "re-paint" as it uses historical correlation and standard Pine Script math to simulate adaptive weighting.

Risk Disclaimer & Performance Note
⚠️ Trading involves significant risk
The signals generated by this indicator are for educational and informational purposes only. No part of this script should be construed as financial, investment, or legal advice. Trading financial markets involves a high risk of loss and is not suitable for every investor.

📊 Past Performance & Backtesting
Historical Results: The "Strategy Stats" pane displays theoretical performance based on historical data. It does not account for slippage, broker commissions, or market liquidity.

The "Look-Ahead" Factor: While this script does not "repaint" (change signals once a bar is closed), the auto-optimization logic uses rolling correlations that can appear highly effective in historical backtests but may perform differently in live, high-volatility environments.

Optimization Sensitivity: Low "Optimization Windows" (e.g., 2–5 bars) can lead to overfitting, where the model perfectly matches historical noise but fails to predict future price direction.

⚙️ Proper Usage
Do not trade blindly: Always use this indicator in conjunction with other forms of analysis (e.g., Price Action, Support/Resistance, or Economic News).

Demo First: It is strongly recommended to test this logic on a Paper Trading (Demo) account before committing real capital.

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

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