Heikin Ashi with WMA/EMA, Target, Stoploss, and Trailing Stop 22If you continue to experience the "Undeclared identifier 'label'" error, an alternative approach is to use the plotshape function instead of label.new. The plotshape function can place markers (such as "Buy" and "Sell") on the chart without directly using label, and it’s widely supported in Pine Script.
Bill Williams Indicators
La strategia di PaoloLa strategia consiste nell'entrata a mercato quando viene rotto un order block.
Uscita da mercato in perdita se il mercato ritorna contro e si cancella il breaker block. Altrimenti si rimane a mercato fino a quando non c'è una rottura ribassista di un bullish order block.
Inoltre si possono incrementare le entrate ogni volta che tocca un bullish order block in caso di long oppure un bearish order block in caso di short
Bollinger Bands with CCI and RSI Crossover Strategy이 코드의 주요 기능:ㅁ
CCI와 RSI 지표를 차트에 추가하여 표시합니다.
ta.crossover() 함수를 사용하여 CCI가 RSI를 상향 교차할 때 매수 신호를 표시합니다.
ta.crossunder() 함수를 사용하여 CCI가 RSI를 하향 교차할 때 매도 신호를 표시합니다.
교차 지점에 매수/매도 신호를 차트에 표시합니다.
RSI Overbought/Oversold Balloons Fixededddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddedddeddd
Aso Line v2This indicator generates buy and sell signals by analyzing volume and horizontal lines. Red and green zones are displayed on the chart.
・Red zone: indicates a short (sell) signal. When the price reaches this zone, consider a short position.
・Green zone: indicates a long (buy) signal. When the price reaches this zone, consider a long position.
This indicator uses a proprietary algorithm to analyze volume and horizontal lines to identify the best zones for trading. Specifically, we will explain and .
In addition, configuration options for using this indicator effectively will be explained. For example, there are parameters to adjust the width of the zone, the volume calculation period, and the type of horizontal line used. By adjusting these parameters, you can adapt to different market conditions and trading styles.
- The way this indicator works is to look for fractal highs or fractal lows on volume above a moving average of volume. This moving average can be changed in the settings for each time frame.
- Fractal highs are identified by three consecutive highs followed by two consecutive lows, and vice versa for fractal lows.
- A zone is created from the fractal high/low and the closing candlestick price for the selected time frame. The larger the zone, the more important it is.
- You can disable zones, change zones to show only lines, or change the color, transparency, and thickness of lines in all zones.
Profit Hunter - RS Supernova中文說明
狩利 (Profit Hunter) - RS 超新星 是一款專為加密貨幣市場設計的相對強度篩選指標,靈感來自 Mark Minervini 和 William O'Neil 的投資理念。此指標透過「RS 超新星」篩選概念,幫助交易者聚焦在市場中的極端強勢標的,從而更精準地捕捉高潛力的進場機會。
指標用途
RS 評級 (RS Rating):基於相對強度 (Relative Strength) 概念,將標的與整體市場 (TOTAL 指數) 進行比較,得出 RS 評級。當 RS 評級超過 85 時,該標的被視為具有極強的上漲動能,是潛在的進場目標。
高潛力篩選:此指標利用動態加權計算方式,篩選出相對強勢的標的,讓交易者可以聚焦於具有突破潛力的資產。
即時數據顯示:在圖表上即時顯示 RS 評級,提供清晰的數據支持,使交易者快速判斷標的的強度並做出即時決策。
狩利-RS 超新星 專為追求市場主流趨勢的交易者設計,特別適合應用 Minervini 和 O'Neil 理論的投資者。該指標幫助您在市場波動中篩選出最具相對強度的標的,確保每次進場都是基於高潛力的技術分析。
English Description
Profit Hunter - RS Supernova is a relative strength (RS) filtering indicator specifically designed for the cryptocurrency market, inspired by the investment philosophies of Mark Minervini and William O'Neil. Through the concept of the "RS Supernova," this indicator helps traders focus on exceptionally strong assets within the market, enabling precise entry into high-potential opportunities.
Indicator Purpose
RS Rating: Based on Relative Strength (RS) analysis, the indicator compares the asset to the overall market (TOTAL index) to generate an RS Rating. When the RS rating exceeds 85, the asset is considered to have substantial upward momentum, marking it as a potential entry target.
High-Potential Screening: Utilizing a dynamic weighted calculation, this indicator filters out assets with relative strength, allowing traders to concentrate on those with breakout potential.
Real-Time Data Display: The RS Rating is displayed on the chart, providing clear data for quick assessment of asset strength and enabling real-time decision-making.
Profit Hunter - RS Supernova is designed for traders seeking to capture mainstream market trends, especially those following Minervini and O'Neil's theories. This indicator aids in identifying the strongest assets amidst market fluctuations, ensuring each entry is backed by high-potential technical analysis.
Bullish/Bearish Reversal Bars Indicator [Skyrexio]Introduction
Bullish/Bearish Reversal Bars Indicator leverages the combination of candlestick reversal bar pattern and the Williams Alligator indicator to help traders in understanding where there is a high probability of market reversal or correction. Indicator works for both bearish and bullish cases. It visualizes the bearish and bullish reversal bars with red and green dots and also plots the Alligator's lips to make it more convenient for traders to understand if price is above or below lips line (more information in "Methodology and it's justification" paragraph).
Features
Market Facilitation Index(MFI) filter: with the specified parameter in settings user can choose to filter bullish and bearish reversal bars which passed the MFI condition.
Awesome Oscillator(AO) filter: with the specified parameter in settings user can choose to filter bullish and bearish reversal bars which passed the AO condition.
Alerts: user can set up the alert and have notifications when bullish/bearish reversal bar has been printed.
Methodology and it's justification
In the script’s methodology, we apply the concepts of bullish and bearish reversal bars introduced by Bill Williams in his book Trading Chaos. So, what exactly is a bullish or bearish reversal bar? At its core, it’s a candlestick pattern. A bullish reversal bar is a bar that closes in its upper half, while a bearish reversal bar closes in its lower half.
Why is this type of bar significant? Let’s look at the bullish reversal bar as an example. When the price is trending upward, forming higher highs with each candle, and we suddenly see a bullish bar that makes a new high but ultimately closes in its lower half, it signals a shift in control. Bears have taken control toward the end of that candle's period, pushing the price back down. This can be interpreted as a sign of trend weakness and a potential reversal (or at least a correction).
An additional key point is that a reversal bar often indicates a possible end to the trend. Therefore, for a reversal bar to be valid, several preceding candles should show lower highs (for bullish bars) or higher lows (for bearish bars), reinforcing the likelihood of a trend change.
The second step on methodology is the location of the bar related to Williams Alligator. The Williams Alligator Indicator, developed by Bill Williams, is a technical analysis tool that helps traders identify trends and potential turning points in the market. It consists of three lines, often called the jaw, teeth, and lips of the alligator, each representing different moving averages:
Jaw (Blue Line): A slower moving average, typically a 13-period smoothed moving average shifted 8 bars into the future.
Teeth (Red Line): A medium moving average, typically an 8-period smoothed moving average shifted 5 bars into the future.
Lips (Green Line): A faster moving average, usually a 5-period smoothed moving average shifted 3 bars into the future.
When the three lines are spread out and moving in the same direction, it suggests a strong trend (the "alligator" is "awake and feeding"). When they intertwine, the indicator suggests that the market is moving sideways, or in a range, signaling a lack of clear trend (the "alligator" is "sleeping"). Traders use the Alligator Indicator to enter trades in trending markets and avoid trades in choppy, non-trending markets.
If bullish reversal bar's high is not below and bearish reversal bar's low is not above all three Alligator's lines (jaw, lips, teeth) they cannot be interpreted as these types of bars. It can be explained as following: if we are waiting for the bullish reversal bar it shall be reversal from downtrend. If price is not below all three lines it can't be interpret as the downtrend according to this method. The opposite is true for the bearish reversal bar.
All described above are obligatory conditions for reversal bar, now let's discuss two not obligatory conditions. The first one is Market Facilitation Index (MFI) restriction. Let's briefly look what is MFI. The Market Facilitation Index (MFI) is a technical indicator that measures the price movement per unit of volume, helping traders gauge the efficiency of price movement in relation to trading volume. Here's how you can calculate it:
MFI = (High−Low)/Volume
MFI can be used in combination with volume, so we can divide 4 states. Bill Williams introduced these to help traders interpret the interaction between volume and price movement. Here’s a quick summary:
Green Window (Increased MFI & Increased Volume): Indicates strong momentum with both price and volume increasing. Often a sign of trend continuation, as both buying and selling interest are rising.
Fake Window (Increased MFI & Decreased Volume): Shows that price is moving but with lower volume, suggesting weak support for the trend. This can signal a potential end of the current trend.
Squat Window (Decreased MFI & Increased Volume): Shows high volume but little price movement, indicating a tug-of-war between buyers and sellers. This often precedes a breakout as the pressure builds.
Fade Window (Decreased MFI & Decreased Volume): Indicates a lack of interest from both buyers and sellers, leading to lower momentum. This typically happens in range-bound markets and may signal consolidation before a new move.
For our purposes we are interested in squat bars. This is the sign that volume cannot move the price easily. This type of bar increases the probability of trend reversal. In this indicator we added to enable the MFI filter of reversal bars. If potential reversal bar or two preceding bars have squat state this bar can be interpret as a reversal one.
The second additional filter is Awesome Oscillator. The Awesome Oscillator (AO), developed by Bill Williams, is a momentum indicator that measures market momentum by comparing recent price action to a longer historical context. It helps traders identify potential trend reversals and the strength of trends. Formula:
AO = SMA5(Median Price) − SMA34(Median Price)
where:
Median Price = (High + Low) / 2
SMA5 = 5-period Simple Moving Average of the Median Price
SMA 34 = 34-period Simple Moving Average of the Median Price
If AO is decreasing momentum is bearish, if increasing - bullish. According to Bill Williams approach reversal bars are the potential trades against the trend. As a result we added second filter for bullish reversal bars AO shall be decreasing, for bearish increasing.
How to use indicator
Apply it to desired chart and time frame. It works on every time frame.
Setup the filters with the "Enable MFI" and "Enable AO" checkboxes in the settings. By default they are turned on.
Analyze the price action. Indicator plotted the white line, this is the lips of an Alligator. It will help you to understand how price is moving in comparison to lips line. Indicator will print the green dot and text "BULL" below it current bar is bullish reversal. It will print the red dot and text "BEAR" above it if current bar is interpreted by algorithm as a bearish reversal.
Set up the alerts if it's needed. Indicator has two custom alerts called "Bullish reversal bar has been printed" and "Bearish reversal bar has been printed"
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test indicators before live implementation.
HBK Price Action Strategy HBKPrice Action Strategy for XAUUSD with a Favorable Risk-Reward Ratio
Understanding the Strategy:
This strategy leverages price action principles to identify potential entry and exit points for XAUUSD on a 5-minute timeframe. The core idea is to identify price action patterns that suggest a high probability of a particular direction, and then to set stop-loss and take-profit levels to manage risk and reward.
Key Price Action Patterns to Watch:
Pin Bar: A pin bar is a candlestick with a long wick in one direction and a small body in the opposite direction. It often signals a reversal in the current trend.
Inside Bar: An inside bar forms when the current candle's high is lower than the previous candle's high, and the current candle's low is higher than the previous candle's low. It often indicates indecision or a potential breakout.
Engulfing Pattern: An engulfing pattern occurs when the current candle completely engulfs the previous candle. A bullish engulfing pattern signals a potential uptrend, while a bearish engulfing pattern signals a potential downtrend.
Risk-Reward Ratio:
A favorable risk-reward ratio is crucial for long-term trading success. Aim for a minimum risk-reward ratio of 1:2, meaning you risk $1 to potentially gain $2.
Entry and Exit Signals:
Long Entry:
Identify a bullish pin bar or engulfing pattern.
Wait for a confirmation candle to close above the pin bar's high or the engulfing pattern's high.
Place a stop-loss below the recent swing low.
Set a take-profit target at a key resistance level or a multiple of the stop-loss distance.
Short Entry:
Identify a bearish pin bar or engulfing pattern.
Wait for a confirmation candle to close below the pin bar's low or the engulfing pattern's low.
Place a stop-loss above the recent swing high.
Set a take-profit target at a key support level or a multiple of the stop-loss distance.
Additional Tips:
Use Support and Resistance Levels: Identify key support and resistance levels to set your stop-loss and take-profit targets.
Consider Market Sentiment: Pay attention to market sentiment and news events that may impact gold prices.
Manage Risk: Always use stop-loss orders to limit potential losses.
Be Patient: Don't force trades. Wait for high-probability setups.
Practice Discipline: Stick to your trading plan and avoid impulsive decisions.
Remember:
Price action trading requires practice and patience.
Backtest your strategy on historical data to refine your approach.
Always adapt to changing market conditions.
By following these guidelines and practicing disciplined risk management, you can increase your chances of success in trading XAUUSD on a 5-minute timeframe.
Custom Candlestick Pattern IndicatorCustom Candlestick Pattern Indicator - Buy Signal Based on Green Candles Breaking Previous Lows
Overview:
This custom candlestick pattern indicator is designed to highlight potential buy opportunities based on a simple yet powerful candlestick pattern. The indicator identifies green candles that break below the low of the previous candle. This combination may signal a potential market reversal or a bullish continuation after a pullback, depending on the market context. Traders can use this indicator to detect areas where prices may be bouncing from recent lows, indicating a potential buying opportunity.
Pattern Explanation:
The strategy underlying this indicator is a two-part condition that must be met before a buy signal is generated:
Green Candle: A green candle forms when the closing price of the current candle is higher than its opening price. This visually represents bullish momentum as buyers have taken control, closing the price higher than where it opened.
Breaking the Previous Low: The low of the current candle must be lower than the low of the previous candle. This suggests that, despite initial bearish pressure during the candle formation (which drove the price below the previous candle's low), buyers stepped in to push the price higher by the candle’s close. This pattern can signify a potential reversal or bullish continuation, as it demonstrates that buyers are overcoming initial selling pressure.
When the Pattern Occurs:
This pattern is particularly interesting to traders who look for potential reversal signals after a brief decline in price.
It may also work well in markets where pullbacks are common, as this pattern could mark the end of a retracement and the resumption of the bullish trend.
How the Indicator Works:
Green Candle: The indicator first identifies a green candle, where the close of the candle is greater than its open (close > open). This signals that the current period closed higher than it opened, which is generally a bullish sign.
Breaking Previous Low: The indicator checks if the current candle's low is below the low of the previous candle (low < low ). If this condition is met, it means the price dropped below the previous candle's low but was still able to close higher (green candle), signaling a potential reversal or buying opportunity.
Buy Signal: If both conditions are true (green candle + breaking previous low), the indicator plots a buy signal below the candle in the form of an upward-facing triangle labeled "Buy" in green. This serves as a visual cue for traders to consider entering a buy position.
Optional Previous Low Plot: For added reference, the indicator plots the previous candle's low as a red step-line on the chart. This helps traders visualize when the price has dipped below the prior candle's low, making it easier to spot instances where the pattern is forming.
How to Use:
This indicator can be used across multiple timeframes, whether you’re trading short-term intraday patterns or longer-term swing trades.
It works well in markets that experience pullbacks or minor retracements, as the pattern it identifies suggests a rejection of lower prices followed by a push higher.
Traders can combine this indicator with other technical analysis tools (such as moving averages, support/resistance levels, or momentum oscillators) to strengthen the buy signals and add more context to the trading decision.
Example Scenarios:
Reversal Signal: Suppose a market has been in a minor downtrend, and suddenly a green candle forms after a low that breaks the previous day’s low. This indicator would generate a buy signal, suggesting the downtrend may be losing strength and that buyers are taking control. This could be an early indication of a reversal.
Bullish Continuation After Pullback: Imagine a market in a steady uptrend experiences a temporary pullback. The price breaks the previous candle’s low, but the current candle closes higher (green candle). This buy signal could indicate that the pullback is over, and the uptrend is likely to continue.
Advantages:
Simplicity: This indicator relies on basic price action (green candles and lows) without requiring complicated indicators or oscillators, making it easy to understand and use.
Visual Alerts: The plotted buy signals and previous lows provide a clear, visual representation on the chart, simplifying decision-making for traders.
Versatility: It can be applied across different timeframes and asset classes (stocks, forex, crypto, etc.), making it a versatile tool for all kinds of traders.
Limitations:
As with any single indicator or pattern, this should not be used in isolation. It is important to incorporate broader market context, support/resistance levels, and other forms of analysis to avoid false signals.
The pattern tends to be more effective when there’s sufficient market liquidity and may perform better in trending or volatile markets compared to sideways or flat markets.
PavanDeshetty-CallThe PavanDeshetty-Call indicator is a custom Pine Script tool designed to track options price movements for a specific call option and generate entry and exit signals based on predefined conditions. Below is a description of its key components:
Key Features:
Index Selection: Allows the user to select from major indices like NIFTY, BANKNIFTY, FINNIFTY, and MIDCPNIFTY. The selected index forms part of the option symbol.
Expiry Date Input: The user inputs the expiry day, month, and year, which helps to construct the full symbol for the call option being tracked.
Strike Price Selection: Allows the user to input a specific strike price for the call option, further refining the option symbol.
Option Symbol Generation: Based on the selected index, expiry date, and strike price, the indicator generates the symbol for the selected call option.
Data and Plotting:
Option Premium Data: The indicator fetches the open, high, low, and close data for the selected call option symbol using the request.security() function, which is then plotted as a candle chart. Green candles indicate price increases (close > open), while red candles indicate price decreases (close < open).
Entry and Exit Logic:
Entry Condition:
The indicator checks if the current option price is greater than or equal to 100.5% of the highest high of the previous "n" candles (the number of previous candles can be specified by the user).
If true, and if the user is not already in a position, a buy signal is generated.
Exit Condition:
The indicator checks if the option price has crossed below 99.5% of the previous candle's low.
If true, and if the user is in a position, a sell signal is generated.
Position Tracking:
The script uses a boolean variable in_position to track whether the user is currently in a trade. This prevents multiple entries and ensures that the exit condition resets the trade status.
Visual Signals:
Buy and Sell Signals:
Buy signals are plotted as green "Buy" labels at the bottom of the chart.
Sell signals are plotted as red "Sell" labels at the top of the chart.
After each signal, the flags for plotting the signals are reset.
Alerts:
Buy and Sell Alerts: The indicator includes alert conditions for both the buy and sell signals, allowing users to set up notifications when the entry or exit conditions are met.
This indicator is useful for traders looking to automate or track options trading based on specific strike prices and options expiry dates, combined with simple price-action-based entry and exit conditions.
SMC StructuresTitle: SMC Structures Indicator
Description:
The SMC Structures indicator is a powerful tool designed to identify and visualize key structural elements in price action, based on the principles of Smart Money Concepts (SMC). This indicator helps traders identify potential areas of support, resistance, and price reversals by highlighting significant market structures.
Key Features:
Structure Identification: The indicator automatically detects and marks important high and low structures in the market.
Break of Structure (BOS) Detection: It identifies and labels instances where previous structures are broken, indicating potential trend changes or continuations.
Change of Character (CHoCH) Detection: The indicator recognizes and marks Changes of Character, which are significant shifts in market behavior.
Customizable Visuals: Users can personalize the appearance of BOS and CHoCH markings, including colors, line styles, and widths.
Current Structure Display: The indicator can optionally show the current active structure, helping traders understand the immediate market context.
Historical Structure Tracking: Users can specify the number of historical structure breaks to display, allowing for a cleaner chart while maintaining relevant information.
Flexible Break Confirmation: The indicator offers the option to confirm structure breaks using either the candle body or wick, accommodating different trading styles.
Technical Details:
The indicator uses advanced algorithms to identify significant price structures based on local highs and lows.
It employs a lookback period of 10 bars for structure detection, ensuring relevance to current market conditions.
The code includes safeguards to handle different market phases and avoid false signals during ranging periods.
Customization Options:
Colors for Bullish and Bearish BOS and CHoCH markings
Line styles and widths for all structure markings
Number of historical breaks to display
Option to show or hide the current active structure
Choice between candle body or wick for structure break confirmation
Use Cases:
Trend Analysis: Identify the start of new trends or potential trend reversals.
Support and Resistance: Pinpoint key levels where price may react.
Trade Entry and Exit: Use structure breaks as potential entry or exit signals.
Market Context: Understand the broader market structure to make informed trading decisions.
This indicator is particularly useful for traders who follow Smart Money Concepts and those looking to enhance their understanding of market structure. It provides a visual representation of complex market dynamics, helping traders make more informed decisions based on structural analysis.
Note: This indicator is best used in conjunction with other analytical tools and a solid understanding of market dynamics. Always practice proper risk management when using any trading indicator.
Would you like me to explain or break down any part of the code?
Fibonacci & Bollinger Bands StrategyThis strategy combines Bollinger Bands and Fibonacci retracement/extension levels to identify potential entry and exit points in the market. Here’s a breakdown of each component and how the strategy works:
1. Bollinger Bands:
Bollinger Bands consist of a simple moving average (SMA) and two standard deviations (upper and lower bands) plotted above and below the SMA. The bands expand and contract based on market volatility.
Purpose in Strategy:
The lower band represents an area where the market might be oversold.
The upper band represents an area where the market might be overbought.
The price crossing these bands suggests overextended market conditions, which can be used to identify potential reversals.
2. Fibonacci Retracement and Extension Levels:
Fibonacci retracement levels are horizontal lines that indicate where price might find support or resistance as it retraces some of its previous movement. Common retracement levels are 61.8% and 78.6%.
Fibonacci extension levels are used to project areas where the price might extend after completing a retracement. These levels can help determine potential targets after a significant price movement.
Purpose in Strategy:
The strategy calculates the most recent swing high (fibHigh) and swing low (fibLow) over a lookback period. It then plots Fibonacci retracement and extension levels based on this range.
The Fibonacci levels are used as key support and resistance areas. The price approaching or touching these levels signals potential turning points in the market.
3. Entry Criteria:
A long position (buy) is triggered when:
The price crosses below the lower Bollinger Band, indicating an oversold condition.
The price is near or above a Fibonacci extension level (calculated based on the most recent price swing).
This suggests that the price is potentially reaching a strong support area, where a reversal is likely.
4. Exit Criteria:
The long position is closed (exit trade) when either:
The price touches or crosses the upper Bollinger Band, signaling an overbought condition.
The price reaches a Fibonacci retracement level or exceeds the recent swing high (fibHigh), indicating a potential exhaustion point or a reversal area.
5. General Strategy Logic:
The strategy takes advantage of market volatility (captured by the Bollinger Bands) and key support/resistance levels (determined by Fibonacci retracement and extension levels).
By combining these two techniques, the strategy identifies potential entry points at oversold levels with the expectation that the market will retrace or reverse upward, especially when near key Fibonacci extension levels.
Exit points are identified by potential overbought levels (Bollinger upper band) or key Fibonacci retracement levels, where the price might reverse downward.
6. Conditions to Execute the Strategy:
The Fibonacci levels are only calculated once the price has made a significant movement, establishing a recent high and low over a 50-bar period (which you can adjust). This ensures the Fibonacci levels are based on meaningful swings.
The entry and exit signals are filtered using both Bollinger Bands and Fibonacci levels to ensure that trades are not taken solely based on one indicator, thus reducing false signals.
Key Features of the Strategy:
Trend-following with reversal: It tries to catch reversals when the price hits extreme levels (Bollinger Bands) while respecting important Fibonacci levels.
Dynamic market adaptation: The strategy adapts to market conditions as it recalculates Fibonacci levels based on recent price swings and adjusts the Bollinger Bands for market volatility.
Confirmation through multiple indicators: It uses both the volatility-based signals from Bollinger Bands and the price structure from Fibonacci levels to confirm trade entries and exits.
Summary of the Strategy:
The strategy looks to buy low and sell high based on oversold/overbought signals from Bollinger Bands and Fibonacci levels that indicate key support and resistance zones.
By combining these two technical indicators, the strategy aims to reduce risk and increase accuracy by only entering trades when both indicators suggest favorable conditions.
Fear Greed Zones by Relative Strength IndexThis is a visual modification of the relative Strength Index (RSI) to express extreme areas as fear and greed Zones.
// Input
rsiLength = input.int(14, "RSI Length", minval=1)
// RSI calculation
rsi = ta.rsi(close, rsiLength)
FEAR GREED ZONES
The "Fear Greed Zones Script" indicator is designed to help traders identify psychological levels of fear and greed in the market by utilising relative strength index. It primarily utilises the Relative Strength Index of price to gauge market sentiment, with the following key features:
Color-Codes
Dark Red: Indicates a greed zone , suggesting extreme overbought conditions (high risk) and a possible price reversal downward.
Dark Green: Represents a fear zone, indicating extreme oversold conditions (low risk) and potential for price reversal upward.
Yellow: Serves as a neutral zone with medium risk.
Usage
Market Sentiment Analysis: Traders can use the fear and greed zones to assess overall market sentiment, aligning their strategies with prevailing emotional biases. This helps in identifying potential entry and exit points based on market psychology.
Risk Management: Understanding fear or greed influences market behavior and allows traders to manage their risk more effectively with the knowledge of high or low risk areas; as they can anticipate potential reversals or continuations in price trends.
Conclusion
The "Fear Greed Zones" Script is a valuable tool for traders looking to leverage market psychology. By clearly identifying areas where fear or greed may be influencing price movements, it aids in making more informed trading decisions.
HTF LQ SweepThe following script recognises QL sweeps in the desired time frame with alarm function!
Theory:
There is liquidity above highs and below lows. If this is tapped and the market reacts strongly immediately, the probability of a reversal is greatly increased! In the chart, this is defined in such a way that a candle has its wicks BELOW the old low, but the close is ABOVE the old low. the same applies to the high, of course!
In such a case we have an "LQ Sweep"
How does the script work?
Williams 3 fractals are used as a basis. These are meaningful as lows or highs. Whenever a fractal is created, the price level is saved.
This means that not only the last fractal is relevant, but all historical fractals as long as they have not been reached!
If a candle reaches the level, but shows a rejection and closes within the level again, we have our "LQ Sweep" setup.
In the script you can select the timeframe in which the market has to be analysed. When the QL sweep occurs, an alert is triggered. This saves a lot of time because you can analyse different markets in different timeframes at the same time!
Each QL Sweep is marked in the chart when we are in the selected timeframe. These can also be deactivated so that only the last sweep is displayed.
Benefits for the trader:
An LQ sweep is a nice confirmation for a reversal.
If we have such an LQ sweep, we can wait in the lower timeframe for further confirmation, such as a structural break, to position our entries there.
The alarm function saves us a lot of time and we only go to the chart when a potential setup has been created.
You can set different time frames in the script: The selected time frame is then scanned and sends a signal when the event occurs.
Divergence Indicator Multi [TradingFinder] MACD AO RSI DIV Chart🔵 Introduction
🟣 What is Divergence in Financial Markets?
Divergence in technical analysis happens when the price of a stock moves in a direction opposite to certain indicators. This is a crucial concept in financial markets as it can signal either a trend reversal or a continuation of the current correction in the trend. Understanding divergence helps traders and analysts make more informed decisions.
🟣 Positive Regular Divergence (RD+)
A positive regular divergence occurs at the end of a downtrend, where two price lows form. This divergence appears when the price chart shows a new low, but the indicator does not follow, signaling potential buying opportunities.
Positive divergence indicates increased buying pressure and reduced selling pressure, making it a useful signal for forecasting price increases.
🟣 Negative Regular Divergence (RD-)
A negative regular divergence is seen during an uptrend when two price highs form. The price chart records a new high, but the indicator does not reflect this change, suggesting that a market downturn is likely.
This type of divergence shows strong selling pressure and weaker buying activity, which can help identify selling opportunities.
Both positive and negative divergences are powerful tools for identifying potential trend reversals and key support and resistance levels. For example, when an indicator trends upward while the price moves downward, this creates divergence, warning traders to reconsider their investment strategy.
🟣 Different Types of Divergence in Trading
1. Regular Divergence :
o Positive Regular Divergence (RD+)
o Negative Regular Divergence (RD-)
2. Hidden Divergence :
o Positive Hidden Divergence (HD+)
o Negative Hidden Divergence (HD-)
3.Time Divergence.
Note : This guide focuses specifically on Regular Divergence.
🟣 What is Regular Divergence?
Regular Divergence, often referred to as convergence, occurs when price action and indicators show conflicting patterns, usually signaling the end of a trend. Detecting regular divergence helps traders anticipate potential trend reversals or the formation of reversal patterns.
🔵 How to Use
To optimize the detection of divergence, you can adjust the Fractal Period to specify the length of time for identifying divergence patterns.
Additionally, with the Divergence Detection Method, you can select oscillators like the MACD, RSI, or AO to base divergence detection on.
Divergence in MACD :
MACD divergence occurs when the price chart forms an opposite pattern compared to the MACD line, indicating a potential price reversal.
Divergence in RSI :
In a downtrend, if the price chart forms two consecutive lows with the second lower than the first, but the RSI shows two lows with the second higher, this indicates positive regular divergence, which is a buy signal.
On the other hand, during an uptrend, if the price forms two highs with the second higher than the first, but the RSI shows the second high lower, this points to negative regular divergence, indicating a sell signal.
Divergence in AO (Awesome Oscillator) :
The AO indicator calculates histograms using the difference between 5-period and 34-period simple moving averages. It compares peaks and troughs of these histograms with price movements, detecting divergence and plotting lines and arrows to signal divergence.
🔵 Table
The following table breaks down the main features of the oscillator. It covers four critical categories: Exist, Consecutive, Divergence Quality, and Change Phase Indicator.
Exist : If divergence is detected, a "+" will appear in this row.
Consecutive: Shows the number of consecutive divergences that have formed in a short period.
Divergence Quality : Evaluates the quality of the divergence based on the number of occurrences. One is labeled "Normal," two are "Good," and three or more are considered "Strong."
Change Phase Indicator : If a phase change is detected between two oscillation peaks, this is marked in the table.
Larry Williams Valuation Index [tradeviZion]Larry Williams Valuation Index
Welcome to the Larry Williams Valuation Index by tradeviZion! This script is an interpretation of Larry Williams' famous WillVal (Valuation) Index, originally developed in 1990 to help traders determine whether a market or asset is overvalued or undervalued. We've extended it to support multiple securities and offer alerts for different valuation levels, helping you make more informed trading decisions.
What is the Valuation Index?
The Valuation Index measures how a security's current price compares to its historical price action. It helps identify whether the security is overvalued (priced too high), undervalued (priced too low), or in a normal range.
This version supports multiple securities and uses valuation parameters to help you assess the relative valuation of three securities simultaneously. It can help you determine the best times to enter (buy) or exit (sell) the market.
Key Features
Multi-Security Analysis: Analyze up to three securities simultaneously to get a broader view of market conditions.
Valuation Levels: Automatically calculate overvaluation and undervaluation levels or set manual levels for consistent analysis.
Custom Alerts: Create custom alerts when securities move between overvalued, undervalued, or normal ranges.
Customizable Table Display: Display a table with valuation values and their status on the chart.
Getting Started
Step 1: Adding the Script to Your Chart
First, add the Larry Williams Valuation Index script to your chart on TradingView. The script is designed to work with any timeframe, but for best results, use weekly or daily timeframes for a longer-term perspective.
Step 2: Configuring Securities
The script allows you to analyze up to three different securities :
Security 1 (Default: DXY)
Security 2 (Default: GC1!)
Security 3 (Default: ZB1!)
You can enable or disable each security individually.
Custom Timeframe Option: You have the option to select a custom timeframe for analysis. This allows you to see whether the security is overvalued or undervalued in lower or higher timeframes. Note that this feature is experimental and has not been extensively tested. Larry Williams originally used the weekly timeframe to determine if a stock was overvalued or undervalued. By default, the indicator compares the current price with the security based on the selected timeframe, except if you choose to use a custom timeframe.
Pro Tip : New users can start with the default securities to understand the concept before using other assets.
Step 3: Valuation Index Settings
Short EMA Length : This is the short-term average used for calculations. A lower value makes it more responsive to recent price changes.
Long EMA Length : This is the long-term average, used to smooth the valuation over time.
Valuation Length (Default: 156) : Represents approximately three years of daily bars (as recommended by Larry Williams).
How is the Valuation Index Calculated?
The valuation calculation is done using a method called WVI (WillVal Index), which compares the current price of a security to the price of another correlated security. Here’s a step-by-step explanation:
1. Data Collection: The script takes the closing price of the security you are analyzing and the closing price of the correlated security.
2. Ratio Calculation : The ratio of the two prices is calculated:
Price Ratio = (Price of your security) / (Price of correlated security) * 100.
This ratio helps determine how expensive or cheap your security is compared to the correlated one.
3. Exponential Moving Averages (EMAs) : The price ratio is used to calculate short-term and long-term EMAs (Exponential Moving Averages). EMAs are used to create smooth lines that represent the average price of a security over a specific period of time, with more weight given to recent data. By calculating both short-term and long-term EMAs, we can identify the trend direction and how the security is performing compared to its historical averages.
4. Valuation Index Calculation:
The Valuation Index is calculated as the difference between the short-term EMA and the long-term EMA. This difference helps to determine if the security is currently overvalued or undervalued:
A positive value indicates that the price is above its longer-term trend, suggesting potential overvaluation.
A negative value indicates that the price is below its longer-term trend, suggesting potential undervaluation.
5. Normalization:
To make the valuation easier to interpret, the calculated valuation index is then normalized using the highest and lowest values over the selected valuation length (e.g., 156 bars).
This normalization process converts the index into a percentage between 0 and 100, where higher values indicate overvaluation and lower values indicate undervaluation.
Step 4: Understanding Valuation Levels
The valuation levels indicate whether a security is currently undervalued, overvalued, or in a normal range.
Manual Levels : You can manually set the overvaluation and undervaluation thresholds (default is 85 for overvalued and 15 for undervalued).
Auto Levels : The script can automatically calculate these levels based on recent price action, allowing you to adapt to changing market conditions.
Auto Levels Calculation Explained:
The Auto Levels are calculated by taking the average of the valuation indices for all three securities (e.g., index1, index2, and index3).
The script then looks at the highest and lowest values of this average over a selected number of recent bars (e.g., 50 bars).
The overvaluation level is determined by taking the highest value and multiplying it by a multiplier (e.g., 5). Similarly, the undervaluation level is calculated using the lowest value and the multiplier.
These dynamic levels adjust according to recent price action, providing an adaptive approach to identifying overvalued and undervalued conditions.
Step 5: How to Use the Script to Make Trading Decisions
For new users, here's a step-by-step trading strategy you can use with the Valuation Index:
1. Identify Undervalued Opportunities
When two or more securities are in the undervalued range (below 15 for manual or below automatically calculated undervalue levels), wait for at least two of these securities to turn from undervalued to normal .
This transition indicates a potential buy opportunity .
2. Buying Signal
When at least two securities transition from undervalued to normal, you can consider buying the asset.
This indicates that the market may be recovering from undervalued conditions and could be moving into a growth phase.
3. Selling Signal
Exit when the price high closes below the EMA 21 (21-day exponential moving average).
Alternatively, if the valuation index reaches overvalued levels (above 85 manually or auto-calculated), wait for it to drop back to normal . This can be another point to exit the trade .
You can also use any other sell condition based on your r isk management strategy .
Alerts for Valuation Levels
The script includes alerts to notify you of changing market conditions:
To activate these alerts, follow these steps, referring to the provided screenshot with detailed steps:
1. Enable Alerts : Click on the settings gear icon on the script title in your chart. In the settings menu, scroll to the section labeled Alerts Settings .
Enable Alerts by checking the Enable Alerts box.
Set the Required Securities for Alert (default is 2 securities).
Choose the Alert Frequency : Selecting Once Per Bar Close will trigger alerts only at the close of each bar, ensuring you receive confirmed signals rather than potentially noisy intermediate signals.
2. Select Alert Type : Choose the type of alert you want to activate, such as Alert on Overvalued, Alert on Undervalued, Alert on Over to Normal , or Alert on Under to Normal .
3. Save Settings : Click OK to save your alert settings.
4. Add Alert on Indicator : Click the "..." (More button) next to the indicator name on the chart and select " Add alert on tradeviZion - WillVal ".
5. Create Alert : In the Create Alert window:
Set Condition to tradeviZion - WillVal .
Ensure Any alert() function call is selected.
Set the Alert Name and select your Expiration preferences.
6. Set Notification Preferences : Go to the Notifications tab and select how you want to receive notifications, such as via app notification, toast notification, email , or sound alert . Adjust these preferences to best suit your needs.
7. Click Create : Finally, click Create to activate the alert.
These alerts will help you stay informed about key market conditions and take action accordingly, ensuring you do not miss critical trading opportunities.
Understanding the Table Display
The script includes an interactive table on the chart to show the valuation status of each security:
Security : The name of the security being analyzed.
Value : The current valuation index value.
Status : Indicates whether the security is overvalued, undervalued , or in a normal range.
Color: Displays a color code for easy identification of status:
Red for overvalued.
Green for undervalued.
Other colors represent normal valuation levels.
Empowering Messages : Motivational messages are displayed to encourage disciplined trading. These messages will change periodically, helping keep a positive trading mindset.
Acknowledgment
This tool builds upon the foundational work of Larry Williams, who developed the WillVal (Valuation) Index concept. It also incorporates enhancements to extend multi-security analysis, valuation normalization, and advanced alerting features, providing a more versatile and powerful indicator. The Larry Williams Valuation Index [ tradeviZion ] helps traders make informed decisions by assessing overvalued and undervalued conditions for multiple securities simultaneously.
Note : Always practice proper risk management and thoroughly test the indicator to ensure it aligns with your trading strategy. Past performance is not indicative of future results.
Trade smarter with TradeVizion—unlock your trading potential today!
---Advanced Harmonic Pattern Scanner v5Summary of the Script:
All Patterns Covered: The script includes all major harmonic patterns: Butterfly, Gartley, Crab, Bat, Cypher, and Three Drives. Both bullish and bearish versions are detected.
ZigZag Swings: The zigzag logic helps find swing points (X, A, B, C, D) which are essential for forming these patterns. You can adjust the zigzagDepth parameter to fine-tune how sensitive the pattern detection is to price swings.
Fibonacci Levels: Each pattern uses specific Fibonacci retracement or extension levels to identify potential patterns, and the script compares price movements to these ratios.
Visual Aid: It uses plotshape() to display detected patterns on the chart and optional line.new() functions to connect the swing points for a better visual representation of the patterns.
How to Customize:
Timeframe: You can run this script on different timeframes by changing the chart on TradingView (1 min, 1 hour, 1 day, etc.).
ZigZag Sensitivity: Adjust the zigzagDepth to refine how frequently swing points are detected. Larger numbers will reduce sensitivity and show fewer but more pronounced patterns.
Pattern Refinement: Modify Fibonacci levels to experiment with custom harmonic patterns or adjust thresholds for the existing ones.
This code is an advanced version and scans the market comprehensively for all major harmonic patterns. Let me know if you need further modifications or explanations!
Multiple ATR Lines with Current Price PercentageThis indicator plots multiple lines based on the Average True Range (ATR) on the chart, helping traders identify potential support and resistance levels. Specifically, it draws three lines above the price and three lines below the price at different multiples of the ATR. Additionally, it plots a dynamic line at the current price level, which shows how much percentage of the ATR the current price has traveled from a specific point.
How it works:
ATR-Based Lines: The indicator calculates three upper and three lower levels based on the ATR of the selected period. These levels represent 1x, 2x, and 3x ATR above and below the current price.
Current Price Line: A dotted line follows the current price, displaying the percentage of the ATR that the price has moved.
Labels: Each line is labeled with its respective ATR multiple (1x ATR, 2x ATR, 3x ATR), and the current price line shows the percentage of the ATR traveled.
Use Cases:
Identifying Market Volatility: Traders can use this indicator to see how far the price has moved relative to its average volatility.
Support and Resistance Levels: The ATR lines can be treated as potential support and resistance zones, providing insight into price targets or stop-loss placement.
Dynamic Tracking: The percentage of ATR traveled helps traders understand the market momentum relative to its historical volatility.
Settings:
ATR Length: The user can adjust the length of the ATR calculation period.
ATR Multiplier: A multiplier to adjust the distance of the lines relative to the ATR.
Advantages:
Clear visualization of market volatility through ATR-based levels.
Real-time tracking of the price’s movement relative to ATR, giving traders a better understanding of price action.
Customizable settings for different trading styles.
WPR Volume Candle [Atareum]AWPRVC (Atareum WPR Volume Candles) is clearly an awesome indicator produced by AtareumFX that is based on William’s Percent Range concepts by combination with volume. This is a new approach of volume candles that is combined with R% concepts and creates such a powerful tool to trace the market and assists traders to make better decisions surly and so much accurate. You can find this new indicator more useful because it has all benefits and advantages of William’s R% and cover its disadvantages. Also it is more powerful because of using volume in its calculations and generate a new candles which is more reliable and trustworthy.
Concept:
Using William’s Percent leading periods and calculations on redesigning new candles in combination with volume, that makes unique reform candles, but these new candles with their new cloud system clearly response to any reasonable price movement with so much information.
As you know if use R% there are some misleading fake signals generate by oscillator, also it could not show any sign of price moving trend which is almost confusing for beginners or even a pro trader! And finally this oscillator is so sensitive to price change that is so creepy to use for most of traders.
This new AWPRVC solve the problem and make all of them handy and useful for you.
The cloud system which is designed in AWPRVC shows the price trend moving from Bearish Zone (-100 to -50 percent) to Bullish Zone (-50 to 0 percent). You can trust the lead moving forward of the clouds in two separate Top and Bottom (Bull and Bear) lines which solely determine the trend and power of price moving. When clouds are close to each other means we continue the trend and when they get far away from each other means we will face powerful trend in near future. If they are in Bearish Zone we continue the selling pressure and vice versa. Following picture shows good sample of Long and Short positions in compare with so many fake signals generated on original R%.
Besides the cloud system of AWPRVC which is clearly show the price trend and it is completely enough for being sure about price moving trend, you can use moving average which is designated in it to confirm the price trend, also.
Also you can see this new AWPRVC candle by using volume within its conformation, make reasonable price candles which is no so sensitive and so creepy and make your decisions come true in peace and clear sense of market moves. You can see following picture which is showing although the real price candles are so unclear and nonsense of making decision but the AWPRVC candles lead you to make true and trustable position.
As you see this new combination of Williams R% oscillator with volume and also generating a perfect new cloud system will clearly help traders even pro to trust the signals and understand whole market movement better and all of original problems of R% solved and even make a most powerful, trustworthy and useful new indicator.
Parameters:
Section 1 : Candle colour setting for flourishing just as you desire !
Section 2 : Defining Periods of R% and source of candle data in combination with determining the smoothing type of moving averages and signal period.
Section 3 : Select using Standard candles alongside with redesigned cloud calculation type and three additional moving averages which can plot on each newly generated candles and standard candles on a chart with the type mode defined in the previous section.
Note: if you want to omit any or all of these moving averages, you can use 0 in period, instead of selecting "None" in the plot moving option!
Usage :
Overall:
Regardless of the additional moving averages which will lead to so many situations of market according to their types and designs, that is four different period for new redesign AWPRVC and three period for standard chart. You can easily select periods and type for these moving averages. Also, do not forget that signal moving averages is shown only on AWPRVC chart and have two different colour for upward and downward trends. Other moving averages are plot by just one single colour.
Cloud levels are so important because AWPRVC candles show respect to them and when they break the clouds upward or downward it is surly beginning of a trend. Do not forget we have 5 levels for tracing new AWPRVC candles move as follows : Ready for Short \ Long, Surly Short \ Long and Turn Trend which is in middle range of movement percent. Each level clearly shows what it means by its name.
Support and Resistance:
Any consolidation of AWPRVC candles in Ready for Short or Long Zones means the support or resistance level due to its nature, but important thing is how long the candles lasts in there or how many times repeated in the same level in AWPRVC chart zone in future.
For plotting the support or resistance you should trace range of AWPRVC candles consolidated and plot zone in standard chart candles just like following picture.
Divergence:
When standard price candles move downward but we see upward trend in clouds of AWPRVC candles that means we should face Bullish Trend because of the divergence and vice versa. You can see perfect example in following picture.
Signal:
Alert of Long :
Bullish candle cross both cloud down and up level simultaneously.
Confirmed Long :
AWPRVC candles cross up turn trend level and pullback to cloud up level.
Take profit of Long:
Any cross down of the AWPRVC candles from surly short level of chart.
Alert of Short :
Bearish candle cross both cloud up and down level simultaneously.
Confirmed Short :
AWPRVC candles cross down turn trend level and pullback to cloud down level.
Take profit of Short:
Any cross up of the AWPRVC candles from surly long level of chart.
Notes:
Use moving averages cross of standard chart candles as lead to be in positions more as they are good representative of trend.
As long as AWPRVC candles or Cloud levels are in Bullish Zone, you can stay in Long positions.
Cloud level thickness means the power of trend and can be use as confirmation of powerful trend, so when cloud levels tight or going to cross each other it means the trend is going to be reversed.
It is the result of many years of experience in markets and there are so many details about this AWPRVC chart which I am in the experiment phase to publish in the future, so please help me with your ideas and do not hesitate to comment and inform me any suggestions or criticism.
SUSH ALGOStep-by-Step Guide for Trading Using the Script
1. Asset Selection
When applying this script, the first thing to do is select your desired asset to trade.
You can select from the following assets within the script:
Scalping
Gold
USD/JPY
EUR/USD
EUR/JPY
BTC/USD
NIFTY 50
The parameters for the strategy (e.g., q, r, s, and ADX Threshold) will adjust automatically based on your selected asset. If you want to use custom parameters, turn on the Use Manual Settings option.
2. Adjust Manual Settings (Optional)
Use Manual Settings: Toggle this if you want to input your custom values for the strategy parameters.
Manual q: Affects swing period calculation.
Manual r: Affects the smoothing in the calculation of the oscillator.
Manual s: Affects the smoothing period of the main line of the oscillator.
Manual Signal Length: Length of the signal line for generating buy/sell signals.
Manual ADX Threshold: Adjusts the ADX value to filter trades based on trend strength.
3. Reading the SMI (Stochastic Momentum Index) Oscillator
SMI: This indicator oscillates between overbought and oversold levels, signaling potential entry and exit points.
Overbought Level: +30
Oversold Level: -30
The signal line is calculated based on the smoothed SMI value.
A crossover above the signal line in the oversold region (< -30) signals a buy.
A crossunder below the signal line in the overbought region (> +30) signals a sell.
4. Trade Signal Alerts
Buy Signal Alert: Triggered when the SMI crosses over the signal line in the oversold zone, and ADX exceeds the threshold.
Sell Signal Alert: Triggered when the SMI crosses under the signal line in the overbought zone, and ADX exceeds the threshold.
5. Entry, Stop Loss, and Target Levels
Entry Line: The script will plot an entry line at the close price when a buy or sell signal is triggered.
Stop Loss: A stop loss will be set based on the lowest low (for buy signals) or highest high (for sell signals) of the previous candles.
Take Profit Targets:
Target 1 (TP1): 3 times the size of the entry candle.
Target 2 (TP2): 6 times the size of the entry candle.
Target 3 (TP3): 10 times the size of the entry candle.
Make sure the Show Entry, Show Stop Loss, and Show Targets toggles are enabled to visualize these lines on the chart.
6. Monitoring the ADX (Average Directional Index)
The ADX value filters weak signals, ensuring that you trade only in trending markets.
If ADX > adxThreshold, the trend is strong, and the buy or sell signal becomes valid.
If ADX < adxThreshold, the trade signals are ignored to avoid trading in sideways markets.
7. Box, Line, and Label Toggles for Swing Highs/Lows
The script allows you to visualize swing highs and lows for better market context. You can toggle the following options:
Show Boxes: Displays rectangular boxes around the swing highs and lows.
Show Swing Lines: Plots lines at swing highs and lows for visual confirmation of key price levels.
Show Labels: Adds text labels to the swing levels, indicating whether they represent a swing high or low.
8. Customize Appearance (Optional)
You can change the appearance of the boxes, lines, and labels, such as their color, width, and style (solid or dotted), from the Appearance settings.
9. Monitor Volume and Open Interest (Optional)
You can also track volume and open interest (OI) data from various exchanges like Binance and BitMEX to get additional confirmations.
Steps for Trading
1.Select your asset from the drop-down menu based on your trading preferences.
2.Adjust manual settings (optional) if you want to use your own parameters for the strategy.
3.Wait for a buy or sell signal to trigger based on the crossover of the SMI oscillator in the overbought/oversold regions.
4.Once a signal is triggered, check for the plotted entry price, stop loss, and take profit levels on your chart.
5.Monitor the ADX value to ensure that the market is trending strongly.
6.If the trade meets your criteria, enter the trade at the indicated price.
Set your stop loss and take profit orders as indicated by the script.
Key Notes
# This strategy is designed for both trending and mean-reversion markets depending on the asset and the ADX value.
# Make sure to practice proper risk management by adjusting the stop loss and position size based on your risk tolerance.
best indicator at 15 minut This Pine Script code builds an indicator called EMA Crossover with Historical Price Projection that combines two components:
EMA Crossover Strategy:
EMA 9 and EMA 21: The script calculates two exponential moving averages (EMAs) using the ta.ema() function. The crossover between these EMAs generates buy/sell signals.
A bullish crossover (when EMA 9 crosses above EMA 21) signals a buy.
A bearish crossover (when EMA 9 crosses below EMA 21) signals a sell.
These buy/sell signals are visualized on the chart using the plotshape() function with green and red symbols.
Historical Price Projection:
The code projects future prices based on historical price trends. It takes into account growth factors (user-defined drift percentages) to estimate future prices.
Projection Line: It draws a projection line from the anchor point (set by the user) using historical data. The drift factor allows you to control the projection's slope.
Forecasting Area: It shows an optional area around the projected price, adjusting the width with a user-defined growth factor for the forecast's uncertainty.
Key Sections:
Inputs:
User-defined inputs for controlling the growth factor, line styles, and forecasting area settings.
An anchoring point is provided to determine from which bar the price projection should start.
EMA Crossover:
The crossover conditions for EMA 9 and EMA 21 are defined, and the script generates buy and sell signals at those crossovers.
Historical Price Projection:
It stores the percentage changes between bars in barDeltaPercents.
It projects the future price based on these percentages and the user-defined drift factor.
The projected price is visualized using polyline.new(), and a shaded area can be added to show the range of price possibilities.
Execution Logic:
The script runs when the current time is greater than the anchor point.
If the anchor point is too far back in history, it gives a warning via the showInfoPanel function.
As new bars are confirmed, the drift is calculated, and the projection line and area are updated based on historical price changes.
Overall Flow:
It gathers price data up to 500 bars from the anchor point.
Based on the historical price trend, it forecasts the future price with a projection line and an optional shaded area.
The crossover logic for EMA 9 and 21 provides actionable signals on when to buy or sell.