This script, titled "Uptrick: Bullish/Bearish Highlight," is a TradingView Pine Script indicator that helps identify bullish and bearish conditions by using a combination of technical analysis tools. It overlays on the chart and generates signals based on moving averages, volatility bands, multi-timeframe analysis, and asset correlation.
The script uses *smaLength*, *emaLength*, and *atrLength* to calculate the Simple Moving Average (SMA), Exponential Moving Average (EMA), and Average True Range (ATR), respectively. The ATR is adjusted by *atrMultiplier* to create dynamic bands that act as support and resistance levels. The *higherTimeframe* parameter confirms the trend on a larger timeframe, while *correlationAsset* and *correlationPeriod* check if the asset is moving in correlation with another asset. The script also includes a pyramiding option for allowing multiple positions in the same direction.
### Validation:
The script ensures valid input values for *smaLength*, *emaLength*, and *atrLength*, raising an error if any of them are set incorrectly.
### Calculations:
- The script calculates SMA, EMA, and ATR, adjusting the ATR bands for market volatility.
- It uses multi-timeframe analysis to confirm trends and measures the correlation between the asset and another asset (e.g., BTCUSDT).
- Signal strength is determined based on the price difference from the SMA compared to market noise.
### Signal Conditions:
- A bullish signal occurs when the price is above both the SMA and the higher timeframe SMA.
- A bearish signal is generated when the price is below both the SMA and the higher timeframe SMA.
### Visualization:
ATR bands are plotted, and the area between them is filled with a blue cloud. The SMA’s color changes based on the trend of the asset and the correlated asset.
### Pyramiding Logic:
If pyramiding is enabled, new positions are allowed in the same direction; otherwise, positions are restricted until the market changes direction.
### Entry and Exit Levels:
The script defines buy and sell signals based on price touching the defined ATR levels.
### Alerts:
Custom alerts can be set based on price touching key levels or when buy/sell signals are generated.
### Uniqueness:
This script combines multiple features like dynamic ATR bands, multi-timeframe analysis, and multi-asset correlation. The ATR bands adjust with volatility, and the higher timeframe SMA adds confirmation. Smart signal filtering and pyramiding options give flexibility and precision, while the SMA color change enhances trend visibility.
---
### How to Use:
1. Using it as support and resistance:
The ATR bands act as dynamic support and resistance levels. Watch for price to interact with these levels to identify potential reversals or breakouts.
2. Buying if the price gets below all layers and selling if the price gets above all layers:
Enter buy trades when the price touches and moves above all lower ATR levels, and enter sell trades when the price moves above all upper ATR levels.
3. Tight cloud indicates breakout, wide cloud indicates consolidation:
When the ATR cloud is tight, it suggests low volatility and a potential breakout. A wide cloud signals high volatility, indicating a cooling-off period or consolidation.