Momentum Indicators SuiteThis script is a Momentum Indicators Suite for traders using Pine Script™ (version 5). Its purpose is to evaluate market conditions by aggregating signals from multiple technical indicators into a single "bullish," "bearish," or "neutral" state. Below is a detailed breakdown of its components and functionality:
1. Indicators Used
The script incorporates several well-known technical indicators to assess market momentum:
RSI (Relative Strength Index)
MACD (Moving Average Convergence Divergence)
Stochastic Oscillator
TSI (True Strength Index)
CCI (Commodity Channel Index)
Choppiness Index
Vortex Indicator
Momentum and ROC (Rate of Change)
2. Scoring System
Each indicator assigns points based on its signals:
+1 Point for bullish conditions.
-1 Point for bearish conditions.
0 Points for neutral or indecisive signals.
These points are aggregated to calculate a total score (totalPoints), representing overall market momentum.
3. Market State Determination
The total points determine the market state:
Bullish if totalPoints > 0.
Bearish if totalPoints < 0.
4. Dynamic Trend Label
When the market state changes, a label is added to the chart:
Green label for bullish trends.
Red label for bearish trends.
5. Visual Enhancements - Plot and Fill (Optional)
6. Customization - Traders can adjust several inputs for fine-tuning:
7. Target Audience - This script is ideal for:
Traders who rely on momentum and trend analysis for decision-making.
Those seeking a consolidated view of multiple indicators.
Swing and day traders aiming to identify trend changes promptly.
8. Potential Use Cases
Trend Confirmation: Helps confirm bullish or bearish market trends.
Trade Setup Identification: Assists in aligning trades with dominant market momentum.
Risk Management: Signals market neutrality or choppiness to avoid indecisive conditions.
This script simplifies complex momentum analysis by aggregating multiple indicators into actionable insights, making it a valuable tool for technical traders.
Penunjuk dan strategi
Opening Candle High/Low with Time Zone and Minute Offset
Title: Opening Candle High/Low with Time Zone and Minute Offset
Description:
The Opening Candle High/Low with Time Zone and Minute Offset indicator is a versatile tool that highlights the high and low of the first candle of the trading session, adjusted for your preferred time zone and minute offset. It is particularly useful for traders who focus on opening ranges as key reference points for their trading strategies.
---
Features:
1. Time Zone and Minute Adjustment:
- Allows customization of the start time by applying a time zone offset (in hours) and a minute offset.
- Ideal for traders operating in different time zones or trading sessions that don't align with midnight UTC.
2. Dynamic First Candle Detection:
- Automatically captures the high and low of the first candle after the adjusted time.
- Resets daily, ensuring accurate levels for each new trading session.
3. Visual Representation:
- Plots the high and low levels of the first candle directly on the chart for easy reference.
- Uses distinct colors (green for the high and red for the low) and adjustable line widths for clarity.
4. Simplicity and Versatility:
- Works across all markets and timeframes, providing essential information for opening range breakout strategies, support/resistance analysis, or session-based trading.
---
How It Works:
1. Time Adjustment:
- The indicator adjusts the current chart time by applying the user-defined hour and minute offsets.
- This ensures the "opening candle" aligns with your specific trading session requirements.
2. First Candle Detection:
- When the adjusted time matches the start of a new day (midnight with offsets), the indicator captures the high and low of the first candle.
- These values are stored and remain static throughout the trading day.
3. Plotting:
- The high and low levels of the opening candle are plotted on the chart, providing visual reference points for traders.
---
Use Case:
- This indicator is ideal for traders who rely on the opening range of a session for planning trades, such as breakout or reversal strategies.
- It can also serve as a key tool for identifying significant price levels in session-based trading.
Simplify your trading analysis and align your strategy with this customizable and intuitive indicator.
Longest Candles HighlighterDescription:
The Longest Candles Highlighter is a simple yet effective tool that identifies and highlights candles with significant price ranges. By visually marking candles that meet specific size criteria, this indicator helps traders quickly spot high-volatility moments or significant market moves on the chart.
Features:
1. Customizable Candle Range:
- Define the minimum and maximum candle size in pips using input fields.
- Tailor the indicator to highlight candles that are most relevant to your trading strategy.
2. Flexible for Different Markets:
- Automatically adjusts pip calculation based on the instrument type (Forex or non-Forex).
- Accounts for differences in pip values, such as the 0.01 pip for JPY pairs in Forex.
3. Visual Highlighting:
- Highlights qualifying candles with a customizable background color for easy identification.
- The default color is red, but you can choose any color to match your chart theme.
4. Precision and Efficiency:
- Quickly scans and identifies candles that meet your criteria, saving you time in analyzing charts.
- Works seamlessly across all timeframes and asset classes.
How It Works:
- The indicator calculates the range of each candle in pips by subtracting the low from the high and dividing by the appropriate pip value.
- It checks whether the candle's size falls within the user-defined minimum and maximum pip range.
- If the conditions are met, the background of the candle is highlighted with the specified color, drawing your attention to significant price movements.
Use Case:
- This indicator is ideal for identifying key market moments, such as breakouts, volatility spikes, or significant price movements.
- Traders can use it to quickly locate large candles on any chart, aiding in technical analysis and strategy development.
This tool simplifies the process of spotting important candles, empowering traders to make faster and more informed trading decisions.
Previous Week High & Low with middle lineDescription:
The Previous Week High & Low Indicator is a powerful tool designed to provide traders with key reference levels from the previous trading week. It dynamically calculates and plots the previous week's high, low, and midpoint levels directly on your chart, helping you identify critical support and resistance zones.
Features:
1. **Previous Week High and Low Lines**:
- The indicator displays the high and low prices of the previous trading week, allowing you to analyze price action relative to these levels.
- These lines are plotted as step lines, visible only during the active trading days (Monday to Friday), ensuring clean and uncluttered charts.
2. Midpoint Line:
- The midpoint between the previous week's high and low is calculated and displayed as a reference level.
- This white line can act as a psychological pivot point for market participants.
3. Customizable Display:
- You can toggle the visibility of the high and low lines using input options, tailoring the indicator to your preferences.
4. Precision and Aesthetics:
- The lines are plotted with precision and styled for clarity, using subtle transparency for an unobtrusive yet informative appearance.
Use Case:
- This indicator is ideal for traders who rely on historical price levels for planning entries, exits, or stop-loss placements.
- It works seamlessly with any timeframe and asset, making it versatile for various trading strategies.
How It Works:
- The indicator fetches the previous week's high and low prices using the weekly timeframe and "lookahead" mode to ensure these levels remain static after the week's close.
- The lines are plotted only on weekdays (Monday to Friday) to exclude weekend data, ensuring accuracy for markets that operate 24/5.
This tool simplifies your chart analysis and empowers you to make informed trading decisions based on historical price dynamics.
GBM with Volatility EstimationSSL Strategy Integration:
SSL High and SSL Low lines are calculated using ta.sma of the high and low prices.
Buy and sell signals are generated when the price crosses above the high line (buy) or below the low line (sell).
Dynamic Breakout Zones:
Horizontal lines for upper_bound and lower_bound adjust dynamically based on the GBM model.
Combined Signals:
Breakout signals: Triggered when the price moves above upper_bound or below lower_bound.
SSL signals: Triggered when the price crosses above the SSL High (buy) or below SSL Low (sell).
Trend Visualization:
The background color reflects the SSL trend:
Green: Bullish (price above SSL High).
Red: Bearish (price below SSL Low).
Global Liquidity Index with OffsetThe Global Liquidity Index by Ingeforberg, but with the option of offsetting the data by a variable number of weeks, as frequently shown by Global Macro Investor and Real Vision. Bitcoin and many other crypto assets frequently follow global liquidity, and by offsetting it, an investor "may" gain insight into future price movements. The number of weeks offset can be adjusted in the settings.
gallant volumeDescription:
The "Gallant with Custom Volume" indicator is designed to enhance your technical analysis by integrating advanced volume metrics with Ichimoku components. This versatile tool allows traders to visualize various volume types, such as standard volume, dollar volume, On-Balance Volume (OBV), Volume Weighted Average Price (VWAP), and Accumulation/Distribution (A/D) line.
Key Features:
Customizable Volume Types: Select from multiple volume sources to suit your trading strategy, providing deeper insights into market dynamics.
Volume Candle Visualization: Color-coded volume candles make it easier to identify market trends at a glance.
Ichimoku Integration: The indicator includes traditional Ichimoku lines (Tenkan-Sen, Kijun-Sen, and Senkou Span A/B), helping you assess market momentum and potential reversals.
Trading Signals: Alerts and visual signals are generated when key crossovers occur, aiding in timely decision-making.
Use Cases:
This indicator is suitable for both day traders and long-term investors looking to incorporate volume analysis with ichimoku techniques. It provides a comprehensive view of market conditions, enhancing your ability to identify potential buy and sell opportunities.
Note: Customize the periods and settings to fit your specific trading style.
Feel free to reach out with feedback or suggestions for improvement
Ways to Use the Indicator:
Identifying Trends:
Use the color-coded volume candles to quickly identify bullish (green) and bearish (red) trends. A consistent color trend may indicate market momentum.
Volume Analysis:
Switch between different volume types based on your trading strategy. For example, using the On-Balance Volume can help confirm trends, while Dollar Volume can provide insight into the strength of buying or selling pressure.
Ichimoku Signals:
Monitor the Ichimoku lines for potential buy and sell signals. A crossover of the Tenkan-Sen above the Kijun-Sen may indicate a bullish signal, while a downward crossover could signal a potential bearish move.
Trading Alerts:
Set alerts based on the indicator’s buy/sell signals to notify you of potential trading opportunities without constantly monitoring the chart.
Custom Periods:
Adjust the Ichimoku settings and custom line periods to match your trading style, whether you're a day trader looking for quick entries or a long-term investor analyzing broader trends.
Integrate with Other Tools:
Combine this indicator with other technical analysis tools for a more comprehensive strategy. For instance, use it alongside moving averages or Fibonacci retracement levels to validate entry and exit points.
MA/EMA CrossThe "MA/EMA Cross" script is a trading indicator that identifies and signals potential buying and selling opportunities based on the crossover of two moving averages: the Simple Moving Average (MA) and the Exponential Moving Average (EMA). This script helps traders determine trends and reversals, providing visual alerts on the chart when the MA and EMA cross each other.
Vertical & Open Lines - Yearly [MsF]this indicator draws vertical lines at the start of each year and optionally displays yearly open price levels, helping traders visualize yearly transitions and key price levels.
Features:
• Customizable vertical lines marking the start of each year
• Optional horizontal line showing the yearly open price
• Next year line preview
• Adjustable line styles (dotted, dashed, or solid)
• Customizable colors with 50% transparency for clean chart visibility
Settings:
• Base Time: Set the reference time for yearly calculations
• Show Yearly: Toggle yearly vertical lines
• Open Line: Toggle horizontal yearly open price line
• Show Next Year: Toggle the next year preview line
• Line Styles: Choose between dotted, dashed, or solid lines for both vertical and horizontal lines
Colors are preset with:
• White (50% transparency) for yearly vertical lines
• Red (50% transparency) for yearly open price lines
• Blue (50% transparency) for next year preview line
This indicator is particularly useful for:
• Long-term market analysis
• Identifying yearly cycles and patterns
• Planning ahead for yearly transitions
• Tracking yearly open levels for reference
Note: The indicator uses the chart's timezone settings for calculations.
ShazadamThis indicator is designed to enhance your trading analysis by displaying critical price levels and trend-following metrics for the current trading day. Key features include:
Current Day High and Low: Automatically plots the high and low of the current trading day for easy reference.
Overnight High and Low (4 PM - 9:30 AM): Marks the highest and lowest price levels during the pre-market and post-market sessions, helping traders gauge overnight activity.
Exponential Moving Averages (13, 48, 200): Tracks short-, mid-, and long-term trends to identify potential entry and exit points.
9:35 AM Candle High and Low: Highlights the first 5-minute candle after market open, aiding intraday strategies.
This indicator is ideal for day traders and swing traders seeking a clear and visually appealing display of critical price levels and trend indicators. Use it to identify key support/resistance zones, trends, and breakout opportunities.
Custom Percent Pullback LevelThis script takes a stock's current day low and current day high and lets you set a custom pullback level that you can then set an alert for or use as an indicator if the stock is still bullish or bearish.
This can be useful for momentum runners as you may want to see only a set % (default is 50%) pullback in order to have a good chance for continuation. With the alert option you can set the percentage pullback you'd like to see in order to get eyes back on the stock
Capitalization Calculator | капитализация | Уровни капитализацииRU:
Индикатор написан через чат джипити, поэтому лучше перед тем как полностью доверится, проверьте на 1-2 уровнях самостоятельно.
ВАЖНО: ВПИСЫВАТЬ СУПЛАЙ НУЖНО В РУЧНУЮ НА КАЖДЫЙ ТИКЕР, ЧЕРЕЗ НАСТРОЙКИ.
При выборе в настройках показывает готовую капитализацию.
Если вам нужно больше, внизу есть настройки, которые работают так:
Капитализация / сколько линий будет на графике.
Т.е жмем 10М и ставим 20 линий. Значит у нас будет показаны уровни 10м/20м/30м/.. - и так 20 раз вверх.
Если есть желание и умение, можно попробовать сделать, что бы он автоматически узнавал капитализацию, но к сожалению, я не знаю как это реализовать.
Или хотя бы сделать более красивые уровни и надписи, что бы не было вырвиглазно)
ENG (google):
The indicator is written through jipiti chat, so it is better to check it on 1-2 levels by yourself before trusting it completely.
IMPORTANT: SUPPLY MANUALLY ON EACH TICKER, BY SETTINGS.
When selected in the settings, it shows the finished capitalization.
If you need more, there are settings at the bottom that work like this:
Capitalization / how many lines will be on the chart.
I.e. we press 10M and set 20 lines. So we will see the levels 10m/20m/30m/... - and so 20 times up.
If you have the desire and skill, you can try to make it automatically recognize the capitalization, but unfortunately, I do not know how to implement it.
Or at least make more beautiful levels and inscriptions that would not be vomitous).
Translated with DeepL.com (free version)
S&P 500 E-Mini TrackerThis script generates a reference price for the S&P 500 ETF - SPY based on the current price of the ES contract, which is an E-Mini Futures contract representing the S&P 500 index. The indicator plots this reference price on the chart, providing a unique view of the relationship between these two popular markets.
Advantages:
Identifies divergence between the ES and SPY prices, indicating potential trading opportunities or shifts in market sentiment.
Confirms trends by showing the correlation between the ES and SPY prices.
Eliminates the need for multiple charts, allowing traders to focus on a single screen and make more informed decisions.
Customizable Parameters:
Color Scheme: Choose from various color options to customize the appearance of the indicator.
Line Style: Select from different line styles to change the visual representation of the reference price.
Divisor: Set the dividing factor to adjust the ratio at which the reference price is calculated. (Default value: 10). It is recommended to keep it at 10 for SPY.
To use it with other Stocks/ ETFs, use simple ratio math to calculate the divisor and you can customize the indicator to scale accordingly.
By using this indicator, traders can gain a deeper understanding of the relationship between the E-Mini and SPY markets, making it easier to identify trading opportunities and confirm trends.
XAUUSD Daily Strategy with AlertsTrend Strategy for Trading XAUUSD
A Trend Strategy in trading XAUUSD (gold) focuses on identifying and capitalizing on the market's prevailing directional momentum. Gold is a highly liquid asset and often moves in significant trends due to its sensitivity to global economic conditions, inflation expectations, interest rates, and geopolitical events. A trend-following strategy aims to ride these movements, either upward (bullish trend) or downward (bearish trend), maximizing profit potential while minimizing risks.
Key Components of a Trend Strategy for XAUUSD:
Trend Identification:
Use technical indicators such as moving averages (e.g., EMA, SMA) or trendlines to determine the direction of the trend.
A bullish trend is characterized by higher highs and higher lows, while a bearish trend features lower highs and lower lows.
Example: Employ the 50 EMA and 200 EMA Crossover to confirm trend direction. When the 50 EMA crosses above the 200 EMA, it indicates a bullish trend, and vice versa for a bearish trend.
Entry Points:
Enter trades in the direction of the trend. For a bullish trend, buy on pullbacks to support levels or moving averages. For a bearish trend, sell on pullbacks to resistance levels.
Indicators like the RSI (Relative Strength Index) or Stochastic Oscillator can help identify overbought or oversold conditions, providing better entry points.
Exit Points:
Use predefined take-profit and stop-loss levels to manage trades effectively.
For take-profit, set targets at major resistance levels for long positions or support levels for short positions.
For stop-loss, use levels slightly below the recent swing low in a bullish trend or above the recent swing high in a bearish trend.
Confirmation Indicators:
Incorporate additional indicators like the MACD (Moving Average Convergence Divergence) or ADX (Average Directional Index) to confirm trend strength.
The ADX value above 25 suggests a strong trend, while values below 20 indicate a weak or range-bound market.
Risk Management:
Use proper position sizing, typically risking no more than 1-2% of your account per trade.
Avoid over-leveraging, as XAUUSD is highly volatile, which can lead to large price swings.
Trend Continuation and Reversal Monitoring:
Watch for signs of trend exhaustion or reversal using candlestick patterns (e.g., Doji, Engulfing) or divergence on indicators like RSI or MACD.
When the trend weakens, adjust your positions or exit trades to lock in profits.
Demo GPT - Bull Market Support BandAI generated pinescript 6 strategy of buying and selling based on Bull Market Support Band. Buy when EMAs cross upward while sell when EMAs cross downward.
London Session High/LowPoints to the high and low of london session. Use this to show you the high and low of the session.
Buyers vs SellersBuyers vs Sellers is an indicator which essentially weighs the strength of the buyers against the strength of the sellers. It defines the current relationship between the buyers and the sellers as well as the way that that relationship is changing over time.
User Inputs:
1. Number of Bars To Include In The Calculation - this is the look back period. The amount of past data that is being processed.
2. Length of The ATR - higher values are recommended. This ATR is used as a unit in which the price changes are expressed.
3. Bullish/Bearish Bias Threshold - the minimum value to consider the buyers or the sellers having control of the price.
4. Net Move Average Length - the moving average of the sum of bullish and bearish price changes.
The Calculation Process:
This indicator measures the difference between the opening and the closing prices of each bar in the look back period.
After that it sums together the sizes of the bodies of all the bullish bars and also the sizes of all the bearish bars to create the total bullish price change and total bearish price change for the look back period.
After that it converts the total price changes into percentages of the ATR and divides them by the look back period to get the price change per bar - it is a way of getting the price change values down to less ridiculous numbers regardless of the look back period and while still keeping the proportions intact.
After that it sums the two price changes together to get the net move and performs a simple moving average calculation on it in order to smooth out the values. This is a numerical representation of the relationship between the strength of the bullish and the bearish moves, which is easily readable from the chart.
After that the indicator performs a natural logarithm of the bullish price change divided by the bearish price change. This calculation gives a relationship between the two values which is not tied to the volatility of the instrument, but is expressed purely as a relationship between the strength of one value against the other. The idea is that this would allow for easier comparison across different instruments as the same numbers would represent exactly the same distribution of the strength difference.
The Plotting Logic:
The ATR is plotted as just a number as a reference.
The natural logarithm is presented in two ways.
One way is numerical, to be able to precisely read the value and the colour of the number changes depending if it is positive and above the bias threshold or negative and below the bias threshold.
The other way is in the form of a background colour. It only visualises the bias that can be interpreted based on the logarithm value in relation to the set bias threshold.
The total bullish price change and the total bearish price change are both plotted as a line with the fill between that line and the zero line. This helps visualise the bullish and the bearish moves individually.
The moving average of the sum of the bullish and the bearish moves is added as a line to represent the relationship between the two on a graph and not just as a logarithm.
I hope this indicator will serve you well and help with defining the relationship between the buyers and sellers more objectively, hopefully leading to more profitable trades.
EMA 20 Band + EMA 200Beste traders,
Deze indicator tekent een EMA-band bestaande uit drie lijnen: een High EMA, een Mid EMA, en een Low EMA, evenals een afzonderlijke EMA 200.
De band geeft de dynamische ondersteunings- en weerstandsniveaus weer, gebaseerd op de high-, low- en close-prijzen van candles. De ruimte tussen de High en Low EMA wordt visueel ingevuld, wat helpt om trends en prijsschommelingen beter te identificeren.
De EMA 200 dient als een lange-termijn trendindicator: als de prijs erboven ligt, is er vaak sprake van een opwaartse trend, en eronder van een neerwaartse trend. Traders gebruiken deze indicator om in sterke trends in te stappen, of om mogelijke omkeringen te herkennen wanneer de prijs buiten de band beweegt.
Het kan ook nuttig zijn om overbought- of oversold-condities te spotten als de prijs ver buiten de band komt.
Deze indicator is geschikt voor zowel daytrading als swing trading en werkt op alle tijdframes.
Range PolarityDescription:
This indicator is a "Rate of Change" style oscillator designed to measure market dynamics through the lens of price ranges. By utilizing the true range in conjunction with high and low separation, this script produces two distinct oscillators: one for positive price shifts and one for negative price shifts.
Key Features:
High/Low Isolation:
The script calculates the relative movement of upwards and downwards price movements over a user-defined period. This separation provides a nuanced view of market behavior, offering two separate signals for comparison.
Dynamic Transform Smoothing:
A smoothing transform is applied to the signals, ensuring better outlier handling while maintaining sensitivity to price extremes. This makes the oscillator especially suited for identifying overbought and oversold conditions.
Zero-Centered:
The zero line acts as a "gravity point," where shifts away or toward zero indicate market momentum. Signal crosses or reversals from extreme zones can signal potential entry or exit points.
Outlier Identification:
Unlike traditional ATR based strategies (e.g., Keltner Channels ), this indicator isolates high and low ranges, creating a more granular view of market extremes. These measurements can help identify shifts from the outlying positions and reversal opportunities.
Visual Enhancements:
Multiple layers enhance the visual distinction of the positive and negative transformations. Horizontal lines at key thresholds provide visual reference for overbought, oversold, and equilibrium zones.
How to Use:
Primary signals are shifts from outlying positions or a positive/negative cross. An extreme reading itself can reveal an incoming reversal when calibrated with other indicators or compared with higher timeframes. Pairing "Range Polarity" with volume and momentum can create a comprehensive strategy.
In conclusion, be aware the base length controls the window for high/low contributions while the transform smoothing enhances the raw data through normalization within a tempered range to filter out insignificant fluctuations.
Merry Christmas to all and have a Happy New Year!
Volatility ProfileVolatility Profile allows for a fast comparison of the Average True Range from different time frames.
In addition to that, for each time frame it calculates the maximum and the minimum value over a set number of bars and divides the range between the maximum and the minimum in three parts to create three different volatility classes, which allows the user to quickly see how big the current value really is in relation to the past.
The settings allow the user to set the two extra time frames apart from the main time frame and the ATR length for each of the three ATR's, as well as the look back period to calculate the maximum and the minimum values.
This indicator is meant to help create a much more comprehensive view of the instrument's volatility.
My script//@version=5
indicator(title='Trade Bulls v1.2', shorttitle='Trade Bulls v1.2', overlay=true, max_boxes_count=20)
// Block Order
BO_on =input(defval=true, title='Enable Block Order', group='Block Order')
Senset = input.int(28, minval=1, title='Sensitivity', group='Block Order')
OB_mtype = input.string("Close", title="OB Mitigation Type", options= , group="Block Order")
colUpp = input.color(#50b090, title="Bullish OB Border", inline="1", group="Block Order")
colUpp_ob = input.color(color.new(#60C0A0, 85), title="BackGround", inline="1", group="Block Order")
colDnn = input.color(#4060b0, title="Bearish OB Border", inline="2", group="Block Order")
colDnn_ob = input.color(color.new(#5060D0, 85), title="BackGround", inline="2", group="Block Order")
bool BO_is = false
bool BO_is_Upp = false
boUpp = OB_mtype=="Close" ? close : low
boDnn = OB_mtype=="Close" ? close : high
var box Lbox = na
var box Sbox = na
var L_boxes = array.new_box()
var S_boxes = array.new_box()
var int jj = na
CrDt = (open - open ) / open * 100
Senset /= 100
if ta.crossover(CrDt, Senset)
BO_is_Upp := true
jj := bar_index
jj
if ta.crossunder(CrDt, -Senset)
BO_is := true
jj := bar_index
jj
if BO_is and jj - jj > 5 and BO_on
float Lgrn = 0
for i = 4 to 15 by 1
if close > open
Lgrn := i
break
Sbox := box.new(left=bar_index , top=high , bottom=low , right=bar_index , bgcolor=colDnn_ob, border_color=colDnn, extend=extend.right)
array.push(S_boxes, Sbox)
if BO_is_Upp and jj - jj > 5 and BO_on
float Lred = 0
for i = 4 to 15 by 1
if close < open
Lred := i
break
Lbox := box.new(left=bar_index , top=high , bottom=low , right=bar_index , bgcolor=colUpp_ob, border_color=colUpp, extend=extend.right)
array.push(L_boxes, Lbox)
if array.size(S_boxes) > 0
for i = array.size(S_boxes) - 1 to 0 by 1
sbox = array.get(S_boxes, i)
B_top = box.get_top(sbox)
B_bot = box.get_bottom(sbox)
if boDnn > B_top
array.remove(S_boxes, i)
box.delete(sbox)
if high > B_bot
alert('Price inside Bearish Block Order', alert.freq_once_per_bar)
if array.size(L_boxes) > 0
for i = array.size(L_boxes) - 1 to 0 by 1
sbox = array.get(L_boxes, i)
B_bot = box.get_bottom(sbox)
B_top = box.get_top(sbox)
if boUpp < B_bot
array.remove(L_boxes, i)
box.delete(sbox)
if low < B_top
alert('Price inside Bullish Block Order', alert.freq_once_per_bar)
// Sell/Buy/
BS_on =input(defval=true, title='Enable Buy/Sell', group='Buy/Sell')
LB_on =input(defval=true, title='Enable labels', group='Buy/Sell')
BS_type = input.string('Atr',options= ,inline='ln1', group='Buy/Sell')
BS_size = input(1.,'',inline='ln1', group='Buy/Sell')
BS_max = input(3,'Sequence Length', group='Buy/Sell')
var BS_fib = array.from(1,1)
var BS_dist = 0.
var BS_avg = 0.
var BS_fib_n = 1
var BS_os = 0
BS_src = close
BS_n = bar_index
if barstate.isfirst
for i = 1 to BS_max
array.push(BS_fib,array.get(BS_fib,i-1) + array.get(BS_fib,i))
if BS_type == 'Atr'
BS_dist := ta.atr(200)*BS_size*array.get(BS_fib,BS_fib_n)
else
BS_dist := BS_size*array.get(BS_fib,BS_fib_n)
BS_fib_n := math.abs(BS_src-BS_avg) > BS_dist ? BS_fib_n+1 : BS_fib_n
BS_avg := nz(BS_fib_n > BS_max+1 ? BS_src : BS_avg ,BS_src)
BS_fib_n := BS_fib_n > BS_max+1 ? 1 : BS_fib_n
BS_sell = BS_avg < BS_avg
BS_buy = BS_avg > BS_avg
BS_os := BS_buy ? 1 : BS_sell ? 0 : BS_os
BS_css = BS_os == 1 ? #00b010 : #fe1100
BS_stop = BS_avg != BS_avg ? na : BS_os == 0 ? BS_avg + BS_dist : BS_avg - BS_dist
BS_take = BS_avg != BS_avg ? na : BS_os == 1 ? BS_avg + BS_dist : BS_avg - BS_dist
p_0 = plot( BS_on? BS_src:na,color=na)
p_1 = plot( BS_on? BS_avg:na,color=na)
plot(BS_on ? BS_take:na,'Take',#00b010,1,plot.style_linebr)
plot(BS_on ? BS_stop:na,'Stop',#f01000,1,plot.style_linebr)
fill(p_0,p_1,color.new(BS_css,85))
plotshape(BS_on and BS_buy ? low : na,"Buy_Label",shape.labelup,location.absolute,#00b010,0,text="B",textcolor=color.white,size=size.tiny)
plotshape(BS_on and BS_sell ? high : na,"Sell_Label",shape.labeldown,location.absolute,#f01000,0,text="S",textcolor=color.white,size=size.tiny)
if BS_fib_n > BS_fib_n and BS_os == 1 and BS_src > BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ✅',yloc=yloc.abovebar,color=na,style=label.style_label_down,textcolor=color.gray,size=size.small)
else if BS_fib_n > BS_fib_n and BS_os == 1 and BS_src < BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ❌',yloc=yloc.belowbar,color=na,style=label.style_label_up,textcolor=color.gray,size=size.small)
if BS_fib_n > BS_fib_n and BS_os == 0 and BS_src < BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ✅',yloc=yloc.belowbar,color=na,style=label.style_label_up,textcolor=color.gray,size=size.small)
else if BS_fib_n > BS_fib_n and BS_os == 0 and BS_src > BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ❌',yloc=yloc.abovebar,color=na,style=label.style_label_down,textcolor=color.gray,size=size.small)
//Channel
CH_on =input(defval=true, title='Enable Channel', group='Channel')
CH_src = input(defval=close, title='Source', group='Channel')
CH_len = input.int(defval=100, title='Length', minval=10, group='Channel')
CH_divlen = input.float(defval=2., title='Deviation', minval=0.1, step=0.1, group='Channel')
CH_ext = input(defval=true, title='Extend Lines', group='Channel')
CH_shwfib = input(defval=false, title='Show Fibonacci Levels', group='Channel')
CH_shwbrk = input.bool(defval=true, title='Show Broken Channel', inline='brk', group='Channel')
CH_brkclr = input.color(defval=color.blue, title='', inline='brk', group='Channel')
CH_upclr = input.color(defval=color.lime, title='Up/Down Trend Colors', inline='trcols', group='Channel')
CH_dnclr = input.color(defval=color.red, title='', inline='trcols', group='Channel')
CH_lnwdt = input(defval=2, title='Line Width', group='Channel')
var CH_fiboln = array.new_float(0)
var CH_clrs = array.new_color(2)
if barstate.isfirst
array.push(CH_fiboln, 0.236)
array.push(CH_fiboln, 0.382)
array.push(CH_fiboln, 0.618)
array.push(CH_fiboln, 0.786)
array.unshift(CH_clrs, CH_upclr)
array.unshift(CH_clrs, CH_dnclr)
get_Channel(CH_src, CH_len) =>
md = math.sum(CH_src, CH_len) / CH_len
Ugl = ta.linreg(CH_src, CH_len, 0) - ta.linreg(CH_src, CH_len, 1)
ip = md - Ugl * math.floor(CH_len / 2) + (1 - CH_len % 2) / 2 * Ugl
lst = ip + Ugl * (CH_len - 1)
dev = 0.0
for x = 0 to CH_len - 1 by 1
dev += math.pow(CH_src - (Ugl * (CH_len - x) + ip), 2)
dev
dev := math.sqrt(dev / CH_len)
= get_Channel(CH_src, CH_len)
CH_break = Ugl > 0 and close < y2_ - dev * CH_divlen ? 0 : Ugl < 0 and close > y2_ + dev * CH_divlen ? 2 : -1
var CH_rlns = array.new_line(3)
var CH_fiblns = array.new_line(4)
if CH_on
for x = 0 to 2 by 1
if not CH_shwbrk or CH_break != x or nz(CH_break , -1) != -1
line.delete(array.get(CH_rlns, x))
else
line.set_color(array.get(CH_rlns, x), color=CH_brkclr)
line.set_width(array.get(CH_rlns, x), width=2)
line.set_style(array.get(CH_rlns, x), style=line.style_dotted)
line.set_extend(array.get(CH_rlns, x), extend=extend.none)
array.set(CH_rlns, x, line.new(x1=bar_index - (CH_len - 1), y1=y1_ + dev * CH_divlen * (x - 1), x2=bar_index, y2=y2_ + dev * CH_divlen * (x - 1), color=array.get(CH_clrs, math.round(math.max(math.sign(Ugl), 0))), style=x % 2 == 1 ? line.style_solid : line.style_dashed, width=CH_lnwdt, extend=CH_ext ? extend.right : extend.none))
if CH_shwfib
for x = 0 to 3 by 1
line.delete(array.get(CH_fiblns, x))
array.set(CH_fiblns, x, line.new(x1=bar_index - (CH_len - 1), y1=y1_ - dev * CH_divlen + dev * CH_divlen * 2 * array.get(CH_fiboln, x), x2=bar_index, y2=y2_ - dev * CH_divlen + dev * CH_divlen * 2 * array.get(CH_fiboln, x), color=array.get(CH_clrs, math.round(math.max(math.sign(Ugl), 0))), style=line.style_dotted, width=CH_lnwdt, extend=CH_ext ? extend.right : extend.none))
var label lbl1 = label.new(x=bar_index - (CH_len - 1), y=y1_, text='S', size=size.large)
lb_text = Ugl > 0 ? Ugl > Ugl ? '⇑' : '⇗' : Ugl < 0 ? Ugl < Ugl ? '⇓' : '⇘' : '⇒'
lb_style = Ugl > 0 ? Ugl > Ugl ? label.style_label_up : label.style_label_upper_right : Ugl < 0 ? Ugl < Ugl ? label.style_label_down : label.style_label_lower_right : label.style_label_right
if CH_on
label.set_style(lbl1, lb_style)
label.set_text(lbl1, lb_text)
label.set_x(lbl1, bar_index - (CH_len - 1))
label.set_y(lbl1, Ugl > 0 ? y1_ - dev * CH_divlen : Ugl < 0 ? y1_ + dev * CH_divlen : y1_)
label.set_color(lbl1, Ugl > 0 ? CH_upclr : Ugl < 0 ? CH_dnclr : color.blue)
DnTrend = math.sign(Ugl) != math.sign(Ugl ) and Ugl < 0
UpTrend = math.sign(Ugl) != math.sign(Ugl ) and Ugl > 0
alertcondition(CH_break, title='Channel Broken', message='Channel Broken')
alertcondition(DnTrend, title='Channel Down trend', message='Channel Down trend')
alertcondition(UpTrend, title='Channel Up trend', message='Channel Up trend')
// Support/Resistance
SR_on =input(defval=true, title='Enable Support/Resistance', group='Support/Resistance')
SR_lb = input(15, title='Left Bars ', group='Support/Resistance')
SR_rb = input(15, title='Right Bars', group='Support/Resistance')
SR_vol = input(20, title='Volume Threshold', group='Support/Resistance')
SR_high = fixnan(ta.pivothigh(SR_lb, SR_rb) )
SR_low = fixnan(ta.pivotlow(SR_lb, SR_rb) )
plot(SR_on?SR_low:na, color=ta.change(SR_low) ? na : #2030e0, linewidth=3, offset=-(SR_rb + 1), title='Support')
plot(SR_on?SR_high:na, color=ta.change(SR_high) ? na : #F00000, linewidth=3, offset=-(SR_rb + 1), title='Resistance')
SR_short = ta.ema(volume, 5)
SR_long = ta.ema(volume, 10)
SR_dlt = 100 * (SR_short - SR_long) / SR_long
alertcondition(ta.crossover(close, SR_high) and SR_dlt > SR_vol, title='Resistance Broken', message='Resistance Broken')
alertcondition(ta.crossunder(close, SR_low) and SR_dlt > SR_vol, title='Support Broken', message='Support Broken')
Trade Bulls//@version=5
indicator(title='Trade Bulls v1.2', shorttitle='Trade Bulls v1.2', overlay=true, max_boxes_count=20)
// Block Order
BO_on =input(defval=true, title='Enable Block Order', group='Block Order')
Senset = input.int(28, minval=1, title='Sensitivity', group='Block Order')
OB_mtype = input.string("Close", title="OB Mitigation Type", options= , group="Block Order")
colUpp = input.color(#50b090, title="Bullish OB Border", inline="1", group="Block Order")
colUpp_ob = input.color(color.new(#60C0A0, 85), title="BackGround", inline="1", group="Block Order")
colDnn = input.color(#4060b0, title="Bearish OB Border", inline="2", group="Block Order")
colDnn_ob = input.color(color.new(#5060D0, 85), title="BackGround", inline="2", group="Block Order")
bool BO_is = false
bool BO_is_Upp = false
boUpp = OB_mtype=="Close" ? close : low
boDnn = OB_mtype=="Close" ? close : high
var box Lbox = na
var box Sbox = na
var L_boxes = array.new_box()
var S_boxes = array.new_box()
var int jj = na
CrDt = (open - open ) / open * 100
Senset /= 100
if ta.crossover(CrDt, Senset)
BO_is_Upp := true
jj := bar_index
jj
if ta.crossunder(CrDt, -Senset)
BO_is := true
jj := bar_index
jj
if BO_is and jj - jj > 5 and BO_on
float Lgrn = 0
for i = 4 to 15 by 1
if close > open
Lgrn := i
break
Sbox := box.new(left=bar_index , top=high , bottom=low , right=bar_index , bgcolor=colDnn_ob, border_color=colDnn, extend=extend.right)
array.push(S_boxes, Sbox)
if BO_is_Upp and jj - jj > 5 and BO_on
float Lred = 0
for i = 4 to 15 by 1
if close < open
Lred := i
break
Lbox := box.new(left=bar_index , top=high , bottom=low , right=bar_index , bgcolor=colUpp_ob, border_color=colUpp, extend=extend.right)
array.push(L_boxes, Lbox)
if array.size(S_boxes) > 0
for i = array.size(S_boxes) - 1 to 0 by 1
sbox = array.get(S_boxes, i)
B_top = box.get_top(sbox)
B_bot = box.get_bottom(sbox)
if boDnn > B_top
array.remove(S_boxes, i)
box.delete(sbox)
if high > B_bot
alert('Price inside Bearish Block Order', alert.freq_once_per_bar)
if array.size(L_boxes) > 0
for i = array.size(L_boxes) - 1 to 0 by 1
sbox = array.get(L_boxes, i)
B_bot = box.get_bottom(sbox)
B_top = box.get_top(sbox)
if boUpp < B_bot
array.remove(L_boxes, i)
box.delete(sbox)
if low < B_top
alert('Price inside Bullish Block Order', alert.freq_once_per_bar)
// Sell/Buy/
BS_on =input(defval=true, title='Enable Buy/Sell', group='Buy/Sell')
LB_on =input(defval=true, title='Enable labels', group='Buy/Sell')
BS_type = input.string('Atr',options= ,inline='ln1', group='Buy/Sell')
BS_size = input(1.,'',inline='ln1', group='Buy/Sell')
BS_max = input(3,'Sequence Length', group='Buy/Sell')
var BS_fib = array.from(1,1)
var BS_dist = 0.
var BS_avg = 0.
var BS_fib_n = 1
var BS_os = 0
BS_src = close
BS_n = bar_index
if barstate.isfirst
for i = 1 to BS_max
array.push(BS_fib,array.get(BS_fib,i-1) + array.get(BS_fib,i))
if BS_type == 'Atr'
BS_dist := ta.atr(200)*BS_size*array.get(BS_fib,BS_fib_n)
else
BS_dist := BS_size*array.get(BS_fib,BS_fib_n)
BS_fib_n := math.abs(BS_src-BS_avg) > BS_dist ? BS_fib_n+1 : BS_fib_n
BS_avg := nz(BS_fib_n > BS_max+1 ? BS_src : BS_avg ,BS_src)
BS_fib_n := BS_fib_n > BS_max+1 ? 1 : BS_fib_n
BS_sell = BS_avg < BS_avg
BS_buy = BS_avg > BS_avg
BS_os := BS_buy ? 1 : BS_sell ? 0 : BS_os
BS_css = BS_os == 1 ? #00b010 : #fe1100
BS_stop = BS_avg != BS_avg ? na : BS_os == 0 ? BS_avg + BS_dist : BS_avg - BS_dist
BS_take = BS_avg != BS_avg ? na : BS_os == 1 ? BS_avg + BS_dist : BS_avg - BS_dist
p_0 = plot( BS_on? BS_src:na,color=na)
p_1 = plot( BS_on? BS_avg:na,color=na)
plot(BS_on ? BS_take:na,'Take',#00b010,1,plot.style_linebr)
plot(BS_on ? BS_stop:na,'Stop',#f01000,1,plot.style_linebr)
fill(p_0,p_1,color.new(BS_css,85))
plotshape(BS_on and BS_buy ? low : na,"Buy_Label",shape.labelup,location.absolute,#00b010,0,text="B",textcolor=color.white,size=size.tiny)
plotshape(BS_on and BS_sell ? high : na,"Sell_Label",shape.labeldown,location.absolute,#f01000,0,text="S",textcolor=color.white,size=size.tiny)
if BS_fib_n > BS_fib_n and BS_os == 1 and BS_src > BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ✅',yloc=yloc.abovebar,color=na,style=label.style_label_down,textcolor=color.gray,size=size.small)
else if BS_fib_n > BS_fib_n and BS_os == 1 and BS_src < BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ❌',yloc=yloc.belowbar,color=na,style=label.style_label_up,textcolor=color.gray,size=size.small)
if BS_fib_n > BS_fib_n and BS_os == 0 and BS_src < BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ✅',yloc=yloc.belowbar,color=na,style=label.style_label_up,textcolor=color.gray,size=size.small)
else if BS_fib_n > BS_fib_n and BS_os == 0 and BS_src > BS_avg and BS_on and LB_on
label.new(BS_n,BS_src,str.tostring(array.get(BS_fib,BS_fib_n-1)) + ' ❌',yloc=yloc.abovebar,color=na,style=label.style_label_down,textcolor=color.gray,size=size.small)
//Channel
CH_on =input(defval=true, title='Enable Channel', group='Channel')
CH_src = input(defval=close, title='Source', group='Channel')
CH_len = input.int(defval=100, title='Length', minval=10, group='Channel')
CH_divlen = input.float(defval=2., title='Deviation', minval=0.1, step=0.1, group='Channel')
CH_ext = input(defval=true, title='Extend Lines', group='Channel')
CH_shwfib = input(defval=false, title='Show Fibonacci Levels', group='Channel')
CH_shwbrk = input.bool(defval=true, title='Show Broken Channel', inline='brk', group='Channel')
CH_brkclr = input.color(defval=color.blue, title='', inline='brk', group='Channel')
CH_upclr = input.color(defval=color.lime, title='Up/Down Trend Colors', inline='trcols', group='Channel')
CH_dnclr = input.color(defval=color.red, title='', inline='trcols', group='Channel')
CH_lnwdt = input(defval=2, title='Line Width', group='Channel')
var CH_fiboln = array.new_float(0)
var CH_clrs = array.new_color(2)
if barstate.isfirst
array.push(CH_fiboln, 0.236)
array.push(CH_fiboln, 0.382)
array.push(CH_fiboln, 0.618)
array.push(CH_fiboln, 0.786)
array.unshift(CH_clrs, CH_upclr)
array.unshift(CH_clrs, CH_dnclr)
get_Channel(CH_src, CH_len) =>
md = math.sum(CH_src, CH_len) / CH_len
Ugl = ta.linreg(CH_src, CH_len, 0) - ta.linreg(CH_src, CH_len, 1)
ip = md - Ugl * math.floor(CH_len / 2) + (1 - CH_len % 2) / 2 * Ugl
lst = ip + Ugl * (CH_len - 1)
dev = 0.0
for x = 0 to CH_len - 1 by 1
dev += math.pow(CH_src - (Ugl * (CH_len - x) + ip), 2)
dev
dev := math.sqrt(dev / CH_len)
= get_Channel(CH_src, CH_len)
CH_break = Ugl > 0 and close < y2_ - dev * CH_divlen ? 0 : Ugl < 0 and close > y2_ + dev * CH_divlen ? 2 : -1
var CH_rlns = array.new_line(3)
var CH_fiblns = array.new_line(4)
if CH_on
for x = 0 to 2 by 1
if not CH_shwbrk or CH_break != x or nz(CH_break , -1) != -1
line.delete(array.get(CH_rlns, x))
else
line.set_color(array.get(CH_rlns, x), color=CH_brkclr)
line.set_width(array.get(CH_rlns, x), width=2)
line.set_style(array.get(CH_rlns, x), style=line.style_dotted)
line.set_extend(array.get(CH_rlns, x), extend=extend.none)
array.set(CH_rlns, x, line.new(x1=bar_index - (CH_len - 1), y1=y1_ + dev * CH_divlen * (x - 1), x2=bar_index, y2=y2_ + dev * CH_divlen * (x - 1), color=array.get(CH_clrs, math.round(math.max(math.sign(Ugl), 0))), style=x % 2 == 1 ? line.style_solid : line.style_dashed, width=CH_lnwdt, extend=CH_ext ? extend.right : extend.none))
if CH_shwfib
for x = 0 to 3 by 1
line.delete(array.get(CH_fiblns, x))
array.set(CH_fiblns, x, line.new(x1=bar_index - (CH_len - 1), y1=y1_ - dev * CH_divlen + dev * CH_divlen * 2 * array.get(CH_fiboln, x), x2=bar_index, y2=y2_ - dev * CH_divlen + dev * CH_divlen * 2 * array.get(CH_fiboln, x), color=array.get(CH_clrs, math.round(math.max(math.sign(Ugl), 0))), style=line.style_dotted, width=CH_lnwdt, extend=CH_ext ? extend.right : extend.none))
var label lbl1 = label.new(x=bar_index - (CH_len - 1), y=y1_, text='S', size=size.large)
lb_text = Ugl > 0 ? Ugl > Ugl ? '⇑' : '⇗' : Ugl < 0 ? Ugl < Ugl ? '⇓' : '⇘' : '⇒'
lb_style = Ugl > 0 ? Ugl > Ugl ? label.style_label_up : label.style_label_upper_right : Ugl < 0 ? Ugl < Ugl ? label.style_label_down : label.style_label_lower_right : label.style_label_right
if CH_on
label.set_style(lbl1, lb_style)
label.set_text(lbl1, lb_text)
label.set_x(lbl1, bar_index - (CH_len - 1))
label.set_y(lbl1, Ugl > 0 ? y1_ - dev * CH_divlen : Ugl < 0 ? y1_ + dev * CH_divlen : y1_)
label.set_color(lbl1, Ugl > 0 ? CH_upclr : Ugl < 0 ? CH_dnclr : color.blue)
DnTrend = math.sign(Ugl) != math.sign(Ugl ) and Ugl < 0
UpTrend = math.sign(Ugl) != math.sign(Ugl ) and Ugl > 0
alertcondition(CH_break, title='Channel Broken', message='Channel Broken')
alertcondition(DnTrend, title='Channel Down trend', message='Channel Down trend')
alertcondition(UpTrend, title='Channel Up trend', message='Channel Up trend')
// Support/Resistance
SR_on =input(defval=true, title='Enable Support/Resistance', group='Support/Resistance')
SR_lb = input(15, title='Left Bars ', group='Support/Resistance')
SR_rb = input(15, title='Right Bars', group='Support/Resistance')
SR_vol = input(20, title='Volume Threshold', group='Support/Resistance')
SR_high = fixnan(ta.pivothigh(SR_lb, SR_rb) )
SR_low = fixnan(ta.pivotlow(SR_lb, SR_rb) )
plot(SR_on?SR_low:na, color=ta.change(SR_low) ? na : #2030e0, linewidth=3, offset=-(SR_rb + 1), title='Support')
plot(SR_on?SR_high:na, color=ta.change(SR_high) ? na : #F00000, linewidth=3, offset=-(SR_rb + 1), title='Resistance')
SR_short = ta.ema(volume, 5)
SR_long = ta.ema(volume, 10)
SR_dlt = 100 * (SR_short - SR_long) / SR_long
alertcondition(ta.crossover(close, SR_high) and SR_dlt > SR_vol, title='Resistance Broken', message='Resistance Broken')
alertcondition(ta.crossunder(close, SR_low) and SR_dlt > SR_vol, title='Support Broken', message='Support Broken')