INVITE-ONLY SCRIPT
QV 4D BX Reversal

This algorithm excels in long-term trading and identifying momentum reversals on higher timeframes. To maximize profits, you can then leverage the QV 2H/4D 2BX & FVB Strategy algorithm, switching to a lower timeframe for precise short-term trades.
### Overview of the Strategy
The "QV 4D BX Reversal" is a Pine Script (version 5) trading strategy for TradingView, designed as a reversal-based system using a custom momentum oscillator called "B-Xtrender" on a higher timeframe (default 4-day). It supports user-selected long-only or short-only trading, entering on signs of momentum reversal or continuation in the oscillator's direction. The strategy uses 5% of equity per trade, with no commissions, and focuses on simple entry/exit rules based on the oscillator's value, changes, and thresholds. It's plotted in a separate pane as a colored histogram (green for positive/uptrending, red for negative/downtrending), with a centerline at 0. This script is suited for trend-reversal trading in assets like stocks, forex, or crypto, emphasizing higher-timeframe signals for reduced noise.
The name likely refers to:
- **QV**: QuantVault (the creator).
- **4D**: Default 4-day timeframe for the oscillator.
- **BX**: B-Xtrender oscillator.
- **Reversal**: Focus on detecting momentum shifts for entries and exits.
It's licensed under Mozilla Public License 2.0, making it open-source friendly.
### Key Indicators and Calculations
The core of the strategy is a single indicator fetched from a higher timeframe:
1. **B-Xtrender Oscillator (shortTermXtrender)**:
- Formula: `RSI(EMA(close, short_l1) - EMA(close, short_l2), short_l3) - 50`.
- Defaults: L1=5, L2=20, L3=5.
- This measures momentum in the difference between a fast and slow EMA, normalized via RSI, and centered around 0 (positive = bullish, negative = bearish).
- Fetched via `request.security` from the input timeframe (TF1, default "4D").
- Plotted as a histogram:
- Green (lime if increasing, darker if decreasing) when >0.
- Red (bright if increasing toward 0, darker if decreasing) when <0.
- A dashed gray hline at 0 acts as a centerline for crossovers.
No other indicators like ATR or bands are used—it's purely oscillator-driven.
### How the Strategy Works: Entries
Entries trigger on momentum shifts or continuations in the B-Xtrender, filtered by the selected trade direction. Only one direction is active at a time (no hedging).
- **Long Direction**:
- **Entry Condition** (`long_entry`): Triggers if either:
- Crossover above 0 (from below) AND the value is increasing (current > previous).
- OR simply increasing (current > previous), regardless of level.
- On entry, it records if the oscillator was below the exit level (exit_lvl, default 3.5) via `entryBelowExit` for a special exit rule.
- Enters a long position with 5% of equity.
- **Short Direction**:
- **Entry Condition** (`short_entry`): Triggers if either:
- Crossunder below 0 (from above) AND the value is decreasing (current < previous).
- OR simply decreasing (current < previous), regardless of level.
- Enters a short position with 5% of equity.
No pyramiding or position sizing variations—entries are straightforward and can re-enter immediately after exits if conditions met. No additional filters like volume or price action.
### How the Strategy Works: Exits
Exits close the entire position based on adverse momentum signals, with combined rules for robustness. Exits are direction-specific and only trigger if in a position.
- **Long Exits** (`long_exit`): Closes the long if any of:
- Crossunder below the exit level (default 3.5).
- Oscillator is red (<=0) AND decreasing for 2 consecutive bars (current < prev, prev < prev[1]).
- If entry was below exit level (`entryBelowExit` true), crossunder below 0.
- Comment on close indicates the reason (e.g., "Cross below 3.5" or "Red + 2-bar decline").
- Resets `entryBelowExit` after exit.
- **Short Exits** (`short_exit`): Closes the short if any of:
- Crossover above the negative exit level (-3.5).
- Oscillator is green (>=0) AND increasing for 2 consecutive bars (current > prev, prev > prev[1]).
- Comment on close indicates the reason (e.g., "Cross above -3.5" or "Green + 2-bar increase").
This setup aims to exit on weakening momentum or threshold breaches, protecting against reversals. No partial exits or trailing stops—full close only.
### Alerts
The script includes alert conditions for key events, which can be set up in TradingView for notifications:
- Long Entry (Crossover): "B-Xtrender crossed above 0 and is rising → LONG".
- Long Entry (Increasing): "B-Xtrender TF1 is increasing → LONG".
- Long Exit (Red + 2-Bar Decline): "B-Xtrender is red and decreased for 2 bars → EXIT LONG".
- Short Entry (Crossunder): "B-Xtrender crossed below 0 and is falling → SHORT".
- Short Entry (Decreasing): "B-Xtrender TF1 is decreasing → SHORT".
- Short Exit (Green + 2-Bar Increase): "B-Xtrender is green and increased for 2 bars → EXIT SHORT".
These use `alertcondition` for easy setup.
### Additional Notes
- **Customization**: Inputs allow tweaking EMA lengths, timeframe, exit level, and direction. Best for higher TFs like 4D to capture multi-day reversals.
- **Risk Management**: Relies on equity percentage sizing; no built-in stops beyond oscillator exits. Users should backtest for drawdowns.
- **Limitations**: Single-timeframe focus may miss broader trends; no volume or volatility filters. Assumes chart TF is lower than "4D" for accurate security requests.
- **Performance**: Suited for ranging or reversing markets where momentum shifts are frequent. In strong trends, it might enter/exit prematurely.
This strategy provides a simple, momentum-based reversal system, ideal for beginners or as a building block for more complex setups.
### Overview of the Strategy
The "QV 4D BX Reversal" is a Pine Script (version 5) trading strategy for TradingView, designed as a reversal-based system using a custom momentum oscillator called "B-Xtrender" on a higher timeframe (default 4-day). It supports user-selected long-only or short-only trading, entering on signs of momentum reversal or continuation in the oscillator's direction. The strategy uses 5% of equity per trade, with no commissions, and focuses on simple entry/exit rules based on the oscillator's value, changes, and thresholds. It's plotted in a separate pane as a colored histogram (green for positive/uptrending, red for negative/downtrending), with a centerline at 0. This script is suited for trend-reversal trading in assets like stocks, forex, or crypto, emphasizing higher-timeframe signals for reduced noise.
The name likely refers to:
- **QV**: QuantVault (the creator).
- **4D**: Default 4-day timeframe for the oscillator.
- **BX**: B-Xtrender oscillator.
- **Reversal**: Focus on detecting momentum shifts for entries and exits.
It's licensed under Mozilla Public License 2.0, making it open-source friendly.
### Key Indicators and Calculations
The core of the strategy is a single indicator fetched from a higher timeframe:
1. **B-Xtrender Oscillator (shortTermXtrender)**:
- Formula: `RSI(EMA(close, short_l1) - EMA(close, short_l2), short_l3) - 50`.
- Defaults: L1=5, L2=20, L3=5.
- This measures momentum in the difference between a fast and slow EMA, normalized via RSI, and centered around 0 (positive = bullish, negative = bearish).
- Fetched via `request.security` from the input timeframe (TF1, default "4D").
- Plotted as a histogram:
- Green (lime if increasing, darker if decreasing) when >0.
- Red (bright if increasing toward 0, darker if decreasing) when <0.
- A dashed gray hline at 0 acts as a centerline for crossovers.
No other indicators like ATR or bands are used—it's purely oscillator-driven.
### How the Strategy Works: Entries
Entries trigger on momentum shifts or continuations in the B-Xtrender, filtered by the selected trade direction. Only one direction is active at a time (no hedging).
- **Long Direction**:
- **Entry Condition** (`long_entry`): Triggers if either:
- Crossover above 0 (from below) AND the value is increasing (current > previous).
- OR simply increasing (current > previous), regardless of level.
- On entry, it records if the oscillator was below the exit level (exit_lvl, default 3.5) via `entryBelowExit` for a special exit rule.
- Enters a long position with 5% of equity.
- **Short Direction**:
- **Entry Condition** (`short_entry`): Triggers if either:
- Crossunder below 0 (from above) AND the value is decreasing (current < previous).
- OR simply decreasing (current < previous), regardless of level.
- Enters a short position with 5% of equity.
No pyramiding or position sizing variations—entries are straightforward and can re-enter immediately after exits if conditions met. No additional filters like volume or price action.
### How the Strategy Works: Exits
Exits close the entire position based on adverse momentum signals, with combined rules for robustness. Exits are direction-specific and only trigger if in a position.
- **Long Exits** (`long_exit`): Closes the long if any of:
- Crossunder below the exit level (default 3.5).
- Oscillator is red (<=0) AND decreasing for 2 consecutive bars (current < prev, prev < prev[1]).
- If entry was below exit level (`entryBelowExit` true), crossunder below 0.
- Comment on close indicates the reason (e.g., "Cross below 3.5" or "Red + 2-bar decline").
- Resets `entryBelowExit` after exit.
- **Short Exits** (`short_exit`): Closes the short if any of:
- Crossover above the negative exit level (-3.5).
- Oscillator is green (>=0) AND increasing for 2 consecutive bars (current > prev, prev > prev[1]).
- Comment on close indicates the reason (e.g., "Cross above -3.5" or "Green + 2-bar increase").
This setup aims to exit on weakening momentum or threshold breaches, protecting against reversals. No partial exits or trailing stops—full close only.
### Alerts
The script includes alert conditions for key events, which can be set up in TradingView for notifications:
- Long Entry (Crossover): "B-Xtrender crossed above 0 and is rising → LONG".
- Long Entry (Increasing): "B-Xtrender TF1 is increasing → LONG".
- Long Exit (Red + 2-Bar Decline): "B-Xtrender is red and decreased for 2 bars → EXIT LONG".
- Short Entry (Crossunder): "B-Xtrender crossed below 0 and is falling → SHORT".
- Short Entry (Decreasing): "B-Xtrender TF1 is decreasing → SHORT".
- Short Exit (Green + 2-Bar Increase): "B-Xtrender is green and increased for 2 bars → EXIT SHORT".
These use `alertcondition` for easy setup.
### Additional Notes
- **Customization**: Inputs allow tweaking EMA lengths, timeframe, exit level, and direction. Best for higher TFs like 4D to capture multi-day reversals.
- **Risk Management**: Relies on equity percentage sizing; no built-in stops beyond oscillator exits. Users should backtest for drawdowns.
- **Limitations**: Single-timeframe focus may miss broader trends; no volume or volatility filters. Assumes chart TF is lower than "4D" for accurate security requests.
- **Performance**: Suited for ranging or reversing markets where momentum shifts are frequent. In strong trends, it might enter/exit prematurely.
This strategy provides a simple, momentum-based reversal system, ideal for beginners or as a building block for more complex setups.
招待専用スクリプト
こちらのスクリプトにアクセスできるのは投稿者が承認したユーザーだけです。投稿者にリクエストして使用許可を得る必要があります。通常の場合、支払い後に許可されます。詳細については、以下、作者の指示をお読みになるか、QuantVaultに直接ご連絡ください。
スクリプトの機能を理解し、その作者を全面的に信頼しているのでなければ、お金を支払ってまでそのスクリプトを利用することをTradingViewとしては「非推奨」としています。コミュニティスクリプトの中で、その代わりとなる無料かつオープンソースのスクリプトを見つけられる可能性もあります。
作者の指示
To get the QV 4D BX Reversal, subscribe at quant-vault.com. This site offers paid access to TradingView Pine Scripts like this one for trend trading in stocks, forex, and crypto.
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
招待専用スクリプト
こちらのスクリプトにアクセスできるのは投稿者が承認したユーザーだけです。投稿者にリクエストして使用許可を得る必要があります。通常の場合、支払い後に許可されます。詳細については、以下、作者の指示をお読みになるか、QuantVaultに直接ご連絡ください。
スクリプトの機能を理解し、その作者を全面的に信頼しているのでなければ、お金を支払ってまでそのスクリプトを利用することをTradingViewとしては「非推奨」としています。コミュニティスクリプトの中で、その代わりとなる無料かつオープンソースのスクリプトを見つけられる可能性もあります。
作者の指示
To get the QV 4D BX Reversal, subscribe at quant-vault.com. This site offers paid access to TradingView Pine Scripts like this one for trend trading in stocks, forex, and crypto.
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。