Macd and RSI % Change Signals Devis'SoLong Signal Strategy
RSI-Based Long Signals:
A long signal is triggered when the percentage change in RSI of the close price crosses over thresholds like 10 or 20.
Similarly, a long signal is triggered when the percentage change in RSI of the low price crosses over 20.
MACD-Based Long Signals:
A long signal is triggered when the MACD, its signal line, or the midpoint of the two crosses over thresholds such as 2, 3, 4, or 5.
When a long signal is triggered, the low of the corresponding candle is recorded as the "pullback level." This pullback level is displayed on the chart to help identify potential areas of support.
Short Signal Strategy
RSI-Based Short Signals:
A short signal is triggered when the percentage change in RSI of the low price crosses under -20.
Similarly, a short signal is triggered when the percentage change in RSI of the close price crosses under thresholds like -10 or -20.
MACD-Based Short Signals:
A short signal is triggered when the MACD, its signal line, or the midpoint of the two crosses under thresholds such as -2, -3, -4, or -5.
When a short signal is triggered, the high of the corresponding candle is recorded as the "pullback level." This pullback level is displayed on the chart to help identify potential areas of resistance.
Visualization
Signals:
Long signals are plotted as green upward triangles below the price bars.
Short signals are plotted as red downward triangles above the price bars.
Pullback Levels:
Long pullback levels are plotted as a green line below the price.
Short pullback levels are plotted as a red line above the price.
Alerts
Alerts are defined for specific signals, allowing traders to receive notifications when important levels are crossed, such as:
Long signal based on RSI or MACD changes.
Short signal based on RSI or MACD changes.
Индикаторы и стратегии
MA Deviation Suite [InvestorUnknown]This indicator combines advanced moving average techniques with multiple deviation metrics to offer traders a versatile tool for analyzing market trends and volatility.
Moving Average Types :
SMA, EMA, HMA, DEMA, FRAMA, VWMA: Standard moving averages with different characteristics for smoothing price data.
Corrective MA: This method corrects the MA by considering the variance, providing a more responsive average to price changes.
f_cma(float src, simple int length) =>
ma = ta.sma(src, length)
v1 = ta.variance(src, length)
v2 = math.pow(nz(ma , ma) - ma, 2)
v3 = v1 == 0 or v2 == 0 ? 1 : v2 / (v1 + v2)
var tolerance = math.pow(10, -5)
float err = 1
// Gain Factor
float kPrev = 1
float k = 1
for i = 0 to 5000 by 1
if err > tolerance
k := v3 * kPrev * (2 - kPrev)
err := kPrev - k
kPrev := k
kPrev
ma := nz(ma , src) + k * (ma - nz(ma , src))
Fisher Least Squares MA: Aims to reduce lag by using a Fisher Transform on residuals.
f_flsma(float src, simple int len) =>
ma = src
e = ta.sma(math.abs(src - nz(ma )), len)
z = ta.sma(src - nz(ma , src), len) / e
r = (math.exp(2 * z) - 1) / (math.exp(2 * z) + 1)
a = (bar_index - ta.sma(bar_index, len)) / ta.stdev(bar_index, len) * r
ma := ta.sma(src, len) + a * ta.stdev(src, len)
Sine-Weighted MA & Cosine-Weighted MA: These give more weight to middle bars, creating a smoother curve; Cosine weights are shifted for a different focus.
Deviation Metrics :
Average Absolute Deviation (AAD) and Median Absolute Deviation (MAD): AAD calculates the average of absolute deviations from the MA, offering a measure of volatility. MAD uses the median, which can be less sensitive to outliers.
Standard Deviation (StDev): Measures the dispersion of prices from the mean.
Average True Range (ATR): Reflects market volatility by considering the day's range.
Average Deviation (adev): The average of previous deviations.
// Calculate deviations
float aad = f_aad(src, dev_len, ma) * dev_mul
float mad = f_mad(src, dev_len, ma) * dev_mul
float stdev = ta.stdev(src, dev_len) * dev_mul
float atr = ta.atr(dev_len) * dev_mul
float avg_dev = math.avg(aad, mad, stdev, atr)
// Calculated Median with +dev and -dev
float aad_p = ma + aad
float aad_m = ma - aad
float mad_p = ma + mad
float mad_m = ma - mad
float stdev_p = ma + stdev
float stdev_m = ma - stdev
float atr_p = ma + atr
float atr_m = ma - atr
float adev_p = ma + avg_dev
float adev_m = ma - avg_dev
// upper and lower
float upper = f_max4(aad_p, mad_p, stdev_p, atr_p)
float upper2 = f_min4(aad_p, mad_p, stdev_p, atr_p)
float lower = f_min4(aad_m, mad_m, stdev_m, atr_m)
float lower2 = f_max4(aad_m, mad_m, stdev_m, atr_m)
Determining Trend
The indicator generates trend signals by assessing where price stands relative to these deviation-based lines. It assigns a trend score by summing individual signals from each deviation measure. For instance, if price crosses above the MAD-based upper line, it contributes a bullish point; crossing below an ATR-based lower line contributes a bearish point.
When the aggregated trend score crosses above zero, it suggests a shift towards a bullish environment; crossing below zero indicates a bearish bias.
// Define Trend scores
var int aad_t = 0
if ta.crossover(src, aad_p)
aad_t := 1
if ta.crossunder(src, aad_m)
aad_t := -1
var int mad_t = 0
if ta.crossover(src, mad_p)
mad_t := 1
if ta.crossunder(src, mad_m)
mad_t := -1
var int stdev_t = 0
if ta.crossover(src, stdev_p)
stdev_t := 1
if ta.crossunder(src, stdev_m)
stdev_t := -1
var int atr_t = 0
if ta.crossover(src, atr_p)
atr_t := 1
if ta.crossunder(src, atr_m)
atr_t := -1
var int adev_t = 0
if ta.crossover(src, adev_p)
adev_t := 1
if ta.crossunder(src, adev_m)
adev_t := -1
int upper_t = src > upper ? 3 : 0
int lower_t = src < lower ? 0 : -3
int upper2_t = src > upper2 ? 1 : 0
int lower2_t = src < lower2 ? 0 : -1
float trend = aad_t + mad_t + stdev_t + atr_t + adev_t + upper_t + lower_t + upper2_t + lower2_t
var float sig = 0
if ta.crossover(trend, 0)
sig := 1
else if ta.crossunder(trend, 0)
sig := -1
Backtesting and Performance Metrics
The code integrates with a backtesting library that allows traders to:
Evaluate the strategy historically
Compare the indicator’s signals with a simple buy-and-hold approach
Generate performance metrics (e.g., mean returns, Sharpe Ratio, Sortino Ratio) to assess historical effectiveness.
Practical Usage and Calibration
Default settings are not optimized: The given parameters serve as a starting point for demonstration. Users should adjust:
len: Affects how smooth and lagging the moving average is.
dev_len and dev_mul: Influence the sensitivity of the deviation measures. Larger multipliers widen the bands, potentially reducing false signals but introducing more lag. Smaller multipliers tighten the bands, producing quicker signals but potentially more whipsaws.
This flexibility allows the trader to tailor the indicator for various markets (stocks, forex, crypto) and time frames.
Disclaimer
No guaranteed results: Historical performance does not guarantee future outcomes. Market conditions can vary widely.
User responsibility: Traders should combine this indicator with other forms of analysis, appropriate risk management, and careful calibration of parameters.
[EmreKb] Santa Clause🎅 Ho Ho Ho! Santa Claus on Your Chart! 🎅
Bring the holiday spirit to your charts with this special Pine Script indicator! Add a cheerful Santa Claus drawing to your charts and celebrate the most wonderful time of the year. 🎄✨
This indicator is purely for fun and designed to spread joy and festive vibes within the Pine Script community. Whether you’re a charting enthusiast or just looking to embrace the holiday cheer, this indicator brings the magic of Santa Claus directly to your charts.
ForecastPro by BinhMyco1. Overview:
This Pine Script implements a custom forecasting tool on TradingView, labeled "BinhMyco." It provides a method to predict future price movements based on historical data and a comparison with similar historical patterns. The script supports two types of forecasts: **Prediction** and **Replication**, where the forecasted price can be either based on price peaks/troughs or an average direction. The script also calculates a confidence probability, showing how closely the forecasted data aligns with historical trends.
2. Inputs:
- Source (`src`): The input data source for forecasting, which defaults to `open`.
- Length (`len`): The length of the training data used for analysis (fixed at 200).
- Reference Length (`leng`): A fixed reference length for comparing similar historical patterns (set to 70).
- Forecast Length (`length`): The length of the forecast period (fixed at 60).
- Multiplier (`mult`): A constant multiplier for the forecast confidence cone (set to 4.0).
- Forecast Type (`typ`): Type of forecast, either **Prediction** or **Replication**.
- Direction Type (`dirtyp`): Defines how the forecast is calculated — either based on price **peaks/troughs** or an **average direction**.
- Forecast Divergence Cone (`divcone`): A boolean option to enable the display of a confidence cone around the forecast.
3. Color Constants:
- Green (`#00ffbb`): Color used for upward price movements.
- Red (`#ff0000`): Color used for downward price movements.
- Reference Data Color (`refcol`): Blue color for the reference data.
- Similar Data Color (`simcol`): Orange color for the most similar data.
- Forecast Data Color (`forcol`): Yellow color for forecasted data.
4. Error Checking:
- The script checks if the reference length is greater than half the training data length, and if the forecast length exceeds the reference length, raising errors if either condition is true.
5. Arrays for Calculation:
- Correlation Array (`c`): Holds the correlation values between the data source (`src`) and historical data points.
- Index Array (`index`): Stores the indices of the historical data for comparison.
6. Forecasting Logic:
- Correlation Calculation: The script calculates the correlation between the historical data (`src`) and the reference data over the given reference length. It then identifies the point in history most similar to the current data.
- Forecast Price Calculation: Based on the type of forecast (Prediction or Replication), the script calculates future prices either by predicting based on similar bars or by replicating past data. The forecasted prices are stored in the `forecastPrices` array.
- Forecast Line Drawing: The script draws lines to represent the forecasted price movements. These lines are color-coded based on whether the forecasted price is higher or lower than the current price.
7. Divergence Cone (Optional):
- If the **divcone** option is enabled, the script calculates and draws a confidence cone around the forecasted prices. The upper and lower bounds of the cone are calculated using a standard deviation factor, providing a visual representation of forecast uncertainty.
8. Probability Table:
- A table is displayed on the chart, showing the probability of the forecast being accurate. This probability is calculated using the correlation between the current data and the most similar historical pattern. If the probability is positive, the table background turns green; if negative, it turns red. The probability is presented as a percentage.
9. Key Functions:
- `highest_range` and `lowest_range`: Functions to find the highest and lowest price within a range of bars.
- `ftype`: Determines the forecast type (Prediction or Replication) and adjusts the forecasting logic accordingly.
- `ftypediff`: Computes the difference between the forecasted and actual prices based on the selected forecast type.
- `ftypelim`, `ftypeleft`, `ftyperight`: Additional functions to adjust the calculation of the forecast based on the forecast type.
10. Conclusion:
The "ForecastPro" script is a unique tool for forecasting future price movements on TradingView. It compares historical price data with similar historical trends to generate predictions. The script also offers a customizable confidence cone and displays the probability of the forecast's accuracy. This tool provides traders with valuable insights into future price action, potentially enhancing decision-making in trading strategies.
---
This script provides advanced functionality for traders who wish to explore price forecasting, and can be customized to fit various trading styles.
All-in-One: VWAP, Ichimoku, EMAs, ADX, RSI + AlertsTitle: All-in-One: VWAP, Ichimoku, EMAs, ADX, RSI + Alerts
Short Title: Multi-Indicator + Alerts
Description:
This script combines several popular trading tools into a single indicator, giving traders a comprehensive view of market conditions alongside convenient alerts. Whether you are monitoring intraday trends, identifying breakouts, or looking for overbought/oversold zones, this script centralizes all the major signals you need.
Features & Options
VWAP (Volume-Weighted Average Price)
Multi-timeframe VWAP on 1H, 4H, and Daily
Helps identify key support/resistance zones based on volume distribution
EMAs (Exponential Moving Averages)
EMAs of 10, 20, 50, and 200 periods (customizable)
Quick visualization of short-term vs. long-term trends
Ichimoku Cloud
Full Ichimoku suite (Tenkan, Kijun, Senkou A/B, Chikou)
Auto-filled cloud for bullish/bearish scenarios
Detect momentum shifts and potential support/resistance zones
RSI & ADX Table
RSI(14) and ADX(14) displayed on a small on-chart table
Compare values across three custom timeframes for multi-timeframe confluence
Labels on Last Bar
Optional labels for VWAP, EMAs, and Ichimoku values on the latest candle
Keeps critical numeric data in sight
Alerts
RSI Overbought/Oversold : Triggers when RSI crosses above/below user-defined thresholds (default 70/30).
ADX Strong Trend : Fires when ADX surpasses a chosen level (default 25), indicating strong momentum.
EMA Cross : Set an alert whenever a faster EMA crosses over or under a slower EMA (default EMA10 vs. EMA50).
Ichimoku Kumo Breakout : Informs you when price closes above or below the Ichimoku cloud.
With everything in one place, this script helps traders streamline their workflow and spot potential opportunities faster. All alert messages are static to ensure compliance with TradingView’s requirement for constant strings in alerts.
Disclaimer:
All trading involves risk. The signals generated by this script do not guarantee profits or prevent losses. Always combine multiple forms of analysis and exercise your own judgment before making any trading decisions.
Volume-Weighted Delta Strategy V1 [Kopottaja]Volume-Weighted Delta Strategy V1
Key Features:
Volume-Weighted Delta:
The strategy calculates a custom delta value based on the difference between the close and open prices, weighted by trading volume. This helps identify strong buying or selling activity.
ATR Channels:
The ATR channels are adjusted dynamically based on the delta value, which adds flexibility to the strategy by accounting for market volatility.
Moving Averages:
The strategy includes moving averages (SMA and EMA) for trend detection and signal confirmation. The 20-period EMA changes color based on the relationship between the delta value and its moving average.
Signal Logic:
Bullish Signals: Generated when the delta moving average crosses above the delta value, and the price crosses above the upper ATR band.
Bearish Signals: Generated when the delta moving average crosses below the delta value, and the price crosses below the lower ATR band.
Exit Conditions: Positions are closed based on reverse crossovers or specific ATR band thresholds.
Customizable Parameters:
Delta length, moving average length, ATR period, and volume thresholds are adjustable to suit various trading styles and instruments.
Optimized for Bitcoin on a 5-Minute Timeframe:
This strategy is particularly effective for trading Bitcoin on a 5-minute timeframe, where its sensitivity to volume and volatility helps capture short-term price movements and breakout opportunities.
Visual Outputs:
EMA plotted with dynamic colors indicating bullish (green) or bearish (red) conditions.
ATR channels (upper and lower bands) plotted in green to outline volatility zones.
Signals are logged in the strategy to automate buy/sell decisions.
This strategy is ideal for traders seeking to incorporate volume and volatility dynamics into their decision-making process, especially for short-term Bitcoin trading. It excels at identifying potential trend reversals and breakout opportunities in both trending and range-bound markets.
Trend Trader-Remastered StrategyOfficial Strategy for Trend Trader - Remastered
Indicator: Trend Trader-Remastered (TTR)
Overview:
The Trend Trader-Remastered is a refined and highly sophisticated implementation of the Parabolic SAR designed to create strategic buy and sell entry signals, alongside precision take profit and re-entry signals based on marked Bill Williams (BW) fractals. Built with a deep emphasis on clarity and accuracy, this indicator ensures that only relevant and meaningful signals are generated, eliminating any unnecessary entries or exits.
Please check the indicator details and updates via the link above.
Important Disclosure:
My primary objective is to provide realistic strategies and a code base for the TradingView Community. Therefore, the default settings of the strategy version of the indicator have been set to reflect realistic world trading scenarios and best practices.
Key Features:
Strategy execution date&time range.
Take Profit Reduction Rate: The percentage of progressive reduction on active position size for take profit signals.
Example:
TP Reduce: 10%
Entry Position Size: 100
TP1: 100 - 10 = 90
TP2: 90 - 9 = 81
Re-Entry When Rate: The percentage of position size on initial entry of the signal to determine re-entry.
Example:
RE When: 50%
Entry Position Size: 100
Re-Entry Condition: Active Position Size < 50
Re-Entry Fill Rate: The percentage of position size on initial entry of the signal to be completed.
Example:
RE Fill: 75%
Entry Position Size: 100
Active Position Size: 50
Re-Entry Order Size: 25
Final Active Position Size:75
Important: Even RE When condition is met, the active position size required to drop below RE Fill rate to trigger re-entry order.
Key Points:
'Process Orders on Close' is enabled as Take Profit and Re-Entry signals must be executed on candle close.
'Calculate on Every Tick' is enabled as entry signals are required to be executed within candle time.
'Initial Capital' has been set to 10,000 USD.
'Default Quantity Type' has been set to 'Percent of Equity'.
'Default Quantity' has been set to 10% as the best practice of investing 10% of the assets.
'Currency' has been set to USD.
'Commission Type' has been set to 'Commission Percent'
'Commission Value' has been set to 0.05% to reflect the most realistic results with a common taker fee value.
ICT RyukEste indicador mostra:
- Principais horários de atuação dos principais mercados do mundo
- Dias da semana
- Fair value Gaps que não foram rebalanceados
O objetivo deste indicador é poder apresentar um contexto ao trade, nos dando a possibilidade de filtrar movimentos e procurar por setups de alta probabilidade. É necessário prévio conhecimento em ICT concepts como Killzones, Power o Three, IDM, Daily bias, liquidity grab, PdArray, Sweeps, etc.
Operar durante o horário das killzones nos darão uma margem maior de segurança. Elas são reflexos da economia, e atuam juntamente com o algoritmo que controla o mercado. Atente-se ao AMD (acumulação, manipulação e distribuição) do Power of Three do semanal e do diário. Observe o Open and Close, High and Low das killzones, junte todos os conceitos do ICT e filtre seus trades, atente-se ao range Semanal e Diario, ao Optimal Trading Zone (62%-78% do movimento), aos sweeps e IDM nos PdArrays e em zonas de liquidez.
Horário de atuação das bolsas:
Domingo das 17:00 às 18:00 de sexta-feira (brasília), sendo
Nova Iorque segunda à sexta: 9:00-13:00 | 15:00-18:00
Sydney Domingo à quinta: 17:00-21:00
Ásia Domingo à quinta: 21:00-01:00
Scalping 3-Min Forecast This is a multi-feature strategy that combines technical analysis, volume tracking, and dynamic visual elements on the chart. Its purpose is to generate buy/sell signals, plot near-future price forecasts, and display important support/resistance zones. Additionally, it monitors buying versus selling volume to add further insight into potential market bias. Below is a detailed explanation of each component:
1. Technical Indicators & Signals
- RSI (Relative Strength Index)
- Stochastic Oscillator
- Moving Average Cross
When RSI, Stoch, and MA-cross conditions align for bullish or bearish signals, the strategy triggers long or short entries accordingly.
2. Price Forecast Projection
It draws forecast lines and a forecast label on the chart to visualize where price might head over the next bars.
The script ensures the forecast lines have reduced opacity for clarity and color-coded based on trend direction (green for bullish, red for bearish).
3. Support & Resistance
- Important S/R (Last 100 Bars)
- Less Important S/R (Last 50 Bars)
4. Volume Tracking & Label
The script sums buy volume (on up-close bars) and sell volume (on down-close bars) starting from the most recent time price touches an important S/R level (100-bar).
Whenever price hits either the 100-bar support or 100-bar resistance, the cumulative volumes reset to 0 and start summing again.
Near the forecast label, the script displays a single additional label indicating “BUY” or “SELL” based on which volume sum (buy vs. sell) is larger:
If sumBuyVol > sumSellVol, the label is green with text “BUY.”
Otherwise, it is red with text “SELL.”
This gives quick insight into whether bulls or bears have dominated since the last major support/resistance touch.
Enhanced SMA Signal Box With TargetsOverview
The Enhanced SMA Signal Box With Targets is a versatile trading indicator designed for scalping any asset or instrument across markets. Combining a 20-period Simple Moving Average (SMA) with ATR-based target levels and advanced filtering options, it provides a streamlined approach to identifying high-probability setups. This tool caters to traders seeking clear signals and adaptive profit targets for fast-paced, disciplined trades.
Key Features
Scalping Focus: Tailored for quick trades on any asset, including indices, forex, commodities, and crypto.
20 SMA-Based Signals: Generates buy/sell signals based on price-SMA crossovers for trend clarity.
Signal Boxes: Highlights entry opportunities with visually distinct yellow boxes.
Adaptive Targets: Plots three ATR-based profit-taking levels for dynamic trade management.
Custom Filters: Refine signals using MACD, RSI, and volume to enhance precision.
Real-Time Alerts: Stay informed with alerts for buy and sell signals.
How It Works
Buy Signal: Triggered when the closing price crosses above the SMA.
Sell Signal: Triggered when the price drops below the SMA.
Profit Targets: Three ATR-based levels guide trade exits dynamically:
Target 1: 1:1 risk-reward based on the signal candle size.
Target 2 & 3: Expanded targets based on ATR.
Customization Options
Adjust SMA settings, colors, and signal visuals for any trading style.
Enable or disable MACD, RSI, and volume filters to suit market conditions.
Personalize target line extensions and colors for improved clarity.
Disclaimer
This indicator is intended for educational purposes only. Trading involves significant risk, including potential loss of capital. Past performance is not indicative of future results. Users should test the indicator and seek advice from licensed professionals before live trading. The author is not liable for any losses incurred. Always trade responsibly.
Nuba 20//@version=6
indicator("Tilson T33", overlay=true)
// Parametreler
b = input.float(title="Factor", defval=0.7)
period = input.int(title="Period", defval=7)
linewidth = input.int(title="Linewidth", defval=3)
solidColor = input.bool(title="Solid Color", defval=false)
// T3 katsayıları
c1 = -b * b * b
c2 = 3 * b * b + 3 * b * b * b
c3 = -6 * b * b - 3 * b - 3 * b * b * b
c4 = 1 + 3 * b + b * b * b + 3 * b * b
// T3 hesaplama fonksiyonu
t3(len) =>
ema1 = ta.ema(close, len) // 1. EMA
ema2 = ta.ema(ema1, len) // 2. EMA
ema3 = ta.ema(ema2, len) // 3. EMA
ema4 = ta.ema(ema3, len) // 4. EMA
ema5 = ta.ema(ema4, len) // 5. EMA
ema6 = ta.ema(ema5, len) // 6. EMA
t3_value = c1 * ema6 + c2 * ema5 + c3 * ema4 + c4 * ema3 // Son T3 hesaplaması
t3_value
// Tilson T3 hesaplama
t3plot = t3(period)
// Trend renk değiştirme
color_t3 = solidColor ? color.aqua : (t3plot > t3plot ? color.green : color.red)
// T3 çizimi
plot(t3plot, color=color_t3, linewidth=linewidth)
// Alarm koşulu: T3 renk değiştiğinde alarm ver
alarm_condition = (t3plot > t3plot and t3plot <= t3plot ) or (t3plot < t3plot and t3plot >= t3plot )
// Alarmı tetikleyin
alertcondition(alarm_condition, title="T3 Renk Değiştirdi", message="Tilson T3 Renk Değiştirdi!")
luusang//@version=5
indicator('Swing', shorttitle='GoodLuck', overlay=true, max_lines_count=500)
//-----Input-------
customTF = input.timeframe(defval="",title = "Show Other TimeFrame")
GroupGann = "Gann"
showGann = input.bool(false, 'Show Gann/Color/Width', group = GroupGann, inline = "Gann1")
colorGann = input.color(color.aqua, '', group = GroupGann,inline = "Gann1")
widthGann = input.int(defval=1,title = "",minval=1,step=1, group = GroupGann,inline = "Gann1")
GroupSGann = "Swing of Gann"
showSGann = input.bool(true, 'Show Swing/Color/Width', group = GroupSGann,inline = "Swing1")
colorSGann = input.color(color.blue, '', group = GroupSGann,inline = "Swing1")
widthSGann = input.int(defval=1,title = "",minval=1,step=1, group = GroupSGann,inline = "Swing1")
showChoCh = input.bool(false, 'Show ChoCh/Color/Width', group = GroupSGann,inline = "Choch")
colorChoch = input.color(color.red, '', group = GroupSGann,inline = "Choch")
widthChoch = input.int(defval=1,title = "",minval=1,step=1, group = GroupSGann,inline = "Choch")
show2ChoCh = input.bool(false, 'Show 2Choch/Color/Width', group = GroupSGann,inline = "2Choch")
color2Choch = input.color(color.purple, '', group = GroupSGann,inline = "2Choch")
width2Choch = input.int(defval=1,title = "",minval=1,step=1, group = GroupSGann,inline = "2Choch")
showtargetOTL = input.bool(true, 'Show Target OTL/Color/Width',group = GroupSGann, inline = "target")
colortargetOTL = input.color(color.purple, '', group = GroupSGann, inline = "target")
widthtargetOTL = input.int(defval=1,title = "",minval=1,step=1, group = GroupSGann,inline = "target")
showLabel = input.bool(false, 'Show Label TimeFrame',group = GroupSGann)
//showLinePrice = input.bool(true, 'Show LinePrice/Color/Width', group = GroupSGann,inline = "LinePrice")
//colorLinePrice = input.color(color.blue, '', group = GroupSGann,inline = "LinePrice")
//widthLinePrice = input.int(defval=1,title = "",minval=1,step=1, group = GroupSGann,inline = "LinePrice")
///tùy chọn line//
lineGann = input.string(title="",options= ,defval='(╌)', group = GroupGann, inline = "Gann1")
lineStyleGann = lineGann == "(┈)" ? line.style_dotted : lineGann == "(╌)" ? line.style_dashed : line.style_solid
lineSGann = input.string(title="",options= ,defval="(─)", group = GroupSGann, inline = "Swing1")
lineStyleSGann = lineSGann == "(┈)" ? line.style_dotted : lineSGann == "(╌)" ? line.style_dashed : line.style_solid
line2Choch = input.string(title="",options= ,defval="(╌)", group = GroupSGann, inline = "2Choch")
lineStyle2Choch = line2Choch == "(┈)" ? line.style_dotted : line2Choch == "(╌)" ? line.style_dashed : line.style_dashed
lineChoch = input.string(title="",options= ,defval="(─)", group = GroupSGann, inline = "Choch")
lineStyleChoch = lineChoch == "(┈)" ? line.style_dotted : lineChoch == "(╌)" ? line.style_dashed : lineChoch == "(←)" ? line.style_arrow_left : lineChoch == "(→)" ? line.style_arrow_right : lineChoch == "(↔)" ? line.style_arrow_both : line.style_solid
linetargetOTL = input.string(title="",options= ,defval="(→)", group = GroupSGann, inline = "target")
lineStyletargetOTL = linetargetOTL == "(┈)" ? line.style_dotted : linetargetOTL == "(╌)" ? line.style_dashed : linetargetOTL == "(←)" ? line.style_arrow_left : linetargetOTL == "(→)" ? line.style_arrow_right : linetargetOTL == "(↔)" ? line.style_arrow_both : line.style_arrow_both
//in out side bar//
OSB_up_down ="Ousidebar up down"
//////////////////////////Global//////////////////////////
var arrayLineTemp = array.new_line()
// Funtion
f_resInMinutes() =>
_resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60. :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 1440. :
timeframe.isweekly ? 10080. :
timeframe.ismonthly ? 43800. : na)
// Converts a resolution expressed in minutes into a string usable by "security()"
f_resFromMinutes(_minutes) =>
_minutes < 1 ? str.tostring(math.round(_minutes*60)) + "S" :
_minutes < 60 ? str.tostring(math.round(_minutes)) + "m" :
_minutes < 1440 ? str.tostring(math.round(_minutes/60)) + "H" :
_minutes < 10080 ? str.tostring(math.round(math.min(_minutes / 1440, 7))) + "D" :
_minutes < 43800 ? str.tostring(math.round(math.min(_minutes / 10080, 4))) + "W" :
str.tostring(math.round(math.min(_minutes / 43800, 12))) + "M"
f_tfRes(_res,_exp) =>
request.security(syminfo.tickerid,_res,_exp,lookahead=barmerge.lookahead_on)
var arrayLineChoCh = array.new_line()
var label labelTF = label.new(time, close, text = "",color = color.new(showSGann ? colorSGann : colorGann,95), textcolor = showSGann ? colorSGann : colorGann,xloc = xloc.bar_time, textalign = text.align_left)
var line lineChoChOTLTarget = line.new(x1= time , y1=close,x2=time, y2= close,color = showSGann ? colortargetOTL : colorGann,xloc = xloc.bar_time,style = lineStyletargetOTL,width = widthtargetOTL)
var line lineBosOTLTarget = line.new(x1= time , y1=close,x2=time, y2= close,color = showSGann ? colortargetOTL : colorGann,xloc = xloc.bar_time,style = lineStyletargetOTL, width = widthtargetOTL)
//var line line_Price = line.new(x1= time , y1=close,x2=time, y2= close,color = showSGann ? colorLinePrice : colorGann,xloc = xloc.bar_time,style = lineStyleLinePrice, width = widthLinePrice)
styleGann = showSGann ? line.style_dashed : line.style_solid
var arrayXGann = array.new_int(5,time)
var arrayYGann = array.new_float(5,close)
var arrayLineGann = array.new_line()
int drawLineGann = 0
_high = high
_low = low
_close = close
_open = open
if(customTF != timeframe.period)
_high := f_tfRes(customTF,high)
_low := f_tfRes(customTF,low)
_close := f_tfRes(customTF,close)
_open := f_tfRes(customTF,open)
highPrev = _high
lowPrev = _low
// drawLineGann => 2:Tiếp tục 1:Đảo chiều; // Outsidebar 2:Tiếp tục 3:Tiếp tục và Đảo chiều 4 : Đảo chiều 2 lần
drawLineGann := 0
if(_high > highPrev and _low > lowPrev )
if(array.get(arrayYGann,0) > array.get(arrayYGann,1))
if(_high <= high)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _high )
drawLineGann := 2
else
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_high )
drawLineGann := 1
else if(_high < highPrev and _low < lowPrev )
if(array.get(arrayYGann,0) > array.get(arrayYGann,1))
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_low )
drawLineGann := 1
else
if(_low >= low)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _low )
drawLineGann := 2
else if(_high >= highPrev and _low < lowPrev or _high > highPrev and _low <= lowPrev )
if(array.get(arrayYGann,0) > array.get(arrayYGann,1))
if(_high >= array.get(arrayYGann,0) and array.get(arrayYGann,1) < _low )
if(_high <= high)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _high )
drawLineGann := 2
else if(_high >= array.get(arrayYGann,0) and array.get(arrayYGann,1) > _low )
if(_close < _open)
if(_high <= high)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _high )
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_low )
drawLineGann := 3
else
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_low )
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_high )
drawLineGann := 4
else if(array.get(arrayYGann,0) < array.get(arrayYGann,1))
if(_low <= array.get(arrayYGann,0) and _high < array.get(arrayYGann,1))
if(_low >= low)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _low )
drawLineGann := 2
else if(_low <= array.get(arrayYGann,0) and _high > array.get(arrayYGann,1))
if(_close > _open)
if(_low >= low)
array.set(arrayXGann, 0, time)
array.set(arrayYGann, 0, _low )
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_high )
drawLineGann := 3
else
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_high )
array.unshift(arrayXGann,time)
array.unshift(arrayYGann,_low )
drawLineGann := 4
else if((_high <= highPrev and _low >= lowPrev ))
highPrev := highPrev
lowPrev := lowPrev
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()) and drawLineGann == 0)
if(array.get(arrayYGann,0) > array.get(arrayYGann,1))
if(array.get(arrayYGann,0) <= high)
array.set(arrayXGann, 0, time)
drawLineGann := 2
else
if(array.get(arrayYGann,0) >= low)
array.set(arrayXGann, 0, time)
drawLineGann := 2
if(showGann and f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineGann == 2)
if(array.size(arrayLineGann) >0)
line.set_xy2(array.get(arrayLineGann,0),array.get(arrayXGann,0),array.get(arrayYGann,0))
else
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,1),array.get(arrayYGann,1),array.get(arrayXGann,0),array.get(arrayYGann,0), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
else if(drawLineGann == 1)
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,1),array.get(arrayYGann,1),array.get(arrayXGann,0),array.get(arrayYGann,0), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
else if(drawLineGann == 3)
if(array.size(arrayLineGann) >0)
line.set_xy2(array.get(arrayLineGann,0),array.get(arrayXGann,1),array.get(arrayYGann,1))
else
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,2),array.get(arrayYGann,2),array.get(arrayXGann,1),array.get(arrayYGann,1), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,1),array.get(arrayYGann,1),array.get(arrayXGann,0),array.get(arrayYGann,0), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
else if(drawLineGann == 4)
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,2),array.get(arrayYGann,2),array.get(arrayXGann,1),array.get(arrayYGann,1), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
array.unshift(arrayLineGann,line.new(array.get(arrayXGann,1),array.get(arrayYGann,1),array.get(arrayXGann,0),array.get(arrayYGann,0), color = colorGann,xloc = xloc.bar_time, style = lineStyleGann,width = widthGann))
//////////////////////////Swing Gann//////////////////////////
var arrayXSGann = array.new_int(5,time)
var arrayYSGann = array.new_float(5,close)
var arrayLineSGann = array.new_line()
int drawLineSGann = 0
int drawLineSGann1 = 0
bool runCheckChoChSGann = false
runCheckChoChSGann := runCheckChoChSGann
if(showSGann)
if(math.max(array.get(arrayYSGann,0),array.get(arrayYSGann,1)) < math.min(array.get(arrayYGann,0),array.get(arrayYGann,1)) or math.min(array.get(arrayYSGann,0),array.get(arrayYSGann,1)) > math.max(array.get(arrayYGann,0),array.get(arrayYGann,1)))
//Khởi tạo bắt đầu
drawLineSGann1 := 5
array.set(arrayXSGann, 0, array.get(arrayXGann,1))
array.set(arrayYSGann, 0, array.get(arrayYGann,1))
array.unshift(arrayXSGann,array.get(arrayXGann,0))
array.unshift(arrayYSGann,array.get(arrayYGann,0))
// drawLineSGann kiểm tra điểm 1 => 13:Tiếp tục có sóng hồi // 12|19(reDraw):Tiếp tục không có sóng hồi // 14:Đảo chiều
if(array.get(arrayXGann,0) == array.get(arrayXGann,1))
if(array.get(arrayXSGann,0) >= array.get(arrayXGann,2) and array.get(arrayYSGann,0) != array.get(arrayYGann,1) and ((array.get(arrayYGann,1) > array.get(arrayYGann,2) and array.get(arrayYSGann,0) > array.get(arrayYSGann,1)) or (array.get(arrayYGann,1) < array.get(arrayYGann,2) and array.get(arrayYSGann,0) < array.get(arrayYSGann,1))))
drawLineSGann1 := 12
array.set(arrayXSGann, 0, array.get(arrayXGann,1))
array.set(arrayYSGann, 0, array.get(arrayYGann,1))
else if(array.get(arrayXSGann,0) <= array.get(arrayXGann,2))
if((array.get(arrayYSGann,0) > array.get(arrayYSGann,1) and array.get(arrayYGann,1) < array.get(arrayYSGann,1)) or (array.get(arrayYSGann,0) < array.get(arrayYSGann,1) and array.get(arrayYGann,1) > array.get(arrayYSGann,1)))
drawLineSGann1 := 14
runCheckChoChSGann := true
array.unshift(arrayXSGann,array.get(arrayXGann,1))
array.unshift(arrayYSGann,array.get(arrayYGann,1))
else if((array.get(arrayYSGann,0) > array.get(arrayYSGann,1) and array.get(arrayYGann,1) > array.get(arrayYSGann,0)) or (array.get(arrayYSGann,0) < array.get(arrayYSGann,1) and array.get(arrayYGann,1) < array.get(arrayYSGann,0)))
drawLineSGann1 := 13
_max = math.min(array.get(arrayYSGann,0),array.get(arrayYSGann,1))
_min = math.max(array.get(arrayYSGann,0),array.get(arrayYSGann,1))
_max_idx = 0
_min_idx = 0
for i = 2 to array.size(arrayXGann)
if(array.get(arrayXSGann,0) >= array.get(arrayXGann,i))
break
if(_min > array.get(arrayYGann,i))
_min := array.get(arrayYGann,i)
_min_idx := array.get(arrayXGann,i)
if(_max < array.get(arrayYGann,i))
_max := array.get(arrayYGann,i)
_max_idx := array.get(arrayXGann,i)
if(array.get(arrayYSGann,0) > array.get(arrayYSGann,1))
array.unshift(arrayXSGann,_min_idx)
array.unshift(arrayYSGann,_min)
else if(array.get(arrayYSGann,0) < array.get(arrayYSGann,1))
array.unshift(arrayXSGann,_max_idx)
array.unshift(arrayYSGann,_max)
array.unshift(arrayXSGann,array.get(arrayXGann,1))
array.unshift(arrayYSGann,array.get(arrayYGann,1))
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
if(array.get(arrayYSGann,0) == array.get(arrayYGann,1) and array.get(arrayXSGann,0) != array.get(arrayXGann,1))
array.set(arrayXSGann, 0, array.get(arrayXGann,1))
drawLineSGann1 := 19
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineSGann1 == 12 or drawLineSGann1 == 19)
if(array.size(arrayLineSGann) >0)
line.set_xy2(array.get(arrayLineSGann,0),array.get(arrayXSGann,0),array.get(arrayYSGann,0))
else
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann, style = lineStyleSGann))
else if(drawLineSGann1 == 14)
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
else if(drawLineSGann1 == 13)
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,2),array.get(arrayYSGann,2),array.get(arrayXSGann,1),array.get(arrayYSGann,1), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
else if(drawLineSGann1 == 15)
if(array.size(arrayLineSGann) >0)
line.set_xy2(array.get(arrayLineSGann,0),array.get(arrayXSGann,1),array.get(arrayYSGann,1))
else
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,2),array.get(arrayYSGann,2),array.get(arrayXSGann,1),array.get(arrayYSGann,1), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
if(runCheckChoChSGann)
runCheckChoChSGann := false
// ChoCh Trường hợp chữ N ngược, chữ N
if((array.get(arrayYSGann,3) > array.get(arrayYSGann,2) and array.get(arrayYSGann,3) < array.get(arrayYSGann,1) and array.get(arrayYSGann,0) < array.get(arrayYSGann,2)) or (array.get(arrayYSGann,3) < array.get(arrayYSGann,2) and array.get(arrayYSGann,3) > array.get(arrayYSGann,1) and array.get(arrayYSGann,0) > array.get(arrayYSGann,2)))
alert(syminfo.ticker + " : " + timeframe.period + " => Swing of Gann ChoCh" + (array.get(arrayYSGann,0) > array.get(arrayYSGann,1) ? "+ ⇑" : "- ⇓"))
if(showChoCh)
array.unshift(arrayLineChoCh,line.new(x1= array.get(arrayXSGann,2) , y1=array.get(arrayYSGann,2),x2=array.get(arrayXSGann,0), y2=array.get(arrayYSGann,2),color = colorChoch,xloc = xloc.bar_time,style = lineStyleChoch,width = widthChoch))
// ChoCh 2 Đầu Trường hợp chữ N ngược, chữ N
if(show2ChoCh and ((array.get(arrayYSGann,1) > array.get(arrayYSGann,3) and array.get(arrayYSGann,3) > array.get(arrayYSGann,4) and array.get(arrayYSGann,4) > array.get(arrayYSGann,2) and array.get(arrayYSGann,2) > array.get(arrayYSGann,0)) or (array.get(arrayYSGann,0) > array.get(arrayYSGann,2) and array.get(arrayYSGann,2) > array.get(arrayYSGann,4) and array.get(arrayYSGann,4) > array.get(arrayYSGann,3) and array.get(arrayYSGann,3) > array.get(arrayYSGann,1))))
line.set_width(array.get(arrayLineSGann,1),width2Choch)
line.set_style(array.get(arrayLineSGann,1), lineStyle2Choch)
line.set_color(array.get(arrayLineSGann,1),color2Choch)
// drawLineSGann kiểm tra điểm 0 => 3:Tiếp tục có sóng hồi // 2|9(reDraw):Tiếp tục không có sóng hồi // 4:Đảo chiều
if(array.get(arrayXSGann,0) >= array.get(arrayXGann,1) and array.get(arrayYSGann,0) != array.get(arrayYGann,0) and ((array.get(arrayYGann,0) > array.get(arrayYGann,1) and array.get(arrayYSGann,0) > array.get(arrayYSGann,1)) or (array.get(arrayYGann,0) < array.get(arrayYGann,1) and array.get(arrayYSGann,0) < array.get(arrayYSGann,1))))
drawLineSGann := 2
array.set(arrayXSGann, 0, array.get(arrayXGann,0))
array.set(arrayYSGann, 0, array.get(arrayYGann,0))
else if(array.get(arrayXSGann,0) <= array.get(arrayXGann,1))
if((array.get(arrayYSGann,0) > array.get(arrayYSGann,1) and array.get(arrayYGann,0) < array.get(arrayYSGann,1)) or (array.get(arrayYSGann,0) < array.get(arrayYSGann,1) and array.get(arrayYGann,0) > array.get(arrayYSGann,1)))
drawLineSGann := 4
runCheckChoChSGann := true
array.unshift(arrayXSGann,array.get(arrayXGann,0))
array.unshift(arrayYSGann,array.get(arrayYGann,0))
else if((array.get(arrayYSGann,0) > array.get(arrayYSGann,1) and array.get(arrayYGann,0) > array.get(arrayYSGann,0)) or (array.get(arrayYSGann,0) < array.get(arrayYSGann,1) and array.get(arrayYGann,0) < array.get(arrayYSGann,0)))
drawLineSGann := 3
_max = math.min(array.get(arrayYSGann,0),array.get(arrayYSGann,1))
_min = math.max(array.get(arrayYSGann,0),array.get(arrayYSGann,1))
_max_idx = 0
_min_idx = 0
for i = 1 to array.size(arrayXGann)
if(array.get(arrayXSGann,0) >= array.get(arrayXGann,i))
break
if(_min > array.get(arrayYGann,i))
_min := array.get(arrayYGann,i)
_min_idx := array.get(arrayXGann,i)
if(_max < array.get(arrayYGann,i))
_max := array.get(arrayYGann,i)
_max_idx := array.get(arrayXGann,i)
if(array.get(arrayYSGann,0) > array.get(arrayYSGann,1))
array.unshift(arrayXSGann,_min_idx)
array.unshift(arrayYSGann,_min)
else if(array.get(arrayYSGann,0) < array.get(arrayYSGann,1))
array.unshift(arrayXSGann,_max_idx)
array.unshift(arrayYSGann,_max)
array.unshift(arrayXSGann,array.get(arrayXGann,0))
array.unshift(arrayYSGann,array.get(arrayYGann,0))
if(f_resInMinutes() < f_tfRes(customTF,f_resInMinutes()))
if(array.get(arrayYSGann,0) == array.get(arrayYGann,0) and array.get(arrayXSGann,0) != array.get(arrayXGann,0))
array.set(arrayXSGann, 0, array.get(arrayXGann,0))
drawLineSGann := 9
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(drawLineSGann == 2 or drawLineSGann == 9)
if(array.size(arrayLineSGann) >0)
line.set_xy2(array.get(arrayLineSGann,0),array.get(arrayXSGann,0),array.get(arrayYSGann,0))
else
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
else if(drawLineSGann == 4)
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
else if(drawLineSGann == 3)
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,2),array.get(arrayYSGann,2),array.get(arrayXSGann,1),array.get(arrayYSGann,1), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
else if(drawLineSGann == 5)
if(array.size(arrayLineSGann) >0)
line.set_xy2(array.get(arrayLineSGann,0),array.get(arrayXSGann,1),array.get(arrayYSGann,1))
else
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,2),array.get(arrayYSGann,2),array.get(arrayXSGann,1),array.get(arrayYSGann,1), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
array.unshift(arrayLineSGann,line.new(array.get(arrayXSGann,1),array.get(arrayYSGann,1),array.get(arrayXSGann,0),array.get(arrayYSGann,0), color = colorSGann,xloc = xloc.bar_time,width = widthSGann,style = lineStyleSGann))
if(runCheckChoChSGann)
runCheckChoChSGann := false
// ChoCh Trường hợp chữ N ngược, chữ N
if((array.get(arrayYSGann,3) > array.get(arrayYSGann,2) and array.get(arrayYSGann,3) < array.get(arrayYSGann,1) and array.get(arrayYSGann,0) < array.get(arrayYSGann,2)) or (array.get(arrayYSGann,3) < array.get(arrayYSGann,2) and array.get(arrayYSGann,3) > array.get(arrayYSGann,1) and array.get(arrayYSGann,0) > array.get(arrayYSGann,2)))
alert(syminfo.ticker + " : " + timeframe.period + " => Swing of Gann ChoCh" + (array.get(arrayYSGann,0) > array.get(arrayYSGann,1) ? "+ ⇑" : "- ⇓"))
if(showChoCh)
array.unshift(arrayLineChoCh,line.new(x1= array.get(arrayXSGann,2) , y1=array.get(arrayYSGann,2),x2=array.get(arrayXSGann,0), y2=array.get(arrayYSGann,2),color = colorChoch,xloc = xloc.bar_time,style = lineStyleChoch,width = widthChoch))
// ChoCh 2 Đầu Trường hợp chữ N ngược, chữ N
if(show2ChoCh and ((array.get(arrayYSGann,1) > array.get(arrayYSGann,3) and array.get(arrayYSGann,3) > array.get(arrayYSGann,4) and array.get(arrayYSGann,4) > array.get(arrayYSGann,2) and array.get(arrayYSGann,2) > array.get(arrayYSGann,0)) or (array.get(arrayYSGann,0) > array.get(arrayYSGann,2) and array.get(arrayYSGann,2) > array.get(arrayYSGann,4) and array.get(arrayYSGann,4) > array.get(arrayYSGann,3) and array.get(arrayYSGann,3) > array.get(arrayYSGann,1))))
line.set_width(array.get(arrayLineSGann,1),width2Choch)
line.set_style(array.get(arrayLineSGann,1),lineStyle2Choch)
line.set_color(array.get(arrayLineSGann,1),color2Choch)
///////////////////////Other//////////////////////////////////
if(f_resInMinutes() <= f_tfRes(customTF,f_resInMinutes()))
if(showSGann)
if(showtargetOTL)
if(drawLineSGann1 == 14)
line.set_xy1(lineChoChOTLTarget,array.get(arrayXSGann,3),array.get(arrayYSGann,3))
line.set_xy2(lineChoChOTLTarget,array.get(arrayXSGann,3),array.get(arrayYSGann,3)*2 - array.get(arrayYSGann,2))
else if(drawLineSGann1 == 13)
line.set_xy1(lineBosOTLTarget,array.get(arrayXSGann,3),array.get(arrayYSGann,3))
line.set_xy2(lineBosOTLTarget,array.get(arrayXSGann,3),array.get(arrayYSGann,3)*2 - array.get(arrayYSGann,2))
if(drawLineSGann == 4)
line.set_xy1(lineChoChOTLTarget,array.get(arrayXSGann,2),array.get(arrayYSGann,2))
line.set_xy2(lineChoChOTLTarget,array.get(arrayXSGann,2),array.get(arrayYSGann,2)*2 - array.get(arrayYSGann,1))
else if(drawLineSGann == 3)
line.set_xy1(lineBosOTLTarget,array.get(arrayXSGann,2),array.get(arrayYSGann,2))
line.set_xy2(lineBosOTLTarget,array.get(arrayXSGann,2),array.get(arrayYSGann,2)*2 - array.get(arrayYSGann,1))
if(showLabel and (barstate.islast or barstate.islastconfirmedhistory))
texLabel = f_resInMinutes() == f_tfRes(customTF,f_resInMinutes()) ? f_resFromMinutes(f_resInMinutes()) : f_resFromMinutes(f_tfRes(customTF,f_resInMinutes()))
label.set_xy(labelTF,array.get(arrayXSGann,0),array.get(arrayYSGann,0))
label.set_text(labelTF,texLabel)
label.set_style(labelTF,array.get(arrayYSGann,0) < array.get(arrayYSGann,1) ? label.style_label_upper_right : label.style_label_lower_right)
else if(showGann)
if(showLabel and (barstate.islast or barstate.islastconfirmedhistory))
texLabel = f_resInMinutes() == f_tfRes(customTF,f_resInMinutes()) ? f_resFromMinutes(f_resInMinutes()) : f_resFromMinutes(f_tfRes(customTF,f_resInMinutes()))
label.set_xy(labelTF,array.get(arrayXGann,0),array.get(arrayYGann,0))
label.set_text(labelTF,texLabel)
label.set_style(labelTF,array.get(arrayYGann,0) < array.get(arrayYGann,1) ? label.style_label_upper_right : label.style_label_lower_right)
///ema///
EMA = "EMA Setting"
len = input.int(21, minval=1, title="EMA Length")
len1= input.int(34, minval=1, title="EMA Length")
len2 = input.int(89, minval=1, title="EMA Length")
len3 = input.int(200, minval=1, title="EMA Length")
src = close
ema = ta.ema(src, len)
ema1 = ta.ema(close,len1) //34
ema2 = ta.ema(close,len2) //89
ema3 = ta.ema (close,len3)//200
up = ema > ema
down = ema < ema
mycolor = up ? #00a7bc : down ? #b91002 : color.blue
plot(ema, title="EMA", color=mycolor, linewidth=1)
//plot(ema1, title="EMA", color=mycolor, linewidth=1,editable = false)
//plot(ema2, title="EMA", color=mycolor, linewidth=1,editable = false)
//plot(ema3, title="EMA", color=mycolor, linewidth=1,editable = false)
table_color_up = color.new(#00a7bc,70)
table_color_down = color.new(#b91002,70)
//vẽ bảng ema + rsi//
t = table.new(position = position.bottom_right, columns = 5, rows = 9, bgcolor = #fde9c9)
table.cell(t, 0, 0, "Time",text_size = size.small)
table.cell(t, 1, 0, "EMA",text_size = size.small)
table.cell(t, 0, 1, "5m",text_size = size.small)
table.cell(t, 0, 2, "15m",text_size = size.small)
table.cell(t, 0, 3, "4h",text_size = size.small)
table.cell(t, 0, 4, "1d",text_size = size.small)
// tính toán giá EMA của các khung thời gian khác nhau
ema5 = request.security(syminfo.tickerid, "5", ta.ema(src, len))
ema15 = request.security(syminfo.tickerid, "15", ta.ema(src, len))
ema4h = request.security(syminfo.tickerid, "240", ta.ema(src, len))
ema1d = request.security(syminfo.tickerid, "D", ta.ema(src, len))
//tô màu cho bảng chứa EMA
ema5_color = ema5 < close ? table_color_up : table_color_down
ema15_color = ema15 < close ? table_color_up :table_color_down
ema4h_color = ema4h < close ? table_color_up : table_color_down
ema1d_color = ema1d < close ? table_color_up : table_color_down
//tính toán ema 123_5
//ema5_1 = request.security(syminfo.tickerid, "5", ta.ema(close, len1))
//ema5_2 = request.security(syminfo.tickerid, "5", ta.ema(close, len2))
//ema5_3 = request.security(syminfo.tickerid, "5", ta.ema(close, len3))
//trend_ema5_color = (ema5_1 > ema5_2 and ema5_2 > ema5_3) ? color.green : (ema5_1 > ema5_2 and ema5_2 < ema5_3)? color.new(color.green,70) : (ema5_1 < ema5_2 and ema5_2 < ema5_3) ? color.red : (ema5_1 < ema5_2 and ema5_2 > ema5_3) ? color.new(color.red,70) : color.orange
//tính toán ema 123_15
ema15_1 = request.security(syminfo.tickerid, "15", ta.ema(close, len1))
ema15_2 = request.security(syminfo.tickerid, "15", ta.ema(close, len2))
ema15_3 = request.security(syminfo.tickerid, "15", ta.ema(close, len3))
trend_ema15_color = (ema15_1 > ema15_2 and ema15_2 > ema15_3) ? color.green : (ema15_1 > ema15_2 and ema15_2 < ema15_3)? color.new(color.green,70) : (ema15_1 < ema15_2 and ema15_2 < ema15_3) ? color.red : (ema15_1 < ema15_2 and ema15_2 > ema15_3) ? color.new(color.red,70) : color.orange
//tính toán ema 123_4h
ema4h_1 = request.security(syminfo.tickerid, "240", ta.ema(close, len1))
ema4h_2 = request.security(syminfo.tickerid, "240", ta.ema(close, len2))
ema4h_3 = request.security(syminfo.tickerid, "240", ta.ema(close, len3))
trend_ema4h_color = (ema4h_1 > ema4h_2 and ema4h_2 > ema4h_3) ? color.green : (ema4h_1 > ema4h_2 and ema4h_2 < ema4h_3)? color.new(color.green,70) : (ema4h_1 < ema4h_2 and ema4h_2 < ema4h_3) ? color.red : (ema4h_1 < ema4h_2 and ema4h_2 > ema4h_3) ? color.new(color.red,70) : color.orange
// tính toán RSI của các khung thời gian khác nhau
rsi5 = request.security(syminfo.tickerid, "5", ta.rsi(src, 14))
rsi15 = request.security(syminfo.tickerid, "15", ta.rsi(src, 14))
rsi4h = request.security(syminfo.tickerid, "240", ta.rsi(src, 14))
rsi1d = request.security(syminfo.tickerid, "D", ta.rsi(src, 14))
//tô màu cho bảng chứa RSI
rsi5_color = rsi5 > 70 ? table_color_down : rsi5 < 30 ? table_color_up : color.orange
rsi15_color = rsi15 > 70 ? table_color_down : rsi15 < 30 ? table_color_up : color.orange
rsi4h_color = rsi4h > 70 ? table_color_down : rsi4h < 30 ? table_color_up : color.orange
rsi1d_color = rsi1d > 70 ? table_color_down : rsi1d < 30 ? table_color_up : color.orange
//tính toán % thay đổi 1d, 7d, 30d
// Lấy giá trị giá đóng cửa của các ngày trước đó
yesterday_close = request.security(syminfo.tickerid, "D", close )
last_week_close = request.security(syminfo.tickerid, "W", close )
last_month_close = request.security(syminfo.tickerid, "M", close )
// Tính toán phần trăm thay đổi giá so với các ngày trước đó
day_change = math.round((close / yesterday_close - 1) * 100,1)
week_change = math.round((close / last_week_close - 1) * 100,1)
month_change = math.round((close / last_month_close - 1) * 100,1)
//tô màu cho bảng chứa % thay đổi
day_change_color = day_change < 0 ? table_color_down : table_color_up
weak_change_color = week_change < 0 ? table_color_down : table_color_up
month_change_color = month_change < 0 ? table_color_down : table_color_up
// tính toán btc.d usdt.d dxy
btc_d = request.security("CRYPTOCAP:BTC.D", timeframe.period, close)
usdt_d = request.security("CRYPTOCAP:USDT.D", timeframe.period, close)
dxy = request.security("TVC:DXY", timeframe.period, close)
yesterday_btc_d = request.security("CRYPTOCAP:BTC.D", timeframe.period, close )
yesterday_usdt_d = request.security("CRYPTOCAP:USDT.D", timeframe.period, close )
yesterday_dxy = request.security("TVC:DXY", timeframe.period, close )
btc_d_color = btc_d < yesterday_btc_d ? table_color_down : table_color_up //too mau
usdt_d_color = usdt_d < yesterday_usdt_d ? table_color_down : table_color_up
dxy_color = dxy < yesterday_dxy ? table_color_down : table_color_up
// điền giá EMA vào bảng
table.cell(t, 1, 1, str.tostring(math.round(ema5, 3)), bgcolor = ema5_color,text_size = size.small)
table.cell(t, 1, 2, str.tostring(math.round(ema15, 3)), bgcolor = ema15_color,text_size = size.small)
table.cell(t, 1, 3, str.tostring(math.round(ema4h, 3)), bgcolor = ema4h_color,text_size = size.small)
table.cell(t, 1, 4, str.tostring(math.round(ema1d, 3)), bgcolor = ema1d_color,text_size = size.small)
// điền rsi vào bảng
show_info_2 = input.bool(title = "Show % RSI",defval = true,group = "Table Setting")
if show_info_2
table.cell(t, 2, 0, "RSI",text_size = size.small)
table.cell(t, 2, 1, str.tostring(math.round(rsi5,0)), bgcolor = rsi5_color,text_size = size.small)
table.cell(t, 2, 2, str.tostring(math.round(rsi15,0)), bgcolor = rsi15_color,text_size = size.small)
table.cell(t, 2, 3, str.tostring(math.round(rsi4h,0)), bgcolor = rsi4h_color,text_size = size.small)
table.cell(t, 2, 4, str.tostring(math.round(rsi1d,0)), bgcolor = rsi1d_color,text_size = size.small)
// điển % change vào bảng
show_info_1 = input.bool(title = "Show % Change 1d, 7d, 30d",defval = true,group = "Table Setting")
if show_info_1
table.cell(t,0,5,"%",text_size = size.small)
table.cell(t,1,5,"1d",text_size = size.small)
table.cell(t,2,5,"7d",text_size = size.small)
table.cell(t,3,5,"30d",text_size = size.small)
table.cell(t, 1, 6, str.tostring(day_change, "#.##") + "%",bgcolor= day_change_color,text_size = size.small)
table.cell(t, 2, 6, str.tostring(week_change, "#.##") + "%",bgcolor = weak_change_color,text_size = size.small)
table.cell(t, 3, 6, str.tostring(month_change,"#.##") + "%", bgcolor = month_change_color,text_size = size.small)
//điện btc.d usdt.d dxy vào bảng
Table_Info = "Table Setting"
show_info = input.bool(title = "Show BTC.D, USSDT, DXY",defval = true,group = "Table Setting")
if show_info
table.cell(t,0,7,"#",text_size = size.small)
table.cell(t,1,7,"BTC.D",text_size = size.small)
table.cell(t,2,7,"USDT.D",text_size = size.small)
table.cell(t,3,7,"DXY",text_size = size.small)
table.cell(t, 1, 8, str.tostring(btc_d, "#.##") + "%",bgcolor= btc_d_color,text_size = size.small)
table.cell(t, 2, 8, str.tostring(usdt_d, "#.##") + "%",bgcolor = usdt_d_color,text_size = size.small)
table.cell(t, 3, 8, str.tostring(dxy,"#.##") + "%", bgcolor = dxy_color,text_size = size.small)
//điền trend ema vào bảng
show_info_3 = input.bool(title = "Show Trend",defval = true,group = "Table Setting")
if show_info_3
table.cell(t,3,0,"Trend",text_size = size.small)
//table.cell(t,3,1,"",bgcolor = trend_ema5_color)
table.cell(t,3,2,"",bgcolor = trend_ema15_color)
table.cell(t,3,3,"",bgcolor = trend_ema4h_color)
//đánh dấu volume với các osb + nến bulish bearish
//indicator("Color Ultra Volume Background", shorttitle = "UV",overlay=true, max_boxes_count=500, max_labels_count=500, max_lines_count=500, max_bars_back=1000)
UltraVol = "Ultra volume background"
colorultravol = input.color(color.new(color.purple,50),"Color UltraVol",group = UltraVol)
//Công thức//
lengthVolumeMA = input.int(20,minval=1,title="Length of MA applied on Volume",group = UltraVol)
ratioUltraVolume = input.float(2.2,minval=1,title="Ultra High Volume Ratio", group = UltraVol)
float volumeMA = 0
volumeMA := nz(volumeMA ) + (volume-nz(volumeMA )) / lengthVolumeMA
ultraHighVolumeMin = volumeMA * ratioUltraVolume
volUltraHigh = volume >= ultraHighVolumeMin? true : false
// Màu volume
color_cande_up_down = input.color(color.new(color.purple,100),"Color UltraVol",group = OSB_up_down)
Candle_body = input.float(0.5, 'Height of Engulfing candle body (%)', group = OSB_up_down)
//scan nến osb-eng - mera mera//
osb_up = high > high and low < low and close > close
osb_down = high > high and low < low and close < close
eng_up = open >= close and close > high and (close - open) >= Candle_body*(high - low)
eng_down = open <= close and close < low and (open - close) >= Candle_body*(high - low)
mm_up = osb_up and close > close and close > close
mm_down = osb_down and close < close and close < close
cande_up = close > close
cande_down = close < close
//tô màu nến//
colorOSB_up = input.color(#0ba4f9,'colorOSB_up',inline = "Up Outside Bar",group = OSB_up_down)
colorOSB_down = input.color(#fd1700,'colorOSB_dowwn',inline = "Down Outside Bar",group = OSB_up_down)
barcolor(osb_up ? colorOSB_up : na, title="Up Outside Bar")
barcolor(osb_down ? colorOSB_down : na, title="Down Outside Bar")
coloreng_up = input.color(#00a7bc,'coloreng_up',inline = "Bullish Bar",group = OSB_up_down)
coloreng_down = input.color(#b91002,'coloreng_dowwn',inline = "Bearlish Bar",group = OSB_up_down)
barcolor(eng_up ? coloreng_up : na, title="Bullish Bar")
barcolor(eng_down ? coloreng_down : na, title="Bearlish Bar")
//đánh dấu vol - mera mera
plotshape(volUltraHigh and cande_up,"Candle_UltraVol_up_shape",style = shape.circle,location = location.belowbar,color = coloreng_up,size = size.tiny)
plotshape(volUltraHigh and cande_down,"Candle_UltraVol_down_shape",style = shape.circle,location = location.abovebar,color = coloreng_down,size = size.tiny)
plotshape(volUltraHigh and osb_up,"Up Outside Bar+ Vol",style = shape.circle,location = location.belowbar,color = color_cande_up_down,size = size.tiny)
plotshape(volUltraHigh and osb_down,"Down Outside Bar+ Vol",style = shape.circle,location = location.abovebar,color = color_cande_up_down,size = size.tiny)
plotshape(volUltraHigh and eng_up,"Bullish Bar + Vol",style = shape.circle,location = location.belowbar,color = color_cande_up_down,size = size.tiny)
plotshape(volUltraHigh and eng_down,"Bearlish + Vol Bar",style = shape.circle,location = location.abovebar,color = color_cande_up_down,size = size.tiny)
plotshape(mm_up ? high : na, style=shape.circle, location=location.belowbar, color=#0ba4f9,title = "Mera UP",size = size.tiny)
plotshape(mm_down ? low : na, style=shape.circle, location=location.abovebar, color=#fd1700, title = "Mera Down", size = size.tiny)
//cảnh báo khi xuất hiện nến/
close_osb_up = close
close_osb_down = close
close_eng_up = close
close_eng_down = close
close_mm_up = close
close_mm_down = close
time_h4 = request.security(syminfo.tickerid, "240",close)
time_D1 = request.security(syminfo.tickerid, "D",close)
if (osb_up and barstate.isconfirmed)
if (close_osb_up > ema)
alert("OSB_UP: Above Ema: " + str.tostring(close_osb_up))
if volUltraHigh
alert("OSB_UP + Volume: Above Ema: " + str.tostring(close_osb_up))
else if (close_osb_up < ema)
alert("OSB_UP: Below Ema: " + str.tostring(close_osb_up))
if volUltraHigh
alert("OSB_UP + Volume: Below Ema: " + str.tostring(close_osb_up))
if (osb_down and barstate.isconfirmed)
if (close_osb_down > ema)
alert("OSB_DOWN: Above Ema: " + str.tostring(close_osb_down))
if volUltraHigh
alert("OSB_DOWN + Volume: Above Ema: " + str.tostring(close_osb_down))
else if (close_osb_down < ema)
alert("OSB_DOWN: Below Ema: " + str.tostring(close_osb_down))
if volUltraHigh
alert("OSB_DOWN + Volume: Below Ema: " + str.tostring(close_osb_down))
if (eng_up and barstate.isconfirmed)
if (close_eng_up > ema)
alert("Bar_UP: Above Ema: " + str.tostring(close_eng_up))
if volUltraHigh
alert("Bar_UP + Volume: Above Ema: " + str.tostring(close_eng_up))
else if (close_eng_up < ema)
alert("Bar_UP: Below Ema: " + str.tostring(close_eng_up))
if volUltraHigh
alert("Bar_UP + Volume: Below Ema: " + str.tostring(close_eng_up))
if (eng_down and barstate.isconfirmed)
if (close_eng_down > ema)
alert("Bar_DOWN: Above Ema: " + str.tostring(close_eng_down))
if volUltraHigh
alert("Bar_DOWN + Volume: Above Ema: " + str.tostring(close_eng_down))
else if (close_eng_down < ema)
alert("Bar_DOWN: Below Ema: " + str.tostring(close_eng_down))
if volUltraHigh
alert("Bar_DOWN + Volume: Below Ema: " + str.tostring(close_eng_down))
if (mm_up and barstate.isconfirmed)
if (close_mm_up > ema)
alert("Mera_UP: Above Ema: " + str.tostring(close_mm_up))
if volUltraHigh
alert("Mera_UP + Volume: Above Ema: " + str.tostring(close_mm_up))
else if (close_mm_up < ema)
alert("Mera_UP: Below Ema: " + str.tostring(close_mm_up))
if volUltraHigh
alert("Mera_UP + Volume: Below Ema: " + str.tostring(close_mm_up))
if (mm_down and barstate.isconfirmed)
if (close_mm_down > ema)
alert("Mera_DOWN: Above Ema: " + str.tostring(close_mm_down))
if volUltraHigh
alert("Mera_DOWN + Volume: Above Ema: " + str.tostring(close_mm_down))
else if (close_mm_down < ema)
alert("Mera_DOWN: Below Ema: " + str.tostring(close_mm_down))
if volUltraHigh
alert("Mera_DOWN + Volume: Below Ema: " + str.tostring(close_mm_down))
//indicator("Initial Balance", shorttitle="Initial Balance", overlay=true, max_bars_back=5000)
ib_session = input.session("2300-0000", title="Initial Balance", group="Calculation period")
show_extra_levels = input.bool(false, "Show extra levels (IBH x2 & IBL x2)", group="Information")
show_intermediate_levels = input.bool(false, "Show intermediate levels (50%)", group="Information")
show_ib_calculation_area = input.bool(false, "Initial balance calculation period coloration", group="Information")
show_labels = input.bool(false, "Show labels", group="Information")
fill_ib_areas = input.bool(false, "Colour IB areas", group="Information")
only_current_levels = input.bool(true, "Only display the current IB Levels", group="Information")
only_current_zone = input.bool(false, "Only display the current IB calculation area", group="Information")
label_size = input.string("Small", title="Label Size", options= , group="Drawings")
lvl_width = input.int(1, "Daily price level width", group="Drawings")
high_col = input.color(color.black, "Initial balance high levels color", group="Drawings")
low_col = input.color(color.black, "Initial balance low levels color", group="Drawings")
middle_col = input.color(#ffa726, "50% initial balance color", group="Drawings")
extend_level = input.string("Right", title="Extend current levels", options= , group="Drawings")
main_levels_style = input.string("Solid" , "Main levels line style", options= , group="Drawings")
ext_levels_style = input.string("Dashed" , "Extended levels line style", options= , group="Drawings")
int_levels_style = input.string("Dotted" , "Intermediate levels line style", options= , group="Drawings")
fill_ib_color= input.color(#b8851faa, "IB area background color", group="Drawings")
ext = extend_level == "Right" ? extend.right : extend_level == "Left" ? extend.left : extend_level == "Both" ? extend.both : extend.none
var delta_history = array.new_float(20)
inSession(sess) => na(time(timeframe.period, sess)) == false
get_line_style(s) =>
s == "Solid" ? line.style_solid : s == "Dotted" ? line.style_dotted : line.style_dashed
get_levels(n) =>
h = high
l = low
for i=1 to n
if low < l
l := low
if high > h
h := high
var line ibh = na
var line ibl = na
var line ibm = na
var line ib_plus = na
var line ib_minus = na
var line ib_plus2 = na
var line ib_minus2 = na
var line ibm_plus = na
var line ibm_minus = na
var label labelh = na
var label labell = na
var label labelm = na
var label label_plus = na
var label label_minus = na
var label label_plus2 = na
var label label_minus2 = na
var label labelm_plus = na
var label labelm_minus = na
var box ib_area = na
labelSize = (label_size == "Huge") ? size.huge :
(label_size == "Large") ? size.large :
(label_size == "Small") ? size.small :
(label_size == "Tiny") ? size.tiny :
(label_size == "Auto") ? size.auto : size.normal
var offset = 0
ins = inSession(ib_session)
bgcolor(show_ib_calculation_area and ins ? #673ab730 : na, title="IB calculation zone")
var float ib_delta = na
if ins
offset += 1
if ins and not ins
= get_levels(offset)
ib_delta := h - l
if array.size(delta_history) >= 20
array.shift(delta_history)
array.push(delta_history, ib_delta)
line.set_extend(ibh, extend.none)
line.set_extend(ibl, extend.none)
if show_intermediate_levels
line.set_extend(ibm, extend.none)
if show_extra_levels
line.set_extend(ib_plus, extend.none)
line.set_extend(ib_minus, extend.none)
line.set_extend(ib_plus2, extend.none)
line.set_extend(ib_minus2, extend.none)
if show_intermediate_levels
line.set_extend(ibm_plus, extend.none)
line.set_extend(ibm_minus, extend.none)
if show_labels
if only_current_levels
label.delete(labelh)
label.delete(labell)
label.delete(labelm)
label.delete(label_plus)
label.delete(label_minus)
label.delete(label_plus2)
label.delete(label_minus2)
label.delete(labelm_plus)
label.delete(labelm_minus)
labelh := label.new(bar_index , h, text="IBH 100%: "+str.tostring(h), style=label.style_none, textcolor=high_col, size=labelSize)
labell := label.new(bar_index , l, text="IBL 0%: "+str.tostring(l), style=label.style_none, textcolor=low_col, size=labelSize)
if show_intermediate_levels
labelm := label.new(bar_index , m, text="IBM 50%: "+str.tostring(m)+" IBΔ: "+str.tostring(h - l), style=label.style_none, textcolor=middle_col, size=labelSize)
if show_extra_levels
label_plus := label.new(bar_index , h + ib_delta, text="IBH x2 - "+str.tostring(h + ib_delta), style=label.style_none, textcolor=high_col, size=labelSize)
label_minus := label.new(bar_index , l - ib_delta, text="IBL x2: "+str.tostring(l - ib_delta), style=label.style_none, textcolor=low_col, size=labelSize)
label_plus2 := label.new(bar_index , h + (ib_delta*2), text="IBH x3 - "+str.tostring(h + (ib_delta*2)), style=label.style_none, textcolor=high_col, size=labelSize)
label_minus2 := label.new(bar_index , l - (ib_delta*2), text="IBL x3: "+str.tostring(l - (ib_delta*2)), style=label.style_none, textcolor=low_col, size=labelSize)
if fill_ib_areas
if only_current_zone
box.delete(ib_area)
ib_area := box.new(bar_index , h, bar_index, l, bgcolor=fill_ib_color, border_color=#00000000)//, extend=ext)
if only_current_levels
line.delete(ibh)
line.delete(ibl)
line.delete(ibm)
line.delete(ib_plus)
line.delete(ib_minus)
line.delete(ib_plus2)
line.delete(ib_minus2)
line.delete(ibm_plus)
line.delete(ibm_minus)
ibh := line.new(bar_index , h, bar_index, h, color=high_col, extend=ext, width=lvl_width, style=get_line_style(main_levels_style))
ibl := line.new(bar_index , l, bar_index, l, color=low_col, extend=ext, width=lvl_width, style=get_line_style(main_levels_style))
if show_intermediate_levels
ibm := line.new(bar_index , m, bar_index, m, color=middle_col, style=get_line_style(int_levels_style), extend=ext, width=lvl_width)
if show_extra_levels
ib_plus := line.new(bar_index , h + ib_delta, bar_index, h + ib_delta, color=high_col, style=get_line_style(ext_levels_style), extend=ext, width=lvl_width)
ib_minus := line.new(bar_index , l - ib_delta, bar_index, l - ib_delta, color=low_col, style=get_line_style(ext_levels_style), extend=ext, width=lvl_width)
ib_plus2 := line.new(bar_index , h + (ib_delta*2), bar_index, h + (ib_delta *2), color=high_col, style=get_line_style(ext_levels_style), extend=ext, width=lvl_width)
ib_minus2 := line.new(bar_index , l - (ib_delta*2), bar_index, l - (ib_delta*2), color=low_col, style=get_line_style(ext_levels_style), extend=ext, width=lvl_width)
if show_intermediate_levels
ibm_plus := line.new(bar_index , h + (ib_delta/2), bar_index, h + (ib_delta/2), color=middle_col, style=get_line_style(int_levels_style), extend=ext, width=lvl_width)
ibm_minus := line.new(bar_index , l - (ib_delta/2), bar_index, l - (ib_delta/2), color=middle_col, style=get_line_style(int_levels_style), extend=ext, width=lvl_width)
offset := 0
if (not ins) and (not ins )
line.set_x2(ibh, bar_index)
line.set_x2(ibl, bar_index)
if show_intermediate_levels
line.set_x2(ibm, bar_index)
if show_extra_levels
line.set_x2(ib_plus, bar_index)
line.set_x2(ib_minus, bar_index)
line.set_x2(ib_plus2, bar_index)
line.set_x2(ib_minus2, bar_index)
if show_intermediate_levels
line.set_x2(ibm_plus, bar_index)
line.set_x2(ibm_minus, bar_index)
var table ib_analytics = table.new(position.bottom_left, 2, 6)
ib_sentiment() =>
h = array.max(delta_history)
l = array.min(delta_history)
a = array.avg(delta_history)
h_comp = ib_delta > h ? ib_delta - h : (ib_delta - h) * -1
l_comp = ib_delta > l ? ib_delta - l : (ib_delta - l) * -1
a_comp = ib_delta > a ? ib_delta - a : (ib_delta - a) * -1
(h_comp < l_comp and h_comp < a_comp) ? "Huge" : (l_comp < h_comp and l_comp < a_comp) ? "Small" : "Medium"
//@version=5
//indicator('Key Levels', overlay=true)
group = 'KEYLVL_SETTINGS'
displaystyle = input.string('Standard', ' Display Style', group = group, inline='onest', options= )
linestyle = input.string('Solid', ' Line Style ', group = group, inline='twost', options= )
fontstyle = input.string('Monospace', ' Font Type ', group = group, inline='trest', options= )
labelpos = input.string('Middle', ' Label Pos ', group = group, inline=' ', options= )
bar_offset = input.int (30, ' Offset ', group = group, inline='onest', minval=0, maxval=450, step = 5)
threshold = input.float (0.1, ' Threshold %', group = group, inline='twost', minval=0, step=0.05, tooltip='Threshold - the distance between the levels after which the labels merge.')
index = input.int (0, ' Index ', group = group, inline='trest', minval=0, step=1, tooltip='Index - Default 0 allows you to see current and past price levels. Changing to 1 will shift the current levels to the previous levels, and the previous levels to the previous levels, etc.')
color_cD = input.color (#2a89c9, ' cD', group = group, inline='cols1')
color_cW = input.color (#b7d123, ' cW', group = group, inline='cols1')
color_cM = input.color (#8056b8, ' cM', group = group, inline='cols1')
color_cQ = input.color (#c23eb0, ' cQ', group = group, inline='cols1')
color_cY = input.color (#d62e28, ' cY', group = group, inline='cols1')
color_pD = input.color (#2a89c9, ' pD', group = group, inline='cols2')
color_pW = input.color (#b7d123, ' pW', group = group, inline='cols2')
color_pM = input.color (#8056b8, ' pM', group = group, inline='cols2')
color_pQ = input.color (#c23eb0, ' pQ', group = group, inline='cols2')
color_pY = input.color (#d62e28, ' pY', group = group, inline='cols2', tooltip="Prefix 'C' = Current/today. Prefix 'P' = Previous/yesterday. Prefix 'D' = Day. Prefix 'W' = Week. Prefix 'M' = Mounth. Prefix 'Q' = Quarterly. Prefix 'Y' = Year.'" )
i_tG = input.bool (true, ' Global Color Text', group = group, inline='colsg')
color_tG = input.color (color.black, ' ', group = group, inline='colsg')
i_lG = input.bool (true, ' Global Color Line', group = group, inline='colsg')
color_lG = input.color (color.black, ' ', group = group, inline='colsg')
fontstyles = switch fontstyle
"Default" => font.family_default
"Monospace" => font.family_monospace
linestyles = switch linestyle
"Solid" => line.style_solid
"Dashed" => line.style_dashed
"Dotted" => line.style_dotted
displaystyles = switch displaystyle
"Standard" => extend.none
"Right" => extend.right
"Both" => extend.both
"Left" => extend.left
getprice(TimeFrame, Index)=> // Get Open, High, Low, Close, Time data
i = Index
tf = TimeFrame
= request.security(syminfo.tickerid, tf, [open , high , low , close , time ], lookahead=barmerge.lookahead_on)
= getprice('D', 0+index) // Get Current Day Open, High, Low, Close, Time
= getprice('W', 0+index) // Get Current Weekly Open, High, Low, Close, Time
= getprice('M', 0+index) // Get Current Mounth Open, High, Low, Close, Time
= getprice('3M', 0+index) // Get Current Quarter Open, High, Low, Close, Time
= getprice('12M', 0+index) // Get Current Year Open, High, Low, Close, Time
= getprice('D', 1+index) // Get Previous Day Open, High, Low, Close, Time
= getprice('W', 1+index) // Get Previous Weekly Open, High, Low, Close, Time
= getprice('M', 1+index) // Get Previous Mounth Open, High, Low, Close, Time
= getprice('3M', 1+index) // Get Previous Quarter Open, High, Low, Close, Time
= getprice('12M', 1+index) // Get Previous Year Open, High, Low, Close, Time
extend(bars) => // Extends the current time by the product of the time difference between elements and the number of bars.
timenow + (time - time ) * bars
getlevel(time, level, txtcolor, linecolor, txtlabel)=> // Get draws a line and a label on the chart
if barstate.islast // The following code doesn't need to be processed on every candle
xindex = displaystyle == 'Standard' ? time : bar_index+bar_offset
xloc = displaystyle == 'Standard' ? xloc.bar_time : xloc.bar_index
xid = displaystyle == 'Standard' ? extend(bar_offset) : bar_index+bar_offset+1
lblpos = labelpos == 'Middle' ? label.style_label_center : label.style_none
lines = line.new (x1=xindex, x2=xid, y1=level, y2=level, xloc=xloc, style=linestyles, extend=displaystyles, color=linecolor)
labels = label.new(x=xid, y=level, text=txtlabel, style=lblpos, xloc=xloc, text_font_family=fontstyles, textcolor=txtcolor, color = #ffffff00)
line.delete(lines ) // remove the previous line when new bar appears
label.delete(labels ) // remove the previous label when new bar appears
// Get Inputs, Lines, Labels
i_cDO = input(false, 'DO ', group = group, inline='D'), = getlevel(cDtime, i_cDO ? cDopen : na, i_tG ? color_tG : color_cD, i_lG ? color_lG : color_cD, 'DO' )
i_cDH = input(false, 'DH ', group = group, inline='D'), = getlevel(cDtime, i_cDH ? cDhigh : na, i_tG ? color_tG : color_cD, i_lG ? color_lG : color_cD, 'DH' )
i_cDL = input(false, 'DL ', group = group, inline='D'), = getlevel(cDtime, i_cDL ? cDlow : na, i_tG ? color_tG : color_cD, i_lG ? color_lG : color_cD, 'DL' )
i_pDO = input(false, 'pDO', group = group, inline='D'), = getlevel(pDtime, i_pDO ? pDopen : na, i_tG ? color_tG : color_pD, i_lG ? color_lG : color_pD, 'pDO' )
i_pDH = input(true, 'pDH', group = group, inline='D'), = getlevel(pDtime, i_pDH ? pDhigh : na, i_tG ? color_tG : color_pD, i_lG ? color_lG : color_pD, 'pDH' )
i_pDL = input(true, 'pDL', group = group, inline='D'), = getlevel(pDtime, i_pDL ? pDlow : na, i_tG ? color_tG : color_pD, i_lG ? color_lG : color_pD, 'pDL' )
i_cWO = input(false, 'WO ', group = group, inline='W'), = getlevel(cWtime, i_cWO ? cWopen : na, i_tG ? color_tG : color_cW, i_lG ? color_lG : color_cW, 'WO' )
i_cWH = input(false, 'WH ', group = group, inline='W'), = getlevel(cWtime, i_cWH ? cWhigh : na, i_tG ? color_tG : color_cW, i_lG ? color_lG : color_cW, 'WH' )
i_cWL = input(false, 'WL ', group = group, inline='W'), = getlevel(cWtime, i_cWL ? cWlow : na, i_tG ? color_tG : color_cW, i_lG ? color_lG : color_cW, 'WL' )
i_pWO = input(false, 'pWO', group = group, inline='W'), = getlevel(pWtime, i_pWO ? pWopen : na, i_tG ? color_tG : color_pW, i_lG ? color_lG : color_pW, 'pWO' )
i_pWH = input(false, 'pWH', group = group, inline='W'), = getlevel(pWtime, i_pWH ? pWhigh : na, i_tG ? color_tG : color_pW, i_lG ? color_lG : color_pW, 'pWH' )
i_pWL = input(false, 'pWL', group = group, inline='W'), = getlevel(pWtime, i_pWL ? pWlow : na, i_tG ? color_tG : color_pW, i_lG ? color_lG : color_pW, 'pWL' )
i_cMO = input(false, 'MO ', group = group, inline='M'), = getlevel(cMtime, i_cMO ? cMopen : na, i_tG ? color_tG : color_cM, i_lG ? color_lG : color_cM, 'MO' )
i_cMH = input(false, 'MH ', group = group, inline='M'), = getlevel(cMtime, i_cMH ? cMhigh : na, i_tG ? color_tG : color_cM, i_lG ? color_lG : color_cM, 'MH' )
i_cML = input(false, 'ML ', group = group, inline='M'), = getlevel(cMtime, i_cML ? cMlow : na, i_tG ? color_tG : color_cM, i_lG ? color_lG : color_cM, 'ML' )
i_pMO = input(false, 'pMO', group = group, inline='M'), = getlevel(pMtime, i_pMO ? pMopen : na, i_tG ? color_tG : color_pM, i_lG ? color_lG : color_pM, 'pMO' )
i_pMH = input(false, 'pMH', group = group, inline='M'), = getlevel(pMtime, i_pMH ? pMhigh : na, i_tG ? color_tG : color_pM, i_lG ? color_lG : color_pM, 'pMH' )
i_pML = input(false, 'pML', group = group, inline='M'), = getlevel(pMtime, i_pML ? pMlow : na, i_tG ? color_tG : color_pM, i_lG ? color_lG : color_pM, 'pML' )
i_cQO = input(false, 'QO ', group = group, inline='Q'), = getlevel(cQtime, i_cQO ? cQopen : na, i_tG ? color_tG : color_cQ, i_lG ? color_lG : color_cQ, 'QO' )
i_cQH = input(false, 'QH ', group = group, inline='Q'), = getlevel(cQtime, i_cQH ? cQhigh : na, i_tG ? color_tG : color_cQ, i_lG ? color_lG : color_cQ, 'QH' )
i_cQL = input(false, 'QL ', group = group, inline='Q'), = getlevel(cQtime, i_cQL ? cQlow : na, i_tG ? color_tG : color_cQ, i_lG ? color_lG : color_cQ, 'QL' )
i_pQO = input(false, 'pQO', group = group, inline='Q'), = getlevel(pQtime, i_pQO ? pQopen : na, i_tG ? color_tG : color_pQ, i_lG ? color_lG : color_pQ, 'pQO' )
i_pQH = input(false, 'pQH', group = group, inline='Q'), = getlevel(pQtime, i_pQH ? pQhigh : na, i_tG ? color_tG : color_pQ, i_lG ? color_lG : color_pQ, 'pQH' )
i_pQL = input(false, 'pQL', group = group, inline='Q'), = getlevel(pQtime, i_pQL ? pQlow : na, i_tG ? color_tG : color_pQ, i_lG ? color_lG : color_pQ, 'pQL' )
i_cYO = input(false, 'YO ', group = group, inline='Y'), = getlevel(cYtime, i_cYO ? cYopen : na, i_tG ? color_tG : color_cY, i_lG ? color_lG : color_cY, 'YO' )
i_cYH = input(false, 'YH ', group = group, inline='Y'), = getlevel(cYtime, i_cYH ? cYhigh : na, i_tG ? color_tG : color_cY, i_lG ? color_lG : color_cY, 'YH' )
i_cYL = input(false, 'YL ', group = group, inline='Y'), = getlevel(cYtime, i_cYL ? cYlow : na, i_tG ? color_tG : color_cY, i_lG ? color_lG : color_cY, 'YL' )
i_pYO = input(false, 'pYO', group = group, inline='Y'), = getlevel(pYtime, i_pYO ? pYopen : na, i_tG ? color_tG : color_pY, i_lG ? color_lG : color_pY, 'pYO' )
i_pYH = input(false, 'pYH', group = group, inline='Y'), = getlevel(pYtime, i_pYH ? pYhigh : na, i_tG ? color_tG : color_pY, i_lG ? color_lG : color_pY, 'pYH' )
i_pYL = input(false, 'pYL', group = group, inline='Y'), = getlevel(pYtime, i_pYL ? pYlow : na, i_tG ? color_tG : color_pY, i_lG ? color_lG : color_pY, 'pYL' )
// Сollecting labels into an array for normalization
labels = array.from(cDOlabel,cDHlabel,cDLlabel,pDOlabel,pDHlabel,pDLlabel,cWOlabel,cWHlabel,cWLlabel,pWOlabel,pWHlabel,pWLlabel,cMOlabel,cMHlabel,cMLlabel,pMOlabel,pMHlabel,pMLlabel,cQOlabel,cQHlabel,cQLlabel,pQOlabel,pQHlabel,pQLlabel,cYOlabel,cYHlabel,cYLlabel,pYOlabel,pYHlabel,pYLlabel)
// This loop merge items in arrays "labels" into a single label if their difference is less than a certain threshold, and updates the label text.
for i = 0 to array.size(labels) - 2 // Loop through all the labels
txt = label.get_text(array.get(labels, i)) // Get the text of the current label
price_i = label.get_y(array.get(labels, i)) // Get the y coordinate of the current label
label_i = array.get(labels, i) // Store the current label
for j = i + 1 to array.size(labels) - 1 // Loop through the remaining labels
price_j = label.get_y(array.get(labels, j)) // Get the y coordinate of the current label
if math.abs(price_i - price_j) < (threshold/100) * price_i // Compare the prices
txt := txt + ' / ' + label.get_text(array.get(labels, j)) // Add the text of the second label
label.delete(array.get(labels, j)) // Delete the second label
label.set_text(label_i, txt) // Set the text of the current label
repeat(str, num) => // Returns a string that is created by repeating the input str num times
res = ""
len = str.length(str)
if num > 0 and len * num <= 4096
for r = 1 to num
res := res + str
res
// Loop to change the position of the Label
if labelpos == 'Middle'
for z = 0 to array.size(labels) - 1
label_z = array.get(labels, z) // Get the label at position z
texts = label.get_text(label_z) // Get the text of the label
spaces = fontstyle=='Default' ? repeat(' ', math.ceil(str.length(texts))*2) : repeat(' ', math.ceil(str.length(texts))) // Calculate the number of spaces needed
label.set_text(label_z, displaystyle=='Right'? texts + spaces + ' ' : spaces+' ' + texts) // Set the label text with the calculated spaces
//
//@version=5
//indicator("Congestion Zone", overlay=true)
Congestion_Zone = "Congestio_Zone"
Show_CZ = input.bool(true, title="On/off Congestion Zone", group="Congestion_Zone")
minbar = input(title="Minimum Bars in Zone", defval=5, group="Congestion_Zone", inline="Box",tooltip = "Số lượng nến tối thiểu để có 1 vùng CZ")
border_width = input.int(title="CZ boder width", defval=1, inline="Box1", group="Congestion_Zone", step=1,tooltip = "Viền CZ")
max_boxes = input.int(title="Max CZ", defval=50, group="Congestion_Zone", minval=1,tooltip = "Số vùng box tối đa muốn hiển thị để tránh rối mắt")
boxcolor_basic = input.color(title="CZ Color Basic", defval=color.new(color.orange, 80), group="Congestion_Zone",tooltip = "Nến thoát khỏi box không có xu hướng rõ ràng")
boxcolor_up = input.color(title="CZ Color Up", defval=color.new(color.green, 80), group="Congestion_Zone",tooltip = "Nến thoát khỏi box có giá đóng cửa > vùng CZ")
boxcolor_down = input.color(title="CZ Color Dowwn", defval=color.new(color.red, 80), group="Congestion_Zone",tooltip = "Nến thoát khỏi box có đóng cửa < vùng CZ")
var boxopen = array.new_float()
var boxclose = array.new_float()
var boxes = array.new_box()
congestion_condition = close >= low and close <= high and open >= low and open <= high
if congestion_condition and Show_CZ
array.push(boxopen, open > close ? open : close)
array.push(boxclose, open > close ? close : open)
else if array.size(boxopen) < minbar
array.clear(boxopen)
array.clear(boxclose)
if not congestion_condition and array.size(boxopen) >= minbar and Show_CZ
box_max = array.max(boxopen)
box_min = array.min(boxclose)
box_color = close >= box_max ? boxcolor_up : close <= box_min ? boxcolor_down : boxcolor_basic
if box_color == boxcolor_basic
alert("CZ basic")
else if box_color == boxcolor_up
alert("CZ UP")
else if box_color == boxcolor_down
alert("CZ DOWN")
// Determine box color based on last candle
new_box = box.new(bar_index - array.size(boxopen), box_max, bar_index - 1, box_min, bgcolor=box_color, border_width=border_width,border_color = box_color)
array.push(boxes, new_box)
array.clear(boxopen)
array.clear(boxclose)
//Remove old boxes if limit is reached
while array.size(boxes) > max_boxes
box.delete(array.shift(boxes))
TS Aggregated Median Absolute DeviationTS Aggregated Median Absolute Deviation (MAD) Indicator Explanation
Overview
The TS Aggregated Median Absolute Deviation (MAD) is a powerful indicator designed for traders looking for momentum-based strategies. By aggregating the Median Absolute Deviation (MAD) across multiple timeframes, it provides a comprehensive view of market dynamics. This indicator helps identify potential reversal points, overbought/oversold conditions, and general market trends by leveraging the concept of MAD, which measures price dispersion from the median.
Signal Generation:
Long Signal: Triggered when the price moves above the aggregated upper band
Short Signal: Triggered when the price moves below the aggregated red band
Alerts:
Real-time alerts are integrated to notify the user of long or short signals when confirmed:
Long Signal Alert: "TS MAD Flipped ⬆LONG⬆"
Short Signal Alert: "TS MAD Flipped ⬇Short⬇"
Optimization:
Adjust thresholds, MAD lengths, and multipliers for each timeframe to suit the specific asset and market conditions.
Experiment with enabling/disabling MAD components to focus on particular timeframes.
RSI Divergence + Sweep + Signal + Alerts Toolkit [TrendX_]The RSI Toolkit is a powerful set of tools designed to enhance the functionality of the traditional Relative Strength Index (RSI) indicator. By integrating advanced features such as Moving Averages, Divergences, and Sweeps, it helps traders identify key market dynamics, potential reversals, and newly-approach trading stragies.
The toolkit expands on standard RSI usage by incorporating features from smart money concepts (Just try to be creative 🤣 Hope you like it), providing a deeper understanding of momentum, liquidity sweeps, and trend reversals. It is suitable for RSI traders who want to make more informed and effective trading decisions.
💎 FEATURES
RSI Moving Average
The RSI Moving Average (RSI MA) is the moving average of the RSI itself. It can be customized to use various types of moving averages, including Simple Moving Average (SMA), Exponential Moving Average (EMA), Relative Moving Average (RMA), and Volume-Weighted Moving Average (VWMA).
The RSI MA smooths out the RSI fluctuations, making it easier to identify trends and crossovers. It helps traders spot momentum shifts and potential entry/exit points by observing when the RSI crosses above or below its moving average.
RSI Divergence
RSI Divergence identifies discrepancies between price action and RSI momentum. There are two types of divergences: Regular Divergence - Indicates a potential trend reversal; Hidden Divergence - Suggests the continuation of the current trend.
Divergence is a critical signal for spotting weakness or strength in a trend. Regular divergence highlights potential trend reversals, while hidden divergence confirms trend continuation, offering traders valuable insights into market momentum and possible trade setups.
RSI Sweep
RSI Sweep detects moments when the RSI removes liquidity from a trend structure by sweeping above or below the price at key momentum level crossing. These sweeps are overlaid on the RSI chart for easier visualized.
RSI Sweeps are significant because they indicate potential turning points in the market. When RSI sweeps occur: In an uptrend - they suggest buyers' momentum has peaked, possibly leading to a reversal; In a downtrend - they indicate sellers’ momentum has peaked, also hinting at a reversal.
(Note: This feature incorporates Liquidity Sweep concepts from Smart Money Concepts into RSI analysis, helping RSI traders identify areas where liquidity has been removed, which often precedes a trend reversal)
🔎 BREAKDOWN
RSI Moving Average
How MA created: The RSI value is calculated first using the standard RSI formula. The MA is then applied to the RSI values using the trader’s chosen type of MA (SMA, EMA, RMA, or VWMA). The flexibility to choose the type of MA allows traders to adjust the smoothing effect based on their trading style.
Why use MA: RSI by itself can be noisy and difficult to interpret in volatile markets. Applying moving average would provide a smoother, more reliable view of RSI trends.
RSI Divergence
How Regular Divergence created: Regular Divergence is detected when price forms HIGHER highs while RSI forms LOWER highs (bearish divergence) or when price forms LOWER lows while RSI forms HIGHER lows (bullish divergence).
How Hidden Divergence created: Hidden Divergence is identified when price forms HIGHER lows while RSI forms LOWER lows (bullish hidden divergence) or when price forms LOWER highs while RSI forms HIGHER highs (bearish hidden divergence).
Why use Divergence: Divergences provide early warning signals of a potential trend change. Regular divergence helps traders anticipate reversals, while hidden divergence supports trend continuation, enabling traders to align their trades with market momentum.
RSI Sweep
How Sweep created: Trend Structure Shift are identified based on the RSI crossing key momentum level of 50. To track these sweeps, the indicator pinpoints moments when liquidity is removed from the Trend Structure Shift. This is a direct application of Liquidity Sweep concepts used in Smart Money theories, adapted to RSI.
Why use Sweep: RSI Sweeps are created to help traders detect potential trend reversals. By identifying areas where momentum has exhausted during a certain trend direction, the indicator highlights opportunities for traders to enter trades early in a reversal or continuation phase.
⚙️ USAGES
Divergence + Sweep
This is an example of combining Devergence & Sweep in BTCUSDT (1 hour)
Wait for a divergence (regular or hidden) to form on the RSI. After the divergence is complete, look for a sweep to occur. A potential entry might be formed at the end of the sweep.
Divergences indicate a potential trend change, but confirmation is required to ensure the setup is valid. The RSI Sweep provides that confirmation by signaling a liquidity event, increasing the likelihood of a successful trade.
Sweep + MA Cross
This is an example of combining Devergence & Sweep in BTCUSDT (1 hour)
Wait for an RSI Sweep to form then a potential entry might be formed when the RSI crosses its MA.
The RSI Sweep highlights a potential turning point in the market. The MA cross serves as additional confirmation that momentum has shifted, providing a more reliable and more potential entry signal for trend continuations.
DISCLAIMER
This indicator is not financial advice, it can only help traders make better decisions. There are many factors and uncertainties that can affect the outcome of any endeavor, and no one can guarantee or predict with certainty what will occur. Therefore, one should always exercise caution and judgment when making decisions based on past performance.
Pivot PointsPivot Points Indicator
The Pivot Points indicator highlights areas on the chart where candles close in opposite colors. These points occur when the price shifts from bullish to bearish, or vice versa, indicating potential reversals or continuation patterns. These points are more easily seen on a line chart and represent areas where the price changes direction to create peak formations.
Foundational Concepts
Before diving into the indicator, it’s important to understand a few key concepts:
When price is trending upward, it creates higher highs and higher lows. Each high or low acts as a pivot point. In an uptrend, the price is more likely to break the previous high (pivot point) and continue higher. You can enter a buy trade when the price breaks the previous high, anticipating the continuation of the trend.
When price is trending downward, it creates lower lows and lower highs. Each high or low is also a pivot point. In a downtrend, the price is more likely to break the previous low (pivot point) and continue lower. You can enter a sell trade when the price breaks the previous low, anticipating the continuation of the trend.
For reversal trades, it’s helpful to be familiar with chart patterns like double tops, double bottoms, and head and shoulders. The Pivot Points indicator can assist in identifying these patterns, helping you determine entry points, as well as where to place your stop loss.
Recommended Setup
It’s recommended to have two charts open side by side: one displaying a line chart and the other showing a candlestick chart, with the Pivot Points indicator applied to both. This setup allows you to easily identify the market structure and price action as it approaches these levels. You can also add a 20-period Simple Moving Average (SMA) to both charts to help identify the overall trend. Additionally, consider adding the Relative Strength Index (RSI) to the line chart to confirm overbought or oversold conditions.
This approach can be used on any timeframe.
Contributing
If you have suggestions, improvements, or bug fixes, I encourage you to submit pull requests. Collaboration helps make the indicator more versatile and useful for everyone.
Disclaimer
Any trading decisions you make are entirely your responsibility.
The MetaTrader 5 version of this indicator is available on my GitHub repository: roshaneforde/pivot-points-indicator
FBands-Parthiban_V2what is Faytterro Bands? it is a channel indicator like "Bollinger Bands". what it does? creates a channel using standard deviations and means. thus giving users an idea about the expensive and cheap zones.
IDL This draws levels that can act potential support and resistance on daily weekly or monthly levels
MM8 Advanced Regression HistogramMM8 Advanced Regression Histogram
Description :
The MM8 Advanced Regression Histogram is a professional-grade TradingView script that combines regression analysis with intuitive visual elements. This tool is designed to help traders identify key price trends, support/resistance zones, and volatility areas in a more efficient and visually appealing manner.
-----------------------------------------------
Key Features:
1. Dynamic Regression Channel:
- Automatically calculates and plots regression channels based on the selected length.
- Uses a customizable multiplier to adjust the channel width, allowing users to adapt to different market conditions.
2. Histogram Visualization:
- Divides the regression channel into customizable bins, helping traders see price distribution across the channel.
- Histogram bars are color-coded to provide clear insights into price activity.
3. Gradient Coloring:
- Smooth gradient colors shift from **blue (upper zone)** to **white (midpoint)** and **red (lower zone)**, giving traders an immediate visual cue about price positioning within the channel.
4. Customizable Style Options:
- Adjustable line styles (solid, dashed, dotted) for regression lines.
- Flexible histogram visibility and color options to suit individual preferences.
5. Real-time Adaptability:
- Automatically updates as new bars are formed, ensuring traders always have the most up-to-date analysis.
-----------------------------------------------
How to Use:
1. Apply the script to any standard candlestick chart
2. Adjust the Length parameter to define the number of candles for regression calculation.
3. Set the Bins Number to divide the channel into segments that suit your trading strategy.
4. Customize the Multiplier to adjust the channel width according to market volatility.
5. Toggle the histogram display and adjust its colors for better visualization.
-----------------------------------------------
Best For:
- Day traders and swing traders looking for precise price analysis tools.
- Traders interested in combining regression analysis with visual histogram insights.
- Identifying key support/resistance zones and potential breakout levels.
-----------------------------------------------
Important Notes:
- This script is designed for educational purposes and should not be used as a standalone trading signal.
- Ensure proper risk management and market understanding while using this tool.
-----------------------------------------------
Why MM8 Advanced Regression Histogram Stands Out:
This script provides a seamless blend of mathematical accuracy and visual simplicity, making it an excellent choice for traders who value both precision and usability.
Pivot Points S/R- Ashish SinghThis indicator is pivot based support and resistance.
modified with the necessary adjustment and setting as required to trade a swing trade.
You just need to apply on the chart.
This indicator will make your work easier for support and resistance
Liquidity Sweep and Order Block StrategyMY FAVORITE startegy pls try. most efficient best MY FAVORITE startegy pls try. most efficient best MY FAVORITE startegy pls try. most efficient best
XYZ
1. Elder Impulse System
The Elder Impulse System uses two indicators:
EMA (to determine trend direction)
MACD Histogram (to measure momentum)
Application:
Green bar: Trend is upward, and momentum is increasing (buy signal).
Red bar: Trend is downward, and momentum is decreasing (sell signal).
Blue bar: Indecision or range-bound movement.
2. VWAP (Volume Weighted Average Price)
VWAP is used to assess whether the price is overvalued or undervalued relative to volume.