OPEN-SOURCE SCRIPT
已更新 Dynamic Testing

Input Parameters
---
Core Calculations
ATR (Average True Range)
ATR is computed using the specified period to gauge price volatility.
Volume SMA
The script calculates the simple moving average of volume over the same period as ATR. This is used as a threshold for validating high-volume scenarios.
---
Support and Resistance Levels
---
Entry Scenarios
Bullish Entry (`isBullishEntry`)
Bearish Entry (`isBearishEntry`)
---
Box Visualization
Bullish and Bearish Boxes
---
Stop Loss and Take Profit Calculations
Bullish Trades
Bearish Trades
---
Visualization for Key Levels
Bullish Scenario
Bearish Scenario
---
Dynamic Updates
---
Purpose
---
Technical Summary
---
- `lookbackPeriod`: Number of candles to check for determining the highest high (resistance) and lowest low (support) levels.
- `atrPeriod`: The period for calculating the Average True Range (ATR), a measure of market volatility.
- `atrMultiplierSL`: Multiplier to calculate the stop-loss distance relative to the ATR.
- `atrMultiplierTP1` and `atrMultiplierTP2`: Multipliers to calculate two take-profit levels relative to ATR.
- `rewardToRisk`: The ratio between reward (profit) and risk (stop loss) for trade management.
---
Core Calculations
ATR (Average True Range)
atr = ta.atr(atrPeriod)
ATR is computed using the specified period to gauge price volatility.
Volume SMA
volumeSMA = ta.sma(volume, atrPeriod)
The script calculates the simple moving average of volume over the same period as ATR. This is used as a threshold for validating high-volume scenarios.
---
Support and Resistance Levels
- `support`: Lowest price over the last `lookbackPeriod` candles.
- `resistance`: Highest price over the same period.
- `supportBuffer` and `resistanceBuffer`: These are "buffered" zones around support and resistance, calculated using half of the ATR to prevent false breakouts.
---
Entry Scenarios
Bullish Entry (`isBullishEntry`)
- The close is above the buffered support level.
- The low of the current candle touches or breaks below the support level.
- The trading volume is greater than the `volumeSMA`.
Bearish Entry (`isBearishEntry`)
- The close is below the buffered resistance level.
- The high of the current candle touches or exceeds the resistance level.
- The trading volume is greater than the `volumeSMA`.
---
Box Visualization
Bullish and Bearish Boxes
- Bullish Box (`bullishBox`):
- A green, semi-transparent rectangle around the support level to highlight the bullish entry zone.
- Dynamically updates based on recent price action. - Bearish Box (`bearishBox`):
- A red, semi-transparent rectangle around the resistance level to highlight the bearish entry zone.
- Adjusts similarly as price evolves.
---
Stop Loss and Take Profit Calculations
Bullish Trades
- Stop Loss (`bullishSL`): Calculated as [code]support - atrMultiplierSL * ATR[/code].
- Take Profit 1 (`bullishTP1`):[code]support + rewardToRisk * atrMultiplierTP1 * ATR[/code].
- Take Profit 2 (`bullishTP2`):[code]support + rewardToRisk * atrMultiplierTP2 * ATR[/code].
Bearish Trades
- Stop Loss (`bearishSL`):[code]resistance + atrMultiplierSL * ATR[/code].
- Take Profit 1 (`bearishTP1`):[code]resistance - rewardToRisk * atrMultiplierTP1 * ATR[/code].
- Take Profit 2 (`bearishTP2`):[code]resistance - rewardToRisk * atrMultiplierTP2 * ATR[/code].
---
Visualization for Key Levels
Bullish Scenario
- Green lines represent `bullishTP1` and `bullishTP2` for profit targets.
- A red line indicates the `bullishSL`.
- Labels like "TP1," "TP2," and "SL" dynamically appear at respective levels to make the targets and risk visually clear.
Bearish Scenario
- Red lines represent `bearishTP1` and `bearishTP2`.
- A green line marks the `bearishSL`.
- Similar dynamic labeling for `TP1`, `TP2`, and `SL` at corresponding bearish levels.
---
Dynamic Updates
- Both the entry boxes and key level visualizations (lines and labels) adjust dynamically based on real-time price and volume data.
---
Purpose
- Identify high-probability bullish and bearish trade setups.
- Define clear entry zones (using boxes) and exit levels (TP1, TP2, SL).
- Incorporate volatility (via ATR) and volume into decision-making.
---
Technical Summary
- Dynamically visualize support/resistance levels.
- Set risk-managed trades using ATR-based stop-loss and profit levels.
- Automate visual trade zones for enhanced chart clarity.
---
版本注释
Updated开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。