MACD+RSI+BBDESCRIPTION
The MACD + RSI + Bollinger Bands Indicator is a comprehensive technical analysis tool designed for traders and investors to identify potential market trends and reversals. This script combines three indicators: the Moving Average Convergence Divergence (MACD), the Relative Strength Index (RSI), and Bollinger Bands. Each of these indicators provides unique insights into market behavior.
FEATURES
MACD (Moving Average Convergence Divergence)
The MACD is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.
The script calculates the MACD line, the signal line, and the histogram, which visually represents the difference between the MACD line and the signal line.
RSI (Relative Strength Index)
The RSI is a momentum oscillator that measures the speed and change of price movements. It ranges from 0 to 100 and is typically used to identify overbought or oversold conditions.
The script allows users to set custom upper and lower thresholds for the RSI, with default values of 70 and 30, respectively.
Bollinger Bands
Bollinger Bands consist of a middle band (EMA) and two outer bands (standard deviations away from the EMA). They help traders identify volatility and potential price reversals.
The script allows users to customize the length of the Bollinger Bands and the multiplier for the standard deviation.
Color-Coding Logic
The histogram color changes based on the following conditions:
Black: If the RSI is above the upper threshold and the closing price is above the upper Bollinger Band, or if the RSI is below the lower threshold and the closing price is below the lower Bollinger Band.
Green (#4caf50): If the RSI is above the upper threshold but the closing price is not above the upper Bollinger Band.
Light Green (#a5d6a7): If the histogram is positive and the RSI is not above the upper threshold.
Red (#f23645): If the RSI is below the lower threshold but the closing price is not below the lower Bollinger Band.
Light Red (#faa1a4): If the histogram is negative and the RSI is not below the lower threshold.
Inputs
Bollinger Bands Settings
Length: The number of periods for the moving average.
Basis MA Type: The type of moving average (SMA, EMA, SMMA, WMA, VWMA).
Source: The price source for the Bollinger Bands calculation.
StdDev: The multiplier for the standard deviation.
RSI Settings
RSI Length: The number of periods for the RSI calculation.
RSI Upper: The upper threshold for the RSI.
RSI Lower: The lower threshold for the RSI.
Source: The price source for the RSI calculation.
MACD Settings
Fast Length: The length for the fast moving average.
Slow Length: The length for the slow moving average.
Signal Smoothing: The length for the signal line smoothing.
Oscillator MA Type: The type of moving average for the MACD calculation.
Signal Line MA Type: The type of moving average for the signal line.
Usage
This indicator is suitable for various trading strategies, including day trading, swing trading, and long-term investing.
Traders can use the MACD histogram to identify potential buy and sell signals, while the RSI can help confirm overbought or oversold conditions.
The Bollinger Bands provide context for price volatility and potential breakout or reversal points.
Example:
From the example, it can clearly see that the Selling Climax and Buying Climax, marked as orange circle when a black histogram occurs.
Conclusion
The MACD + RSI + Bollinger Bands Indicator is a versatile tool that combines multiple technical analysis methods to provide traders with a comprehensive view of market conditions. By utilizing this script, traders can enhance their analysis and improve their decision-making process.
Indikatoren und Strategien
TrigWave Suite [InvestorUnknown]The TrigWave Suite combines Sine-weighted, Cosine-weighted, and Hyperbolic Tangent moving averages (HTMA) with a Directional Movement System (DMS) and a Relative Strength System (RSS).
Hyperbolic Tangent Moving Average (HTMA)
The HTMA smooths the price by applying a hyperbolic tangent transformation to the difference between the price and a simple moving average. It also adjusts this value by multiplying it by a standard deviation to create a more stable signal.
// Function to calculate Hyperbolic Tangent
tanh(x) =>
e_x = math.exp(x)
e_neg_x = math.exp(-x)
(e_x - e_neg_x) / (e_x + e_neg_x)
// Function to calculate Hyperbolic Tangent Moving Average
htma(src, len, mul) =>
tanh_src = tanh((src - ta.sma(src, len)) * mul) * ta.stdev(src, len) + ta.sma(src, len)
htma = ta.sma(tanh_src, len)
Sine-Weighted Moving Average (SWMA)
The SWMA applies sine-based weights to historical prices. This gives more weight to the central data points, making it responsive yet less prone to noise.
// Function to calculate the Sine-Weighted Moving Average
f_Sine_Weighted_MA(series float src, simple int length) =>
var float sine_weights = array.new_float(0)
array.clear(sine_weights) // Clear the array before recalculating weights
for i = 0 to length - 1
weight = math.sin((math.pi * (i + 1)) / length)
array.push(sine_weights, weight)
// Normalize the weights
sum_weights = array.sum(sine_weights)
for i = 0 to length - 1
norm_weight = array.get(sine_weights, i) / sum_weights
array.set(sine_weights, i, norm_weight)
// Calculate Sine-Weighted Moving Average
swma = 0.0
if bar_index >= length
for i = 0 to length - 1
swma := swma + array.get(sine_weights, i) * src
swma
Cosine-Weighted Moving Average (CWMA)
The CWMA uses cosine-based weights for data points, which produces a more stable trend-following behavior, especially in low-volatility markets.
f_Cosine_Weighted_MA(series float src, simple int length) =>
var float cosine_weights = array.new_float(0)
array.clear(cosine_weights) // Clear the array before recalculating weights
for i = 0 to length - 1
weight = math.cos((math.pi * (i + 1)) / length) + 1 // Shift by adding 1
array.push(cosine_weights, weight)
// Normalize the weights
sum_weights = array.sum(cosine_weights)
for i = 0 to length - 1
norm_weight = array.get(cosine_weights, i) / sum_weights
array.set(cosine_weights, i, norm_weight)
// Calculate Cosine-Weighted Moving Average
cwma = 0.0
if bar_index >= length
for i = 0 to length - 1
cwma := cwma + array.get(cosine_weights, i) * src
cwma
Directional Movement System (DMS)
DMS is used to identify trend direction and strength based on directional movement. It uses ADX to gauge trend strength and combines +DI and -DI for directional bias.
// Function to calculate Directional Movement System
f_DMS(simple int dmi_len, simple int adx_len) =>
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)
trur = ta.rma(ta.tr, dmi_len)
plus = fixnan(100 * ta.rma(plusDM, dmi_len) / trur)
minus = fixnan(100 * ta.rma(minusDM, dmi_len) / trur)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adx_len)
dms_up = plus > minus and adx > minus
dms_down = plus < minus and adx > plus
dms_neutral = not (dms_up or dms_down)
signal = dms_up ? 1 : dms_down ? -1 : 0
Relative Strength System (RSS)
RSS employs RSI and an adjustable moving average type (SMA, EMA, or HMA) to evaluate whether the market is in a bullish or bearish state.
// Function to calculate Relative Strength System
f_RSS(rsi_src, rsi_len, ma_type, ma_len) =>
rsi = ta.rsi(rsi_src, rsi_len)
ma = switch ma_type
"SMA" => ta.sma(rsi, ma_len)
"EMA" => ta.ema(rsi, ma_len)
"HMA" => ta.hma(rsi, ma_len)
signal = (rsi > ma and rsi > 50) ? 1 : (rsi < ma and rsi < 50) ? -1 : 0
ATR Adjustments
To minimize false signals, the HTMA, SWMA, and CWMA signals are adjusted with an Average True Range (ATR) filter:
// Calculate ATR adjusted components for HTMA, CWMA and SWMA
float atr = ta.atr(atr_len)
float htma_up = htma + (atr * atr_mult)
float htma_dn = htma - (atr * atr_mult)
float swma_up = swma + (atr * atr_mult)
float swma_dn = swma - (atr * atr_mult)
float cwma_up = cwma + (atr * atr_mult)
float cwma_dn = cwma - (atr * atr_mult)
This adjustment allows for better adaptation to varying market volatility, making the signal more reliable.
Signals and Trend Calculation
The indicator generates a Trend Signal by aggregating the output from each component. Each component provides a directional signal that is combined to form a unified trend reading. The trend value is then converted into a long (1), short (-1), or neutral (0) state.
Backtesting Mode and Performance Metrics
The Backtesting Mode includes a performance metrics table that compares the Buy and Hold strategy with the TrigWave Suite strategy. Key statistics like Sharpe Ratio, Sortino Ratio, and Omega Ratio are displayed to help users assess performance. Note that due to labels and plotchar use, automatic scaling may not function ideally in backtest mode.
Alerts and Visualization
Trend Direction Alerts: Set up alerts for long and short signals
Color Bars and Gradient Option: Bars are colored based on the trend direction, with an optional gradient for smoother visual feedback.
Important Notes
Customization: Default settings are experimental and not intended for trading/investing purposes. Users are encouraged to adjust and calibrate the settings to optimize results according to their trading style.
Backtest Results Disclaimer: Please note that backtest results are not indicative of future performance, and no strategy guarantees success.
W.ARITAS™ Quantum RSIW.ARITAS™ Quantum RSI
Overview
The W.ARITAS™ Quantum RSI is an advanced take on the traditional Relative Strength Index (RSI) tailored for today’s fast-moving markets. This innovative indicator integrates quantum-inspired methodologies and adaptive volatility adjustments, making it a powerful tool for traders who seek to better capture both trend shifts and market reversals. The indicator is suitable for all asset classes and is optimized for dynamic, real-time trading environments.
Features
Volatility-Adaptive RSI: Dynamically adjusts the RSI length based on real-time market volatility, providing a more responsive and smooth RSI.
Quantum Phase Modulation: Adds an additional layer of signal refinement by incorporating wave-like behaviors, helping to capture cyclic market patterns.
Bollinger Bands Integration: Applies enhanced Bollinger Bands around the RSI, with dynamic boundaries that expand or contract based on volatility.
Probability-Based Ripple Effects: Employs gravity and ripple effects to modulate RSI movements, resulting in better identification of critical points.
Gradient Visuals for Clarity: Color gradients represent strength or weakness within RSI ranges, making it easy to spot potential overbought and oversold conditions.
Use Case
This indicator is perfect for traders looking to refine their entries and exits by identifying nuanced shifts in momentum. The enhanced smoothing and volatility sensitivity make it an excellent choice for intraday and swing trading strategies.
License
This indicator is provided under a public license for free use, with no warranty or liability by the developer. Users are advised to trade at their own risk and retain the copyright notice per the license agreement.
NASI +The NASI + indicator is an advanced adaptation of the classic McClellan Oscillator, a tool widely used to gauge market breadth. It calculates the McClellan Oscillator by measuring the difference between the 19-day and 39-day EMAs of net advancing issues, which are optionally adjusted to account for the relative strength of advancing vs. declining stocks.
To enhance this analysis, NASI + applies the Relative Strength Index (RSI) to the cumulative McClellan Oscillator values, generating a unique momentum-based view of market breadth. Additionally, two extra EMAs—a 10-day and a 4-day EMA—are applied to the RSI, providing further refinement to signals for overbought and oversold conditions.
With NASI +, users benefit from:
-A deeper analysis of market momentum through cumulative breadth data.
-Enhanced sensitivity to trend shifts with the applied RSI and dual EMAs.
-Clear visual cues for overbought and oversold conditions, aiding in intuitive signal identification.
Direction finderA trend indicator is a tool used in technical analysis to help identify the direction and strength of a price movement in financial markets. It serves as a guide for traders and investors to understand whether an asset's price is likely to continue moving in a particular direction or if it may reverse. Trend indicators are typically based on historical price data, volume, and sometimes volatility, and they often use mathematical calculations or graphical representations to simplify trend analysis.
Common types of trend indicators include:
Moving Averages (MAs): Averages the asset price over a set period, creating a smooth line that helps identify the general direction of the trend. Popular moving averages include the Simple Moving Average (SMA) and Exponential Moving Average (EMA).
Moving Average Convergence Divergence (MACD): Measures the relationship between two moving averages of an asset’s price, often used to signal trend reversals or continuations based on line crossovers and the direction of the MACD line.
Average Directional Index (ADX): Indicates the strength of a trend rather than its direction. A high ADX value suggests a strong trend, while a low value suggests a weak trend or a range-bound market.
Bollinger Bands: This indicator includes a moving average with bands set at standard deviations above and below. It helps identify price volatility and potential trend reversals when prices move toward the outer bands.
Trend indicators can help identify entry and exit points by suggesting whether a trend is continuing or if the price may be about to reverse. However, they are often used in conjunction with other types of indicators, such as momentum or volume-based tools, to provide a fuller picture of market behavior and confirm trading signals.
Strong 3rd Wave Signal with Filter By DemirkanThis indicator is a unique tool designed to accurately detect market trends and generate strong buy signals. The technical analysis indicators used here not only determine the direction of the trend but also measure the reliability and strength of price movements by combining a series of volume, momentum, and volatility parameters. This allows the detection of strong trend beginnings such as the third wave. This indicator aims to make market analysis more reliable and effective.
Key Indicators and Their Purposes:
The indicator generates strong buy signals by combining the following key indicators. Each indicator analyzes a specific market behavior, and together they provide investors with a reliable signal of a strong trend beginning.
HMA (Hull Moving Average):
Purpose: HMA is an indicator that responds faster than traditional moving averages and provides a smoother trend line. The HMA rising and price being above the HMA are among the most important signals confirming the strength and direction of the trend.
Why It's Used: HMA helps to quickly identify the beginning of a trend, filtering out unnecessary noise and generating accurate buy signals.
RSI (Relative Strength Index):
Purpose: RSI indicates whether the market is in overbought or oversold conditions. In this indicator, RSI being between the neutral zone and overbought shows that the price has not yet reached overbought levels and provides a potential buy opportunity.
Why It's Used: RSI shows the overall momentum of the market. High RSI values indicate overbought conditions, but in this strategy, using the range between neutral and overbought highlights healthy buying opportunities.
ADX (Average Directional Index):
Purpose: ADX measures the strength of the current trend. When the ADX value rises, it indicates a strong trend. This indicator generates buy signals when ADX shows a strong trend.
Why It's Used: ADX confirms not only that the price is rising but also how strong the trend is. This gives investors a clearer understanding of both the direction and strength of the trend.
Volume:
Purpose: High volume supports the reliability of price movements. Volume being 10% higher than the average volume shows that the price movement is strongly supported and that the trend is reliable.
Why It's Used: Volume is a key factor that confirms the accuracy and strength of price movements. High volume indicates that the trend is sustainable, increasing the reliability of buy signals.
EMA 200 (Exponential Moving Average) and SMA 50 (Simple Moving Average):
Purpose: EMA 200 determines the long-term trend direction, while SMA 50 shows short-term movements. When the price is below EMA 200 and above SMA 50, it indicates a strong buy potential.
Why It's Used: EMA 200 tracks the overall long-term trend, while SMA 50 shows short-term movements. The combination of these two indicators suggests that the market is providing a stronger buy signal.
Strong Buy Signal Conditions:
HMA rising and price above HMA: This indicates an upward trend.
RSI between the neutral zone and overbought: The market is not yet in overbought territory, presenting a healthy buying opportunity.
Price above the highest high of the last 10 bars: This shows the price is moving strongly upwards and is at an ideal point for a buy.
Volume 10% higher than the average: High volume supports the price movement and confirms the trend's strength.
ADX showing a strong trend: This confirms the strength of the trend and validates the potential buy signal.
Price below EMA 200 and above SMA 50: This combination indicates a strong buy opportunity.
How the Buy Signal Works:
The indicator generates strong buy signals when all the conditions mentioned above are met. The signal is displayed on the chart as a green arrow and is accompanied by a sound notification to alert the user. The reliability of this signal is ensured through the confirmation provided by the combination of all these indicators.
Why Is This Unique?
This indicator not only combines traditional technical analysis tools, but also integrates each indicator in a way that confirms one another, providing more reliable and accurate signals. By considering both volatility and volume, it measures the true strength and direction of the market. This approach allows for a more robust and accurate analysis, setting it apart from similar indicators.
Conclusion:
This indicator aims to capture the beginning of strong trends and help investors identify the best buying opportunities. By leveraging both traditional indicators and advanced filtering methods, it offers a more in-depth and reliable market analysis. This makes it easier for investors to make stronger and more confident trading decisions.
Rikki's DikFat Bull/Bear OscillatorRikki's DikFat Bull/Bear Oscillator - Trend Identification & Candle Colorization
Rikki's DikFat Bull/Bear Oscillator is a powerful visual tool designed to help traders easily identify bullish and bearish trends on the chart. By analyzing market momentum using specific elements of the Commodity Channel Index (CCI) , this indicator highlights key trend reversals and continuations with color-coded candles, allowing you to quickly spot areas of opportunity.
How It Works
At the heart of this indicator is the Commodity Channel Index (CCI) , a popular momentum-based oscillator. The CCI measures the deviation of price from its average over a specified period (default is 30 bars). This helps identify whether the market is overbought, oversold, or trending.
Here's how the indicator interprets the CCI:
Bullish Trend (Green Candles) : When the market is showing signs of continued upward momentum, the candles turn green. This happens when the current CCI is less than 200 and moves from a value greater than 100 with velocity, signaling that the upward trend is still strong, and the market is likely to continue rising. Green candles indicate bullish price action , suggesting it might be a good time to look for buying opportunities or hold your current long position.
Bearish Trend (Red Candles) : Conversely, when the CCI shows signs of downward momentum (both the current and previous CCI readings are negative), the candles turn red. This signals that the market is likely in a bearish trend , with downward price action expected to continue. Red candles are a visual cue to consider selling opportunities or to stay out of the market if you're risk-averse.
How to Use It
Bullish Market : When you see green candles, the market is in a bullish phase. This suggests that prices are moving upward, and you may want to focus on buying signals . Green candles are your visual confirmation of a strong upward trend.
Bearish Market : When red candles appear, the market is in a bearish phase. This indicates that prices are moving downward, and you may want to consider selling or staying out of long positions. Red candles signal that downward pressure is likely to continue.
Why It Works
This indicator uses momentum to identify shifts in trend. By tracking the movement of the CCI , the oscillator detects whether the market is trending strongly or simply moving in a sideways range. The color changes in the candles help you quickly visualize where the market momentum is headed, giving you an edge in determining potential buy or sell opportunities.
Clear Visual Signals : The green and red candles make it easy to follow market trends, even for beginners.
Identifying Trend Continuations : The oscillator helps spot ongoing trends, whether bullish or bearish, so you can align your trades with the prevailing market direction.
Quick Decision-Making : By using color-coded candles, you can instantly know whether to consider entering a long (buy) or short (sell) position without needing to dive into complex indicators.
NOTES This indicator draws and colors it's own candles bodies, wicks and borders. In order to have the completed visualization of red and green trends, you may need to adjust your TradingView chart settings to turn off or otherwise modify chart candles.
Conclusion
With Rikki's DikFat Bull/Bear Oscillator , you have an intuitive and easy-to-read tool that helps identify bullish and bearish trends based on proven momentum indicators. Whether you’re a novice or an experienced trader, this oscillator allows you to stay in tune with the market’s direction and make more informed, confident trading decisions.
Make sure to use this indicator in conjunction with your own trading strategy and risk management plan to maximize your trading potential and limit your risks.
OTI-Options Trading IndicatorThis Pine Script strategy, "Enhanced Multiple Indicators Strategy (EMIS)," utilizes multiple technical indicators to generate trade signals. The strategy combines signals from moving averages, RSI, MACD, Bollinger Bands, Stochastic Oscillator, and ATR to evaluate market conditions and make informed trading decisions. This approach aims to capture strong buy and sell signals by aggregating the insights of these indicators into a scoring system, which helps filter out weaker signals and identify high-probability trades.
Indicators Used:
Simple Moving Average (SMA):
Measures the average closing price over a specified period (MA Length) to assess trend direction.
Relative Strength Index (RSI):
An oscillator that identifies overbought and oversold conditions based on RSI Length.
Overbought level is set at 70, and oversold level at 30.
Moving Average Convergence Divergence (MACD):
MACD line and Signal line are used for crossover signals, indicating potential momentum shifts.
Configured with MACD Fast Length, MACD Slow Length, and MACD Signal Length.
Bollinger Bands (BB):
This indicator uses a moving average and standard deviation to set upper and lower bands.
Upper and lower bands help indicate volatility and potential reversal zones.
Stochastic Oscillator:
Measures the position of the close relative to the high-low range over a specified period.
Uses a Stoch Length to determine trend momentum and reversal points.
Average True Range (ATR):
Measures volatility over a specified period to indicate potential breakouts and trend strength.
ATR Length determines the range for the current market.
Score Calculation:
Each indicator contributes a score based on its current signal:
Moving Average (MA): If the price is above the MA, it adds +5; otherwise, -5.
RSI: +10 if oversold, -10 if overbought, and 0 if neutral.
MACD: +5 for a bullish crossover, -5 for a bearish crossover.
Bollinger Bands: +5 if below the lower band, -5 if above the upper band, and 0 if within bands.
Stochastic: +5 if %K > %D (bullish), -5 if %K < %D (bearish).
ATR: Adjusted to detect increased volatility (e.g., recent close above previous close plus ATR).
The final score is a combination of these scores:
If the score is between 5 and 10, a Buy order is triggered.
If the score is between -5 and -10, the position is closed.
Usage Notes:
Adjust indicator lengths and levels to fit specific markets.
Back test this strategy on different timeframes to optimize results.
This script can be a foundation for more complex trading systems by tweaking scoring methods and indicator parameters.
Please Communicate Your Trading Results And Back Testing Score On-
manjunath0honmore@gmail.com
Tele-@tbmlh
Trend Trader-RemasteredThe script was originally coded in 2018 with Pine Script version 3, and it was in invite only status. It has been updated and optimised for Pine Script v5 and made completely open source.
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.
Key Features
1) Parabolic SAR-Based Entry Signals:
This indicator leverages an advanced implementation of the Parabolic SAR to create clear buy and sell position entry signals.
The Parabolic SAR detects potential trend shifts, helping traders make timely entries in trending markets.
These entries are strategically aligned to maximise trend-following opportunities and minimise whipsaw trades, providing an effective approach for trend traders.
2) Take Profit and Re-Entry Signals with BW Fractals:
The indicator goes beyond simple entry and exit signals by integrating BW Fractal-based take profit and re-entry signals.
Relevant Signal Generation: The indicator maintains strict criteria for signal relevance, ensuring that a re-entry signal is only generated if there has been a preceding take profit signal in the respective position. This prevents any misleading or premature re-entry signals.
Progressive Take Profit Signals: The script generates multiple take profit signals sequentially in alignment with prior take profit levels. For instance, in a buy position initiated at a price of 100, the first take profit might occur at 110. Any subsequent take profit signals will then occur at prices greater than 110, ensuring they are "in favour" of the original position's trajectory and previous take profits.
3) Consistent Trend-Following Structure:
This design allows the Trend Trader-Remastered to continue signaling take profit opportunities as the trend advances. The indicator only generates take profit signals in alignment with previous ones, supporting a systematic and profit-maximising strategy.
This structure helps traders maintain positions effectively, securing incremental profits as the trend progresses.
4) Customisability and Usability:
Adjustable Parameters: Users can configure key settings, including sensitivity to the Parabolic SAR and fractal identification. This allows flexibility to fine-tune the indicator according to different market conditions or trading styles.
User-Friendly Alerts: The indicator provides clear visual signals on the chart, along with optional alerts to notify traders of new buy, sell, take profit, or re-entry opportunities in real-time.
Volume Flow ConfluenceVolume Flow Confluence (CMF-KVO Integration)
Core Function:
The Volume Flow Confluence Indicator combines two volume-analysis methods: Chaikin Money Flow (CMF) and the Klinger Volume Oscillator (KVO). It displays a histogram only when both indicators align in their respective signals.
Signal States:
• Green Bars: CMF is positive (> 0) and KVO is above its signal line
• Red Bars: CMF is negative (< 0) and KVO is below its signal line
• No Bars: When indicators disagree
Technical Components:
Chaikin Money Flow (CMF):
Measures the relationship between volume and price location within the trading range:
• Calculates money flow volume using close position relative to high/low range
• Aggregates and normalizes over specified period
• Default period: 20
Klinger Volume Oscillator (KVO):
Evaluates volume in relation to price movement:
• Tracks trend changes using HLC3
• Applies volume force calculation
• Uses two EMAs (34/55) with a signal line (13)
Practical Applications:
1. Signal Identification
- New colored bars after blank periods show new agreement between indicators
- Color intensity differentiates new signals from continuations
- Blank spaces indicate lack of agreement
2. Trend Analysis
- Consecutive colored bars show continued indicator agreement
- Transitions between colors or to blank spaces show changing conditions
- Can be used alongside other technical analysis tools
3. Risk Considerations
- Signals are not predictive of future price movement
- Should be used as one of multiple analysis tools
- Effectiveness may vary across different markets and timeframes
Technical Specifications:
Core Algorithm
CMF = Σ(((C - L) - (H - C))/(H - L) × V)n / Σ(V)n
KVO = EMA(VF, 34) - EMA(VF, 55)
Where VF = V × |2(dm/cm) - 1| × sign(Δhlc3)
Signal Line = EMA(KVO, 13)
Signal Logic
Long: CMF > 0 AND KVO > Signal
Short: CMF < 0 AND KVO < Signal
Neutral: All other conditions
Parameters
CMF Length = 20
KVO Fast = 34
KVO Slow = 55
KVO Signal = 13
Volume = Regular/Actual Volume
Data Requirements
Price Data: OHLC
Volume Data: Required
Minimum History: 55 bars
Recommended Timeframe: ≥ 1H
Credits:
• Marc Chaikin - Original CMF development
• Stephen Klinger - Original KVO development
• Alex Orekhov (everget) - CMF script implementation
• nj_guy72 - KVO script implementation
Exact Three Black Crows and Three White SoldiersExact Three Black Crows and Three White Soldiers
where you can find 3 red and 3 green candle bars
Through these pattern, we can identify the trend reversal
50MA ATR BANDSDescription: This indicator plots ATR bands around a 50-period EMA across multiple timeframes (15-minute, hourly, daily, weekly, and monthly). It offers traders a visual guide to potential price ranges using volatility-based calculations:
1.ATR Calculations: Based on selected timeframes for finer analysis.
2.EMA Calculations: 50-period EMA to track trend direction.
3.Customization: Line width, display mode (Auto/User-defined), and plot styles.
Usage: This tool helps identify potential support and resistance levels with ATR-based bands, making it a valuable addition to trend-following and volatility strategies.
ORB with Buy and Sell Signals BY NAT LOGThis indicator for intraday when first candle of high and low breaches generate buy and sell signals, target should be earlier previous day first 15 min high or low
Kalman Based VWAP [EdgeTerminal]Kalman VWAP is a different take on volume-weighted average price (VWAP) indicator where we enhance the results with Kalman filtering and dynamic wave visualization for a more smooth and improved trend identification and volatility analysis.
A little bit about Kalman Filter:
Kalman filtering (also known as linear quadratic estimation) is an algorithm that uses a series of measurements observed over time, including statistical noise and other inaccuracies, to produce estimates of unknown variables that tend to be more accurate than those based on a single measurement, by estimating a joint probability distribution over the variables for each time-step. The filter is constructed as a mean squared error minimiser, but an alternative derivation of the filter is also provided showing how the filter relates to maximum likelihood statistics
This indicator combines:
Volume-Weighted Average Price (VWAP) for institutional price levels
Kalman filtering for noise reduction and trend smoothing
Dynamic wave visualization for volatility zones
This creates a robust indicator that helps traders identify trends, support/resistance zones, and potential reversal points with high precision.
What makes this even more special is the fact that we use open price as a data source instead of usual close price. This allows you to tune the indicator more accurately when back testing it and generally get results that are closer to real time market data.
The math:
In case if you're interested in the math of this indicator, the indicator employs a state-space Kalman filter model:
State Equation: x_t = x_{t-1} + w_t
Measurement Equation: z_t = x_t + v_t
x_t is the filtered VWAP state
w_t is process noise ~ N(0, Q)
v_t is measurement noise ~ N(0, R)
z_t is the traditional VWAP measurement
The Kalman filter recursively updates through:
Prediction: x̂_t|t-1 = x̂_{t-1}
Update: x̂_t = x̂_t|t-1 + K_t(z_t - x̂_t|t-1)
Where K_t is the Kalman gain, optimally balancing between prediction and measurement.
Input Parameters
Measurement Noise: Controls signal smoothing (0.0001 to 1.0)
Process Noise: Adjusts trend responsiveness (0.0001 to 1.0)
Wave Size: Multiplier for volatility bands (0.1 to 5.0)
Trend Lookback: Period for trend determination (1 to 100)
Bull/Bear Colors: Customizable color schemes
Application:
I recommend using this along other indicators. This is best used for assets that don't have a close time, such as BTC but can be used with anything as long as the data is there.
With default settings, this works better for swing trades but you can adjust it for day trading as well, by adjusting the lookback and also process noise.
Daily CRTDaily CRT Indicator
The Daily CRT Indicator is a custom technical analysis tool designed to help traders identify and visualize key price patterns on the daily timeframe. Specifically, it detects and marks the "Sweep and Close Inside" pattern, which is a price action pattern that can signal potential trading opportunities.
Key Features:
Pattern Detection:
The indicator detects two specific price action patterns:
Sweep and Close Above: When the current price sweeps above the previous day’s high and closes inside the range, indicating a potential bullish breakout or continuation.
Sweep and Close Below: When the current price sweeps below the previous day’s low and closes inside the range, signaling a potential bearish move.
Horizontal Lines:
The indicator automatically draws horizontal lines at the previous day’s high and low levels whenever a pattern is detected, providing a visual reference for key support and resistance zones.
These lines are displayed in real-time on the chart and adjust dynamically as new patterns form.
Customizable Line Appearance:
Choose the color, thickness, and style (solid, dashed, or dotted) of the lines to fit your preferred chart aesthetic.
Alert System:
The indicator comes with built-in alerts. Set an alert to notify you when the Sweep and Close Inside pattern is detected, helping you stay on top of potential trade setups.
History Management:
Show History: Optionally display the detected patterns on previous bars (past patterns).
Customizable History Duration: Control how far back you want to view the patterns, allowing you to adjust for a cleaner chart and focus on the most recent setups.
Visual Labels:
When the pattern is detected, the indicator can display a label under the bar (customizable) to highlight the occurrence of the pattern, making it easier for traders to spot potential trade signals.
Built for the Daily Timeframe:
This indicator is specifically designed to work on the daily timeframe and is ideal for swing traders and longer-term traders who are focused on the daily price action and want to capture patterns that indicate potential market reversals or breakouts.
How It Works:
The indicator monitors the previous day's price action and looks for situations where the current price action either sweeps the previous day's high or low and then closes inside the range of the previous day's bar. This type of price movement can often signal that a reversal or continuation is about to occur. The indicator marks these setups by drawing horizontal lines and optionally displays labels for quick identification.
Settings & Customization:
Line Color: Customize the color of the lines marking the previous day’s high and low.
Line Thickness: Choose from different thickness levels for better visibility.
Line Style: Pick from solid, dashed, or dotted styles.
Show History: Toggle the display of historical patterns, with the option to control how many days back to show.
Show Labels: Option to toggle the display of labels when the pattern is detected.
Alert Condition: Receive alerts when a pattern is detected, ensuring you never miss a trade opportunity.
Ideal For:
Swing Traders: This indicator is perfect for traders looking to capture swings in the market based on daily price action.
Pattern Traders: Those who trade based on specific chart patterns will benefit from this tool, as it identifies important reversal and breakout signals.
Technical Analysts: Anyone who incorporates price action patterns into their strategy can use this tool as a supplemental analysis tool to improve their trading decisions.
By using the Daily CRT Indicator, you’ll have a powerful tool to help you spot important price action patterns that may indicate key market moves. Whether you're looking to catch breakouts, reversals, or simply track significant support and resistance levels, this indicator is a versatile addition to your trading toolkit.
This description provides a clear understanding of how the Daily CRT Indicator works and what value it offers, making it easy for traders to know if it fits their trading style. Feel free to tweak the description further depending on the details you’d like to emphasize.
Soorfin on LiqsRefined liquidation indicator
- Last highs (given on a period)
- Last lows (same)
- Custom price
- Live price
This is a refined liquidation indicator more customizable and better.
Credits goes to @mabonyi for the original idea.
PRADEEP Scalping Buy/Sell TIME FRAME : 5MIN ONLY
BUY : Only above EMA 50 ( Higher Probabilities above VWAP and EMA 50)
SELl : Only below EMA 50 ( Higher Probabilities below VWAP and EMA 50)
3 CANDLE SUPPLY/DEMANDExplanation of the Code:
Demand Zone Logic: The script checks if the second candle closes below the low of the first candle and the third candle closes above both the highs of the first and second candles.
Zone Plotting: Once the pattern is identified, a demand zone is plotted from the low of the first candle to the high of the third candle, using a dashed green line for clarity.
Markers: A small triangle marker is added below the bars where a demand zone is detected for easy visualization.
Efficient Logic: The script checks the conditions for demand zone formation for every three consecutive candles on the chart.
This approach should be both accurate and efficient in plotting demand zones, making it easier to spot potential support levels on the chart.
MERCURY by DrAbhiramSivprasad"MERCURY by DrAbhiramSivprasad"
Developed from over 10 years of personal trading experience, the Mercury Indicator is a strategic tool designed to enhance accuracy in trading decisions. Think of it as a guiding light—a supportive tool that helps traders refine and build more robust strategies by integrating multiple powerful elements into a single indicator. I’ll be sharing some examples to illustrate how I use this indicator in my own trading journey, highlighting its potential to improve strategy accuracy.
Reason behind the combination of emas , cpr and vwap is it provides very good support and resistance in my trading carrier so now i brought them together in one plate
How It Works:
Mercury combines three essential elements—EMA, VWAP, and CPR—each of which plays a vital role in detecting support and resistance:
Exponential Moving Averages (EMAs): Known for their strength in providing dynamic support and resistance levels, EMAs help in identifying trends and shifts in momentum. This indicator includes a dashboard with up to nine customizable EMAs, showing whether each is acting as support or resistance based on real-time price movement.
Volume Weighted Average Price (VWAP): VWAP also provides valuable support and resistance, often regarded as a fair price level by institutional traders. Paired with EMAs, it forms a dual-layered support/resistance system, adding an additional level of confirmation.
Central Pivot Range (CPR): By combining CPR with EMAs and VWAP, Mercury highlights “traffic blocks” in your target journey. This means it identifies zones where price is likely to stall or reverse, providing additional guidance for navigating entries and exits.
Why This Combination Matters:
Using these three tools together gives you a more complete view of the market. VWAP and EMAs offer dynamic trend direction and support/resistance, while CPR pinpoints critical price zones. This combination helps you find high-probability trades, adding clarity to complex market situations and enabling stronger confirmation on trend or reversal decisions.
How to Use:
Trend Confirmation: Check if all EMAs are aligned (green for uptrend, red for downtrend), which is visible in the EMA dashboard. An alignment across VWAP, CPR, and EMAs signifies high confidence in trend direction.
Breakouts & Breakdowns: Mercury has an alert system to signal when a price breakout or breakdown occurs across VWAP, EMA1, and EMA2. This can help in spotting strong directional moves.
Example Application: In my trading, I use Mercury to identify support/resistance zones, confirming trends with EMA/VWAP alignment and using CPR as a checkpoint. I find this especially useful for day trading and swing setups.
Recommended Timeframes:
Day Trading: 5 to 15-minute charts for swift, actionable insights.
Swing Trading: 1-hour or 4-hour charts for broader trend analysis.
Note:
The Mercury Indicator should be used as a supportive tool rather than a standalone strategy, guiding you toward informed decisions in line with your trading style and goals.
EXAMPLE OF TRADE
you can see the cart of XAUUSD on 11th nov 2024
1.SHORT POSITION - TIME FRAME 15 MIN
So here for a short position you need to wait for a breakdown candle which will print in orange post the candle you need to check ema dashboard is completly red that indicates no traffic blocks in your journey to destiny target from ema's and you can take the target from nearest cpr support line
TAKEN IN XAUUSD you can see in chart of XAUUSD on 7th nov
2.LONG POSITION - TIME FRAME 15 MIN -
So here for long position you need to wait for a breakout candle from indicator thats here is blue and check all ema boxes are green and candle body should close above all the 3 lines here it is the both ema 1 and 2 and the vwap line then you can take and entry and your target will be the nearest resistance from the daily cpr
3. STOP LOSS CRITERIA
After the entry any candle close below any of the last line from entry for example we have 3 lines vwap and ema 1 and 2 lines and u have made an entry and the last line before the entry is vwap then if any candle closes below vwap can be considered as stoploss like wise in any lines
The MERCURY indicator is a comprehensive trading tool designed to enhance traders' ability to identify trends, breakouts, and reversals effectively. Created by Dr. Abhiram Sivprasad, this indicator integrates several technical elements, including Central Pivot Range (CPR), EMA crossovers, VWAP levels, and a table-based EMA dashboard, to offer a holistic trading view.
Core Components and Functionality:
Central Pivot Range (CPR):
The CPR in MERCURY provides a central pivot level along with Below Central (BC) and Top Central (TC) pivots. These levels act as potential support and resistance, useful for identifying reversal points and zones where price may consolidate.
Exponential Moving Averages (EMAs):
MERCURY includes up to nine EMAs, with a customizable EMA crossover alert system. This feature enables traders to see shifts in trend direction, especially when shorter EMAs cross longer ones.
VWAP (Volume-Weighted Average Price):
VWAP is incorporated as a dynamic support/resistance level and, combined with EMA crossovers, helps refine entry and exit points for higher probability trades.
Breakout and Breakdown Alerts:
MERCURY monitors conditions for upside and downside breakouts. For an upside breakout, all EMAs turn green and a candle closes above VWAP, EMA1, and EMA2. Similarly, all EMAs turning red, combined with a close below VWAP and EMA1/EMA2, signals a downside breakdown. Continuous alerts are available until the trend shifts.
Real-Time EMA Dashboard:
A table displays each EMA’s relative position (Above or Below), helping traders quickly gauge trend direction. Colors in the table adjust to long/short conditions based on EMA alignment.
Usage Recommendations:
Trend Confirmation:
Use the CPR, EMA alignments, and VWAP to confirm uptrends and downtrends. The table highlights trends, making it easy to spot long or short setups at a glance.
Breakout and Breakdown Alerts:
The alert system is customizable for continuous notifications on critical price levels. When all EMAs align in one direction (green for long, red for short) and the close is above or below VWAP and key EMAs, the indicator confirms a breakout/breakdown.
Adaptable for Different Styles:
Day Trading: Traders can set shorter EMAs for quick insights.
Swing Trading: Longer EMAs combined with CPR offer insights into sustained trends.
Recommended Settings:
Timeframes: MERCURY is suitable for timeframes as low as 5 minutes for intraday traders, up to daily charts for trend analysis.
Symbols: Works across forex, stocks, and crypto. Adjust EMA lengths for asset volatility.
Example Strategy:
Long Entry: When the price crosses above CPR and closes above both EMA1 and EMA2.
Short Entry: When the price falls below CPR with a close below both EMA1 and EMA2.
moshak adel//@version=5
indicator("2 indicator", precision=0, timeframe='', timeframe_gaps = true)
PhiSmoother(series float source, simple int length, simple float phase=3.7)=>
var array coefs = na
var int length_1 = length - 1
var float W = 0.0
if na(coefs)
coefs := array.new()
const float SQRT_PIx2 = math.sqrt(2.0 * math.pi)
const float MULTIPLIER = -0.5 / 0.93
var float length_2 = length * 0.52353
for int i=0 to length_1
float alpha = (i + phase - length_2) * MULTIPLIER
float beta = 1.0 / (0.2316419 * math.abs(alpha) + 1.0)
float phi = (math.exp(math.pow(alpha, 2) * -0.5)
*-0.398942280) * beta *
( 0.319381530 + beta *
(-0.356563782 + beta *
( 1.781477937 + beta *
(-1.821255978 + beta
* 1.330274429)))) + 1.011
if alpha < 0.0
phi := 1.0 - phi
float weight = phi / SQRT_PIx2
coefs.push(weight)
W += weight
float sma2 = math.avg(source, nz(source , source))
float E = 0.0
for int i=0 to length_1
E += coefs.get(i) * sma2
E / W
ema(series float source, simple float length)=>
float alpha = 2.0 / (length + 1)
var float smoothed = na
smoothed := alpha * source + (1.0 - alpha) * nz(smoothed , source)
dema(series float source, simple float length)=>
float ema1 = ema(source, length)
float ema2 = ema( ema1, length)
2.0 * ema1 - ema2
tema(series float source, simple float length)=>
float ema1 = ema(source, length)
float ema2 = ema( ema1, length)
float ema3 = ema( ema2, length)
(ema1 - ema2) * 3.0 + ema3
wma(series float source, simple int length)=>
float weight_sum = length * 0.5 * (length + 1)
float sum = 0.0
for int i=0 to length - 1
sum += source * (length - i)
sum / weight_sum
sma(series float source, simple int length)=>
float sum = ta.cum(source)
if bar_index < length - 1
sum / (bar_index + 1)
else
(sum - sum ) / length
filter(series float source,
simple int length,
simple float phase,
simple string style)=>
if length > 1
switch style
"PhiSmoother" => PhiSmoother(source, length, phase)
"EMA" => ema(source, length)
"DEMA" => dema(source, length)
"TEMA" => tema(source, length)
"WMA" => wma(source, length)
=> sma(source, length) // "SMA"
else
source
method get_score(series array source)=>
array scores = array.new()
for int i=0 to source.size() - 1
float current = source.get(i)
int score_sum = 0
for j = 0 to source.size() - 1
float check = source.get(j)
int polarity = i < j ? 1 : -1
if i != j
if current > check
score_sum += polarity
else
score_sum -= polarity
scores.push(score_sum)
scores
method net_score(series array scores)=>
int value = scores.size() - 1
float netScore = ((scores.avg() + value) / (value * 2.0) - 0.5) * 200.0
netScore
method get_color(series float score,
simple float transition_easing,
simple bool volatility_mode,
simple color rising_bullish,
simple color falling_bullish,
simple color falling_bearish,
simple color rising_bearish,
simple color rising_transition,
simple color falling_transition)=>
var color grad = na
float delta = score - nz(score , score)
color bullish = delta >= 0.0 ? rising_bullish : falling_bullish
color bearish = delta > 0.0 ? rising_bearish : falling_bearish
color transit = score > 0.0 ? (delta >= 0.0 ? rising_transition : falling_transition)
: (delta >= 0.0 ? falling_transition : rising_transition)
if volatility_mode
float easing = 0.01 * transition_easing
float crms = easing * math.sqrt(ta.cum(math.pow(math.abs(score), 2)) / (bar_index + 1))
grad := if score > 0.0
transition_easing > 0.0 ? color.from_gradient(score, 0.0, crms, transit, bullish) : bullish
else
transition_easing > 0.0 ? color.from_gradient(score, -crms, 0.0, bearish, transit) : bearish
else
grad := if score > 0.0
transition_easing > 0.0 ? color.from_gradient(score, 0.0, transition_easing, transit, bullish) : bullish
else
transition_easing > 0.0 ? color.from_gradient(score, -transition_easing, 0.0, bearish, transit) : bearish
grad
string common = "Common Controls"
float source = input.source( close, "Source", group=common)
string mode = input.string("Trend Strength", "Composite Cluster Mode", group=common, options= , tooltip="Trend Strength visualizes the directionality of the filter cluster. Volatility weights the score to the bandwidth of the cluster.")
string filter = input.string( "PhiSmoother", "Cluster Filter", group=common, options= , tooltip="Choose a filter to build the moving average cluster with.")
float phase = input.float ( 3.7, "PhiSmoother Phase", group=common, minval=0.0, step=0.1, tooltip="This allows for subtle adjustment (tweaking) of the phase/lag for PhiSmoother")
string cluster = "Cluster Options"
int spacing = input.int(3, "Cluster Dispersion", group=cluster, minval=1, maxval=10, tooltip="Choose the separation between the moving averages in the cluster.")
int upper_trim = input.int(0, "Cluster Trim - Upper:", group=cluster, inline="trim", minval=0, maxval=31)
int lower_trim = input.int(0, "Lower:", group=cluster, inline="trim", minval=0, maxval=31, tooltip="The 'Upper' parameter modifies the shortest period of the moving averages, whereas 'Lower' parameter adjusts the longest period. Increasing the upper value reduces sensitivity, while increasing the lower value heightens sensitivity.")
string output = "Composite Post Smoothing"
string post_smooth_filt = input.string("PhiSmoother", "PostSmooth - Filter:", group=output, inline="post", options= )
int post_smooth_len = input.int ( 1, "Length:", group=output, inline="post", minval=1, tooltip="Period of the cluster's post smoothing.")
string signal = "Composite Signal Settings"
string signal_filter = input.string("PhiSmoother", "Signal - Filter:", group=signal, inline="signal", options= )
int signal_length = input.int ( 20, "Length:", group=signal, inline="signal", minval=1, tooltip="Period of the momentum signal plot.")
color signal_color = input.color ( color.white, "Filter Color", group=signal)
string threshold = "Threshold Levels"
float upperLevel = input.float( 75.00, "Levels - Upper:", group=threshold, inline="level", minval= 1.0, maxval=99.0, step=2.0)
float lowerLevel = input.float(-75.00, "Lower:", group=threshold, inline="level", minval=-99.0, maxval=-1.0, step=2.0, tooltip="Fine-tune the thresholds to your liking")
string colors = "Coloring Preferences"
//bool candle_color = input.bool ( false, "Candle Coloring", group=colors)
float transition_easing = input.float( 50.0, "Transition Easing", group=colors, maxval= 100.0, minval=0.0, step=5.0, tooltip="Adjust the sensitivity to ranging conditions.")
bool fill_bg = input.bool ( true, "Fill Background", group=colors, inline= "fill")
int fill_alpha = input.int ( 85, "", group=colors, inline= "fill", minval=0, maxval=100)
color rising_bullish = input.color(#FFCC00, "Bullish Color", group=colors, inline= "bull")
color rising_transition = input.color(#9598A1, "Transition Color", group=colors, inline="range")
color falling_bearish = input.color(#5500CC, "Bearish Color", group=colors, inline= "bear")
var bool VOLATILITY_MODE_ON = mode == "Volatility"
price = input(title='Source', defval=close)
alpha = input.int(title='Combined Smoothness', defval=15, minval=1)
array filter_cluster = array.new(34)
filter_cluster.set( 0, source)
filter_cluster.set( 1, filter(source, spacing, phase, filter))
filter_cluster.set( 2, filter(source, 2 * spacing, phase, filter))
filter_cluster.set( 3, filter(source, 3 * spacing, phase, filter))
filter_cluster.set( 4, filter(source, 4 * spacing, phase, filter))
filter_cluster.set( 6, filter(source, 5 * spacing, phase, filter))
filter_cluster.set( 7, filter(source, 6 * spacing, phase, filter))
filter_cluster.set( 8, filter(source, 7 * spacing, phase, filter))
filter_cluster.set( 9, filter(source, 8 * spacing, phase, filter))
filter_cluster.set(10, filter(source, 9 * spacing, phase, filter))
filter_cluster.set(11, filter(source, 10 * spacing, phase, filter))
filter_cluster.set(12, filter(source, 11 * spacing, phase, filter))
filter_cluster.set(13, filter(source, 12 * spacing, phase, filter))
filter_cluster.set(14, filter(source, 13 * spacing, phase, filter))
filter_cluster.set(15, filter(source, 14 * spacing, phase, filter))
filter_cluster.set(16, filter(source, 15 * spacing, phase, filter))
filter_cluster.set(17, filter(source, 16 * spacing, phase, filter))
filter_cluster.set(18, filter(source, 17 * spacing, phase, filter))
filter_cluster.set(19, filter(source, 18 * spacing, phase, filter))
filter_cluster.set(20, filter(source, 19 * spacing, phase, filter))
filter_cluster.set(21, filter(source, 20 * spacing, phase, filter))
filter_cluster.set(22, filter(source, 21 * spacing, phase, filter))
filter_cluster.set(23, filter(source, 22 * spacing, phase, filter))
filter_cluster.set(24, filter(source, 23 * spacing, phase, filter))
filter_cluster.set(25, filter(source, 24 * spacing, phase, filter))
filter_cluster.set(26, filter(source, 25 * spacing, phase, filter))
filter_cluster.set(27, filter(source, 26 * spacing, phase, filter))
filter_cluster.set(28, filter(source, 27 * spacing, phase, filter))
filter_cluster.set(29, filter(source, 28 * spacing, phase, filter))
filter_cluster.set(30, filter(source, 29 * spacing, phase, filter))
filter_cluster.set(31, filter(source, 30 * spacing, phase, filter))
filter_cluster.set(32, filter(source, 31 * spacing, phase, filter))
filter_cluster.set(33, filter(source, 32 * spacing, phase, filter))
if upper_trim > 0
for int i=0 to math.min(upper_trim - 1, filter_cluster.size() - 1)
if filter_cluster.size() > 2
filter_cluster.shift()
else
break
if lower_trim > 0
for int i=0 to math.min(lower_trim - 1, filter_cluster.size() - 1)
if filter_cluster.size() > 2
filter_cluster.pop()
else
break
float ribbon_max = filter_cluster.max()
float ribbon_min = filter_cluster.min()
float ribbon_width = ribbon_max - ribbon_min
float ribbon_rank = VOLATILITY_MODE_ON ? nz(ribbon_width / math.avg(ribbon_max, ribbon_min)) : 1
array score = filter_cluster.get_score()
float net_score = filter(score.net_score() * ribbon_rank, post_smooth_len, 3.7, post_smooth_filt)
float signal_value = signal_length < 2 ? na : filter(ta.sma(net_score, 2), signal_length, 3.7, signal_filter)
top = hline(VOLATILITY_MODE_ON ? na : 100.0, "Top", #FF0000)
upper = hline(VOLATILITY_MODE_ON ? na : upperLevel, "+Level", rising_bullish, hline.style_dotted, 2)
center = hline( 0.0, "Center", #CCCCCC)
lower = hline(VOLATILITY_MODE_ON ? na : lowerLevel, "+Level", falling_bearish, hline.style_dotted, 2)
bottom = hline(VOLATILITY_MODE_ON ? na : -100.0, "Bottom", #00FF00)
const color invisible = #00000000
fill( top, upper, 100.0, upperLevel, #800000, invisible)
fill(center, upper, upperLevel, 0.0, color.new( rising_bullish, 100), color.new(rising_bullish, fill_bg ? fill_alpha : 100))
fill(center, lower, 0.0, lowerLevel, color.new(falling_bearish, fill_bg ? fill_alpha : 100), color.new(falling_bearish, 100))
fill(bottom, lower, lowerLevel, -100.0, invisible, #008000)
//barcolor(candle_color ? main_color : na)
color1 = net_score>signal_value ? #00FF00 : #ff0000
net = plot(net_score, "Score", color1, 3)
zero = plot( 0.0, "", invisible)
plot(signal_value, "Signal", signal_color, 1)
fill(net, zero, net_score > 0.0 ? net_score : 0.0,
net_score > 0.0 ? 0.0 : net_score,
net_score > 0.0 ? color.new(rising_bullish, fill_bg and VOLATILITY_MODE_ON ? fill_alpha : 100) : color.new(falling_bearish, 100),
net_score > 0.0 ? color.new(rising_bullish, 100) : color.new(falling_bearish, fill_bg and VOLATILITY_MODE_ON ? fill_alpha : 100))
//===============================================
f_LazyLine(_data, _length) =>
w1 = 0
w2 = 0
w3 = 0
L1 = 0.0
L2 = 0.0
L3 = 0.0
w = _length / 3
if _length > 2
w2 := math.round(w)
w1 := math.round((_length - w2) / 2)
w3 := int((_length - w2) / 2)
L1 := ta.wma(_data, w1)
L2 := ta.wma(L1, w2)
L3 := ta.wma(L2, w3)
L3
else
L3 := _data
L3
L3
//====================================
LL = f_LazyLine(price, alpha)
c_up = color.new(#33ff00, 0)
c_dn = color.new(#ff1111, 0)
uptrend = LL > LL
plot(LL, 'SS_WMA Line', color=uptrend ? c_up : c_dn, linewidth=3,force_overlay=true)
plot(ta.wma(price, alpha), 'WMA', color=color.new(color.purple, 0), display=display.none,force_overlay=true)
// ========================================================================================================================
// v2: add optional up/dn arrow signal on change of direction (swing)
ShowSig = input(title='Up/Dn Swing Signal?', defval=false)
SigMulti = input.float(title='Signal Locator %', defval=1.0, step=0.2, minval=0, maxval=20)
SignalOn = ShowSig and barstate.isconfirmed // ensure the signal plots *only* after "the bar closes" :) -- insert jokes :)
SwingDn = uptrend and not uptrend
SwingUp = uptrend and not uptrend
d = SigMulti / 100 * LL //we'll use this to tweak a good location for the signal (that is not tied to price-specific parameters)
plotshape(SignalOn and SwingDn ? LL + d : na, title='Swing Down', style=shape.triangledown, location=location.absolute, size=size.small, color=c_dn,force_overlay=true)
plotshape(SignalOn and SwingUp ? LL - d : na, title='Swing Up', style=shape.triangleup, location=location.absolute, size=size.small, color=c_up,force_overlay=true)
// ========================================================================================================================
// v3: enable alerts
// need to use alertcondition() to support variable resolution
alertcondition(SwingUp, 'Swing Up', 'Swing Up Detected!') // explicit swing up
alertcondition(SwingDn, 'Swing Down', 'Swing Down Detected!') // explicit swing down
alertcondition(SwingUp or SwingDn, 'Swing', 'Up/Down Swing Detected!') // either swings
Stock Booster 3.0
//@version=5
const bool DEBUG = false
const int maxDistanceToLastBar = 5000
const int labelCooldown = 8
const int KDELimit = 300
indicator("Stock Booster", overlay = true, max_labels_count = 500)
rsiLengthInput = input.int(14, minval = 1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
highPivotLen = input.int(21, "High Pivot Length", minval = 1, group = "Pivots", display = display.none)
lowPivotLen = input.int(21, "Low Pivot Length", minval = 1, group = "Pivots", display = display.none)
realPivotLabels = DEBUG ? input.bool(false, " Real Pivot Labels", group = "Pivots") : false
kdePivotLabels = DEBUG ? input.bool(false, " KDE Pivot Labels", group = "Pivots") : false
activationThresholdStr = input.string("Medium", "Activation Threshold", options = , group = "KDE", tooltip = "Determines the amount of arrows shown. Higher options will result in more arrows being rendered.")
string KDEKernel = input.string("Gaussian", "Kernel", options= , group = "KDE", tooltip = "The kernel function for KDE calculation. Gaussian is a commonly used kernel and is based on normal distribution.")
float KDEBandwidth = input.float(2.71828, "Bandwidth", group = "KDE", tooltip = "This setting sets the smoothness of the KDE function output.")
int KDEStep = input.int(100, "Nº Bins", minval = 1, group = "KDE", tooltip = "The number of elements the KDE Probability array will have. Higher settings will result in greater precision.")
activationThreshold = DEBUG ? input.float(0.25, " Activation Threshold", group = "KDE") : 0.25
if not DEBUG
activationThreshold := (activationThresholdStr == "High" ? 0.4 : activationThresholdStr == "Medium" ? 0.25 : 0.15)
probMode = DEBUG ? input.string("Sum", ' Probability Mode', options = , group = "KDE") : "Sum"
minPadding = DEBUG ? input.bool(false, ' KDE Min Padding', group = "KDE") : false
tableEnabled = input.bool(true, "Dashboard", group = "Dashboard", display = display.none)
tableLocation = input.string("Top Right", "Position", options = , group = "Dashboard", display = display.none)
screenerColor = input.color(#1B1F2B, 'Background', group = 'Dashboard', display = display.none)
frameColor = input.color(color.rgb(255, 255, 255), 'Frame', group = 'Dashboard', display = display.none)
borderColor = input.color(color.rgb(255, 255, 255), 'Border', group = 'Dashboard', display = display.none)
textColorDB = input.color(color.white, 'Text', group = 'Dashboard', display = display.none)
fillBackgrounds = input.bool(true, "Fill Backgrounds", group = "Dashboard", display = display.none)
bearishColor = input.color(#f23646, "High Pivots", group = "Style", inline = "col", display = display.none)
neutralColor = input.color(color.gray, "Neutral", group = "Style", inline = "col", display = display.none)
bullishColor = input.color(#089981, "Low Pivots", group = "Style", inline = "col", display = display.none)
textColor = input.color(color.white, 'Text', group = 'Style', inline = "col", display = display.none)
RSILabelsEnabled = input.bool(true, "RSI Labels", group = "Style")
KDELabelsEnabled = input.bool(true, "KDE Labels", group = "Style")
rsi = ta.rsi(rsiSourceInput, rsiLengthInput)
getPosition (positionText) =>
if positionText == "Top Right"
position.top_right
else if positionText == "Top Center"
position.top_center
else if positionText == "Right Center"
position.middle_right
else if positionText == "Left Center"
position.middle_left
else if positionText == "Bottom Center"
position.bottom_center
else if positionText == "Middle Center"
position.middle_center
//#region KDE
gaussian (float distance, float bandwidth = 1.0) => 1.0 / math.sqrt(2.0 * math.pi) * math.pow(math.e, -0.5 * math.pow(distance / bandwidth, 2.0))
uniform (float distance, float bandwidth = 1.0) => (math.abs(distance) > bandwidth) ? 0.0 : 0.5
sigmoid (float distance, float bandwidth = 1.0) => 2.0 / math.pi * (1.0 / (math.pow(math.e, (distance / bandwidth)) + math.pow(math.e, -(distance / bandwidth))))
kde (array arr, string kernel, float bandwidth, int steps) =>
arrSize = arr.size()
arrRange = arr.range()
arrMin = arr.min() - (minPadding ? (arrRange / 2.0) : 0)
stepCount = arrRange / steps
densityRange = array.new(steps * 2)
for i = 0 to (steps * 2) - 1
densityRange.set(i, arrMin + i * stepCount)
xArr = array.new()
yArr = array.new()
for i = 0 to densityRange.size() - 1
float temp = 0
for j = 0 to arr.size() - 1
switch KDEKernel
"Gaussian" => temp += gaussian(densityRange.get(i) - arr.get(j), 1.0 / bandwidth)
"Uniform" => temp += uniform(densityRange.get(i) - arr.get(j), 1.0 / bandwidth)
"Sigmoid" => temp += sigmoid(densityRange.get(i) - arr.get(j), 1.0 / bandwidth)
xArr.push(densityRange.get(i))
yArr.push(1.0 / arrSize * temp)
//#endregion
//#region Pivots
prefixSum (array arr, int l, int r) =>
arr.get(r) - (l == 0 ? 0 : arr.get(l - 1))
float MidKDEHigh = na
float MidKDELow = na
var array KDEHighX = na
var array KDEHighY = na
var array KDEHighYSum = array.new()
var array KDELowX = na
var array KDELowY = na
var array KDELowYSum = array.new()
highPivot = ta.pivothigh(highPivotLen, highPivotLen)
lowPivot = ta.pivotlow(lowPivotLen, lowPivotLen)
var highPivotRSIs = array.new()
var lowPivotRSIs = array.new()
if not na(highPivot)
if highPivotRSIs.size() > KDELimit
highPivotRSIs.remove(0)
highPivotRSIs.push(rsi )
= kde(highPivotRSIs, KDEKernel, KDEBandwidth, KDEStep)
KDEHighX := KDEHighX1
KDEHighY := KDEHighY1
KDEHighYSum.clear()
temp = 0.0
for i = 0 to KDEHighY.size() - 1
temp += KDEHighY.get(i)
KDEHighYSum.push(temp)
MidKDEHigh := array.get(KDEHighX, array.indexof(KDEHighY, array.max(KDEHighY)))
if not na(lowPivot)
if lowPivotRSIs.size() > KDELimit
lowPivotRSIs.remove(0)
lowPivotRSIs.push(rsi )
= kde(lowPivotRSIs, KDEKernel, KDEBandwidth, KDEStep)
KDELowX := KDELowX1
KDELowY := KDELowY1
KDELowYSum.clear()
temp = 0.0
for i = 0 to KDELowY.size() - 1
temp += KDELowY.get(i)
KDELowYSum.push(temp)
MidKDELow := array.get(KDELowX, array.indexof(KDELowY, array.max(KDELowY)))
//#endregion
//#region KDE Optimization
f_lin_interpolate(float x0, float x1, float y0, float y1, float x) =>
y0 + (x - x0) * (y1 - y0) / (x1 - x0)
float lowProb = na
float maxLowProb = na
float highProb = na
float maxHighProb = na
if last_bar_index - maxDistanceToLastBar < bar_index
if highPivotRSIs.size() > 0
highXIndexL = array.binary_search_leftmost(KDEHighX, rsi)
highXIndexR = math.min(array.binary_search_rightmost(KDEHighX, rsi), KDEHighX.size() - 1)
nearestIndex = (math.abs(rsi - KDEHighX.get(highXIndexL)) < math.abs(rsi - KDEHighX.get(highXIndexR))) ? highXIndexL : highXIndexR
if probMode == "Nearest"
highProb := KDEHighY.get(nearestIndex)
maxHighProb := array.max(KDEHighY)
else if probMode == "Sum"
highProb := prefixSum(KDEHighYSum, 0, nearestIndex)
if lowPivotRSIs.size() > 0
lowXIndexL = array.binary_search_leftmost(KDELowX, rsi)
lowXIndexR = math.min(array.binary_search_rightmost(KDELowX, rsi), KDELowX.size() - 1)
nearestIndex = (math.abs(rsi - KDELowX.get(lowXIndexL)) < math.abs(rsi - KDELowX.get(lowXIndexR))) ? lowXIndexL : lowXIndexR
if probMode == "Nearest"
lowProb := KDELowY.get(nearestIndex)
maxLowProb := array.max(KDELowY)
else if probMode == "Sum"
lowProb := prefixSum(KDELowYSum, nearestIndex, KDELowYSum.size() - 1)
if DEBUG and barstate.islastconfirmedhistory
for i = 0 to KDELowX.size() - 1
curX = KDELowX.get(i)
curY = KDELowY.get(i)
log.info(str.tostring(curX) + " = " + str.tostring(curY))
log.info("High Y Sum " + str.tostring(KDEHighY.sum()))
diffToHighKDE = math.abs(rsi - MidKDEHigh)
diffToLowKDE = math.abs(rsi - MidKDELow)
//#endregion
//#region Draw Pivots
color curColor = na
if (not na(KDELowY)) and (not na(KDEHighY))
if probMode == "Nearest"
if math.abs(lowProb - maxLowProb) < activationThreshold / 50.0
curColor := bullishColor
if math.abs(highProb - maxHighProb) < activationThreshold / 50.0
curColor := bearishColor
else if probMode == "Sum"
if lowProb > KDELowY.sum() * (1.0 - activationThreshold)
curColor := bullishColor
else if highProb > KDEHighY.sum() * (1.0 - activationThreshold)
curColor := bearishColor
//barcolor(curColor)
atr = ta.atr(50)
plotarrow(curColor == bullishColor and barstate.isconfirmed ? 1 : na, "Bullish Arrows", color.new(bullishColor, 70), color.new(bullishColor, 70), minheight = 20, maxheight = 20)
plotarrow(curColor == bearishColor and barstate.isconfirmed ? -1 : na, "Bearish Arrows", color.new(bearishColor, 70), color.new(bearishColor, 70), minheight = 20, maxheight = 20)
plotarrow((na(curColor) and curColor == bullishColor and barstate.isconfirmed) ? 1 : na, "Possible Bullish Pivot", bullishColor, bullishColor, minheight = 20, maxheight = 20)
plotarrow((na(curColor) and curColor == bearishColor and barstate.isconfirmed) ? -1 : na, "Possible Bearish Pivot", bearishColor, bearishColor, minheight = 20, maxheight = 20)
alertcondition(na(curColor) and curColor == bullishColor and barstate.isconfirmed, "Possible Bullish Pivot")
alertcondition(na(curColor) and curColor == bearishColor and barstate.isconfirmed, "Possible Bearish Pivot")
if KDELabelsEnabled or RSILabelsEnabled
var lastBullishLabel = 0
if (na(curColor) and curColor == bullishColor and barstate.isconfirmed) and (bar_index - lastBullishLabel) > labelCooldown
lastBullishLabel := bar_index
txt = ""
if RSILabelsEnabled and KDELabelsEnabled
txt := "RSI | " + str.tostring(rsi, "#") + " | " + str.tostring(lowProb * 100, "#.##") + "%"
else if RSILabelsEnabled
txt := "RSI | " + str.tostring(rsi, "#")
else
txt := str.tostring(rsi, "#") + "%"
label.new(bar_index, low, txt, yloc = yloc.belowbar, color = na, style = label.style_label_up, textcolor = textColor, force_overlay = true)
var lastBearishLabel = 0
if (na(curColor) and curColor == bearishColor and barstate.isconfirmed) and (bar_index - lastBearishLabel) > labelCooldown
lastBearishLabel := bar_index
txt = ""
if RSILabelsEnabled and KDELabelsEnabled
txt := "RSI | " + str.tostring(rsi, "#") + " | " + str.tostring(highProb * 100, "#.##") + "%"
else if RSILabelsEnabled
txt := "RSI | " + str.tostring(rsi, "#")
else
txt := str.tostring(rsi, "#") + "%"
label.new(bar_index, low, txt, yloc = yloc.abovebar, color = na, style = label.style_label_down, textcolor = textColor, force_overlay = true)
if kdePivotLabels
txt = str.tostring(rsi, "#.##") + " HP -> " + str.tostring(highProb, "#.##") + " LP -> " + str.tostring(lowProb, "#.##") + " MHP -> " + str.tostring(maxHighProb, "#.##") + " MLP -> " + str.tostring(maxLowProb, "#.##")
if math.abs(lowProb - maxLowProb) < activationThreshold
label.new(bar_index, high, txt, yloc = yloc.belowbar, color = textColor, style = label.style_label_up, textcolor = color.black, force_overlay = true)
if math.abs(highProb - maxHighProb) < activationThreshold
label.new(bar_index, high, txt, yloc = yloc.abovebar, color = textColor, style = label.style_label_down, textcolor = color.black, force_overlay = true)
if realPivotLabels
if not na(highPivot)
txt = str.tostring(rsi , "#.##") + " HP -> " + str.tostring(highProb , "#.##") + " LP -> " + str.tostring(lowProb , "#.##") + " MHP -> " + str.tostring(maxHighProb , "#.##") + " MLP -> " + str.tostring(maxLowProb , "#.##")
label.new(bar_index - highPivotLen, high, txt, yloc = yloc.abovebar, color = textColor, style = label.style_label_down, textcolor = color.black, force_overlay = true)
if not na(lowPivot)
txt = str.tostring(rsi , "#.##") + " HP -> " + str.tostring(highProb , "#.##") + " LP -> " + str.tostring(lowProb , "#.##") + " MHP -> " + str.tostring(maxHighProb , "#.##") + " MLP -> " + str.tostring(maxLowProb , "#.##")
label.new(bar_index - lowPivotLen, high, txt, yloc = yloc.belowbar, color = textColor, style = label.style_label_up, textcolor = color.black, force_overlay = true)
//#endregion
if tableEnabled
var table realtimeTable = table.new(getPosition(tableLocation), 2, 10, bgcolor = screenerColor, frame_width = 2, frame_color = frameColor, border_width = 1, border_color = borderColor)
// Header
table.merge_cells(realtimeTable, 0, 0, 1, 0)
table.cell(realtimeTable, 0, 0, "KDE Optimized RSI", text_color = textColorDB, bgcolor = screenerColor)
// RSI
table.cell(realtimeTable, 0, 1, "RSI", text_color = textColorDB, bgcolor = screenerColor)
table.cell(realtimeTable, 1, 1, str.tostring(rsi, "#"), text_color = textColorDB, bgcolor = screenerColor)
// KDE
table.cell(realtimeTable, 0, 2, (lowProb > highProb) ? "Bullish KDE" : "Bearish KDE", text_color = (lowProb > highProb) ? bullishColor : bearishColor, bgcolor = screenerColor)
table.cell(realtimeTable, 1, 2, str.tostring(nz(math.max(highProb, lowProb), 0) * 100, "#.##") + "%", text_color = textColorDB, bgcolor = screenerColor)