OPEN-SOURCE SCRIPT

BullBear with Volume-Percentile TP - Strategy [presentTrading]

Happy New Year, everyone! I hope we have a fantastic year ahead.
It's been a while since I published an open script, but it's time to return.

This strategy introduces an indicator called Bull Bear Power, combined with an advanced take-profit system, which is the main innovative and educational aspect of this script. I hope all of you find some useful insights here. Welcome to engage in meaningful exchanges. This is a versatile tool suitable for both novice and experienced traders.

█ Introduction and How it is Different

Unlike traditional strategies that rely solely on price or volume indicators, this approach combines Bull Bear Power (BBP) with volume percentile analysis to identify optimal entry and exit points. It features a dynamic take-profit mechanism based on ATR (Average True Range) multipliers adjusted by volume and percentile factors, ensuring adaptability to diverse market conditions. This multifaceted strategy not only improves signal accuracy but also optimizes risk management, distinguishing it from conventional trading methods.

BTCUSD 6hr performance
快照

Disable the visualization of Bull Bear Power (BBP) to clearly view the Z-Score.
快照

█ Strategy, How it Works: Detailed Explanation

The BBP Strategy with Volume-Percentile TP utilizes several interconnected components to analyze market data and generate trading signals. Here's an overview with essential equations:

🔶 Core Indicators and Calculations
1. Exponential Moving Average (EMA):
- **Purpose:** Smoothens price data to identify trends.
- **Formula:**


- Usage: Baseline for Bull and Bear Power.

2. Bull and Bear Power:
- Bull Power:
- Bear Power:
- BBP:**
- Interpretation: Positive BBP indicates bullish strength, negative indicates bearish.

3. Z-Score Calculation:
- Purpose: Normalizes BBP to assess deviation from the mean.
- Formula:

- Components:
- `bbp_mean` = SMA of BBP over `zLength` periods.
- `bbp_std` = Standard deviation of BBP over `zLength` periods.
- Usage: Identifies overbought or oversold conditions based on thresholds.

🔶 Volume Analysis

1. Volume Moving Average (`vol_sma`):



2. Volume Multiplier (`vol_mult`):


- Thresholds:
- High Volume: `vol_mult > 2.0`
- Medium Volume: `1.5 < vol_mult ≤ 2.0`
- Low Volume: `1.0 < vol_mult ≤ 1.5`

🔶 Percentile Analysis

1. Percentile Calculation (`calcPercentile`):



2. Thresholds:
- High Percentile: >90%
- Medium Percentile: >80%
- Low Percentile: >70%

🔶 Dynamic Take-Profit Mechanism

1. ATR-Based Targets:


- ATR Calculation:


2. Adjustment Factors:


- **vol_score** and **price_score** are based on current volume and price percentiles.

Local performance
快照

🔶 Entry and Exit Logic
1. Long Entry: If Z-Score crosses above 1.618, then Enter Long.

2. Short Entry: If Z-Score crosses below -1.618, then Enter Short.

3. Exiting Positions:
If Long and Z-Score crosses below 0:
Exit Long
If Short and Z-Score crosses above 0:
Exit Short

4. Take-Profit Execution:
- Set multiple exit orders at dynamically calculated TP levels based on ATR and adjusted by `TP_Factor`.

█ Trade Direction
The strategy determines trade direction using the Z-Score from the BBP indicator:

- Long Positions:
- Condition: Z-Score crosses above 1.618.
- Short Positions:
- Condition: Z-Score crosses below -1.618.
- Exiting Trades:
- Long Exit: Z-Score drops below 0.
- Short Exit: Z-Score rises above 0.

This approach aligns trades with prevailing market trends, increasing the likelihood of successful outcomes.

█ Usage

Implementing the BBP Strategy with Volume-Percentile TP in TradingView involves:

1. Adding the Strategy:
- Copy the Pine Script code.
- Paste it into TradingView's Pine Editor.
- Save and apply the strategy to your chart.

2. Configuring Settings:
- Adjust parameters like EMA length, Z-Score thresholds, ATR multipliers, volume periods, and percentile settings to match your trading preferences and asset behavior.

3. Backtesting:
- Use TradingView’s backtesting tools to evaluate historical performance.
- Analyze metrics such as profit factor, drawdown, and win rate.

4. Optimization:
- Fine-tune parameters based on backtesting results.
- Test across different assets and timeframes to enhance adaptability.

5. Deployment:
- Apply the strategy in a live trading environment.
- Continuously monitor and adjust settings as market conditions change.

█ Default Settings

The BBP Strategy with Volume-Percentile TP includes default parameters designed for balanced performance across various markets. Understanding these settings and their impact is essential for optimizing strategy performance:

Bull Bear Power Settings:
- EMA Length (`lengthInput`): 21
- **Effect:** Balances sensitivity and trend identification; shorter lengths respond quicker but may generate false signals.
- Z-Score Length (`zLength`): 252
- **Effect:** Long period for stable mean and standard deviation, reducing false signals but less responsive to recent changes.
- Z-Score Threshold (`zThreshold`): 1.618
- **Effect:** Higher threshold filters out weaker signals, focusing on significant market moves.

Take Profit Settings:
- Use Take Profit (`useTP`): Enabled (`true`)
- **Effect:** Activates dynamic profit-taking, enhancing profitability and risk management.
- ATR Period (`baseAtrLength`): 20
- **Effect:** Shorter period for sensitive volatility measurement, allowing tighter profit targets.
- ATR Multipliers:
- **Effect:** Define conservative to aggressive profit targets based on volatility.
- Position Sizes:
- **Effect:** Diversifies profit-taking across multiple levels, balancing risk and reward.

Volume Analysis Settings:
- Volume MA Period (`vol_period`): 100
- **Effect:** Longer period for stable volume average, reducing the impact of short-term spikes.
- Volume Multipliers:
- **Effect:** Determines volume conditions affecting take-profit adjustments.
- Volume Factors:
- **Effect:** Adjusts ATR multipliers based on volume strength.

Percentile Analysis Settings:
- Percentile Period (`perc_period`): 100
- **Effect:** Balances historical context with responsiveness to recent data.
- Percentile Thresholds:
- **Effect:** Defines price and volume percentile levels influencing take-profit adjustments.
- Percentile Factors:
- **Effect:** Modulates ATR multipliers based on price percentile strength.

Impact on Performance:

- EMA Length: Shorter EMAs increase sensitivity but may cause more false signals; longer EMAs provide stability but react slower to market changes.
- Z-Score Parameters:*Longer Z-Score periods create more stable signals, while higher thresholds reduce trade frequency but increase signal reliability.
- ATR Multipliers and Position Sizes: Higher multipliers allow for larger profit targets with increased risk, while diversified position sizes help in securing profits at multiple levels.
- Volume and Percentile Settings: These adjustments ensure that take-profit targets adapt to current market conditions, enhancing flexibility and performance across different volatility environments.
- Commission and Slippage: Accurate settings prevent overestimation of profitability and ensure the strategy remains viable after accounting for trading costs.

Conclusion

The BBP Strategy with Volume-Percentile TP offers a robust framework by combining BBP indicators with volume and percentile analyses. Its dynamic take-profit mechanism, tailored through ATR adjustments, ensures that traders can effectively capture profits while managing risks in varying market conditions.
backtestingeducationpercentilepresenttradingstatisticsstrategytakeprofittakeprofitsystemtradingsystemTrend AnalysisVolume

開源腳本

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

想在圖表上使用此腳本?


Watch patiently/ then trade
更多:

免責聲明