Confluence ChecklistHOW DOES IT WORK?
The "Confluence Checklist" indicator helps you to stick to your trading plan with your set rules. You have a total of 8 rules that can be set up manually. Using the checkbox, you can check during trading whether your rules are followed or not. You can change the colors of the table on the one hand, and the size and width of the table columns on the other.
█ WHAT MAKES IT UNIQUE?
It is the only checklist indicator on Tradingview that has an integrated checkbox. Thus, you can always check your trading plan.
█ HOW TO USE IT?
The best way to start is to create your personal trading plan based on your trading strategy. Then you can display the trading plan digitally in Tradingview. This way you don't have to write and check your rules on paper anymore. This is very important for scalping, because sometimes you only have a few seconds left for the execution. After creating the trading plan, you can integrate it into the checklist. Before placing an order, you can check the checklist to see if the trade is really valid.
Indicadores y estrategias
IU Price Density(Market Noise)This Price density Indicator will help you understand what and how market noise is calculated and treated.
Market noise = when the market is moving up and down without any clear direction
The Price Density Indicator is a technical analysis tool used to measure the concentration or "density" of price movements within a specific range. It helps traders differentiate between noisy, choppy markets and trending ones.
I’ve developed a custom Pine Script indicator, "IU Price Density," designed to help traders distinguish between noisy, indecisive markets and clear trading opportunities. It can be applied across multiple markets.
How this work:
Formula = (Σ (High𝑖 - Low𝑖)) / (Max(High) - Min(Low))
Where,
High𝑖 = the high price at the 𝑖 data point.
Low𝑖 = the low price at the 𝑖 data point.
Max(High) = highest price over the data set.
Max(Low) = Lowest price over the data set.
How to use it :
This indicator ranges from 0 to 10
Green(0-3) = Trending Market
Orange(3-6) = Market is normal
Red(6-10) = Noise market
💡 Key Features:
Dynamic Visuals: The indicator uses color-coded signals—green for trending markets and red for noisy, volatile conditions—making it easy to identify optimal trading periods at a glance.
Background Shading: With background colors highlighting significant market conditions, traders can quickly assess when to engage or avoid certain trades.
Customizable Parameters: The length and smoothing factors allow for flexibility in adapting the indicator to various assets and timeframes.
Whether you're a swing trader or an intraday strategist, this tool provides valuable insights to improve your market analysis. I’m excited to bring this indicator to the community!
Pairs trading[Maxxxz7]Pairs Trading
This script is designed to analyze and visualize the divergence or convergence of two selected financial instruments, making it an excellent tool for implementing a pairs trading strategy. Developed for the TradingView platform, it offers extensive customization options for analysis.
Key Features:
Asset Selection:
The first asset can be taken directly from the chart or specified manually.
The second asset is always selected manually.
Data Normalization:
Calculates the percentage change of both assets relative to their initial prices.
Includes an offset for better visual interpretation.
Visualization:
Plots normalized price charts for both assets.
Highlights crossovers between the assets.
Displays the spread (difference between normalized prices) graphically.
Alerts (Works only on the 30-minute timeframe):
Configurable thresholds to trigger alerts (e.g., when the difference is smaller or larger than a set value).
Alerts for crossovers of prices and exponential moving averages (EMA).
Dynamic Labels:
Automatically adds labels to mark key events: crossovers, critical spread values, and current price information.
EMA and Deviation Analysis:
Calculates EMA for each asset.
Alerts for EMA crossovers.
PitchforkLibrary "Pitchfork"
Pitchfork class
method tostring(this)
Converts PitchforkTypes/Fork object to string representation
Namespace types: Fork
Parameters:
this (Fork) : PitchforkTypes/Fork object
Returns: string representation of PitchforkTypes/Fork
method tostring(this)
Converts Array of PitchforkTypes/Fork object to string representation
Namespace types: array
Parameters:
this (array) : Array of PitchforkTypes/Fork object
Returns: string representation of PitchforkTypes/Fork array
method tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/PitchforkProperties object to string representation
Namespace types: PitchforkProperties
Parameters:
this (PitchforkProperties) : PitchforkTypes/PitchforkProperties object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/PitchforkProperties
method tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/PitchforkDrawingProperties object to string representation
Namespace types: PitchforkDrawingProperties
Parameters:
this (PitchforkDrawingProperties) : PitchforkTypes/PitchforkDrawingProperties object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/PitchforkDrawingProperties
method tostring(this, sortKeys, sortOrder)
Converts PitchforkTypes/Pitchfork object to string representation
Namespace types: Pitchfork
Parameters:
this (Pitchfork) : PitchforkTypes/Pitchfork object
sortKeys (bool) : If set to true, string output is sorted by keys.
sortOrder (int) : Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
Returns: string representation of PitchforkTypes/Pitchfork
method createDrawing(this)
Creates PitchforkTypes/PitchforkDrawing from PitchforkTypes/Pitchfork object
Namespace types: Pitchfork
Parameters:
this (Pitchfork) : PitchforkTypes/Pitchfork object
Returns: PitchforkTypes/PitchforkDrawing object created
method createDrawing(this)
Creates PitchforkTypes/PitchforkDrawing array from PitchforkTypes/Pitchfork array of objects
Namespace types: array
Parameters:
this (array) : array of PitchforkTypes/Pitchfork object
Returns: array of PitchforkTypes/PitchforkDrawing object created
method draw(this)
draws from PitchforkTypes/PitchforkDrawing object
Namespace types: PitchforkDrawing
Parameters:
this (PitchforkDrawing) : PitchforkTypes/PitchforkDrawing object
Returns: PitchforkTypes/PitchforkDrawing object drawn
method delete(this)
deletes PitchforkTypes/PitchforkDrawing object
Namespace types: PitchforkDrawing
Parameters:
this (PitchforkDrawing) : PitchforkTypes/PitchforkDrawing object
Returns: PitchforkTypes/PitchforkDrawing object deleted
method delete(this)
deletes underlying drawing of PitchforkTypes/Pitchfork object
Namespace types: Pitchfork
Parameters:
this (Pitchfork) : PitchforkTypes/Pitchfork object
Returns: PitchforkTypes/Pitchfork object deleted
method delete(this)
deletes array of PitchforkTypes/PitchforkDrawing objects
Namespace types: array
Parameters:
this (array) : Array of PitchforkTypes/PitchforkDrawing object
Returns: Array of PitchforkTypes/PitchforkDrawing object deleted
method delete(this)
deletes underlying drawing in array of PitchforkTypes/Pitchfork objects
Namespace types: array
Parameters:
this (array) : Array of PitchforkTypes/Pitchfork object
Returns: Array of PitchforkTypes/Pitchfork object deleted
method clear(this)
deletes array of PitchforkTypes/PitchforkDrawing objects and clears the array
Namespace types: array
Parameters:
this (array) : Array of PitchforkTypes/PitchforkDrawing object
Returns: void
method clear(this)
deletes array of PitchforkTypes/Pitchfork objects and clears the array
Namespace types: array
Parameters:
this (array) : Array of Pitchfork/Pitchfork object
Returns: void
PitchforkDrawingProperties
Pitchfork Drawing Properties object
Fields:
extend (series bool) : If set to true, forks are extended towards right. Default is true
fill (series bool) : Fill forklines with transparent color. Default is true
fillTransparency (series int) : Transparency at which fills are made. Only considered when fill is set. Default is 80
forceCommonColor (series bool) : Force use of common color for forks and fills. Default is false
commonColor (series color) : common fill color. Used only if ratio specific fill colors are not available or if forceCommonColor is set to true.
PitchforkDrawing
Pitchfork drawing components
Fields:
medianLine (Line type from Trendoscope/Drawing/2) : Median line of the pitchfork
baseLine (Line type from Trendoscope/Drawing/2) : Base line of the pitchfork
forkLines (array type from Trendoscope/Drawing/2) : fork lines of the pitchfork
linefills (array type from Trendoscope/Drawing/2) : Linefills between forks
Fork
Fork object property
Fields:
ratio (series float) : Fork ratio
forkColor (series color) : color of fork. Default is blue
include (series bool) : flag to include the fork in drawing. Default is true
PitchforkProperties
Pitchfork Properties
Fields:
forks (array) : Array of Fork objects
type (series string) : Pitchfork type. Supported values are "regular", "schiff", "mschiff", Default is regular
inside (series bool) : Flag to identify if to draw inside fork. If set to true, inside fork will be drawn
Pitchfork
Pitchfork object
Fields:
a (chart.point) : Pivot Point A of pitchfork
b (chart.point) : Pivot Point B of pitchfork
c (chart.point) : Pivot Point C of pitchfork
properties (PitchforkProperties) : PitchforkProperties object which determines type and composition of pitchfork
dProperties (PitchforkDrawingProperties) : Drawing properties for pitchfork
lProperties (LineProperties type from Trendoscope/Drawing/2) : Common line properties for Pitchfork lines
drawing (PitchforkDrawing) : PitchforkDrawing object
CandelaCharts - Opening Gap (OG) 📝 Overview
The ICT (Inner Circle Trader) Opening Gap represents the price difference between the previous trading session's closing price and the current session's opening price. This gap serves as a key indicator of market sentiment and can offer valuable clues about the market's potential direction throughout the trading day.
A bullish Opening Gap forms when the market opens higher than the previous session's close, signaling strong buying interest or positive sentiment heading into the new session
A bearish Opening Gap occurs when the market opens lower than the previous session's close, reflecting heightened selling pressure or negative sentiment among market participants
The Opening Gap is significant as it often establishes the market's tone for the trading session. Accurately interpreting this gap enables traders to make informed decisions about when to enter or exit positions. Serving as a gauge of market strength or weakness, the gap provides a clear signal of whether the market is likely to trend upward or downward during the day.
📦 Features
MTF
Mitigation
Consequent Encroachment
Threshold
Hide Overlap
Advanced Styling
⚙️ Settings
Show: Controls whether FVGs are displayed on the chart.
Show Last: Sets the number of FVGs you want to display.
Length: Determines the length of each FVG.
Mitigation: Highlights when an FVG has been touched, using a different color without marking it as invalid.
Timeframe: Specifies the timeframe used to detect FVGs.
Threshold: Sets the minimum gap size required for FVG detection on the chart.
Show Mid-Line: Configures the midpoint line's width and style within the FVG. (Consequent Encroachment - CE)
Show Border: Defines the border width and line style of the FVG.
Hide Overlap: Removes overlapping FVGs from view.
Extend: Extends the FVG length to the current candle.
Elongate: Fully extends the FVG length to the right side of the chart.
⚡️ Showcase
Simple
Mitigated
Bordered
Consequent Encroachment
Extended
🚨 Alerts
This script provides alert options for all signals.
Bearish Signal
A bearish signal is triggered when the price opens lower than the previous session's close.
Bullish Signal
A bullish signal is triggered when the price opens higher than the previous session's close.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Kalman Synergy Oscillator (KSO)The Kalman Synergy Oscillator (KSO) is an innovative technical indicator that combines the Kalman filter with two well-established momentum oscillators: the Relative Strength Index (RSI) and Williams %R. This combination aims to provide traders with a more refined tool for market analysis.
The use of the Kalman filter is a key feature of the KSO. This sophisticated algorithm is known for its ability to extract meaningful signals from noisy data. In financial markets, this translates to smoothing out price action while maintaining responsiveness to genuine market movements. By applying the Kalman filter to price data before calculating the RSI and Williams %R, the KSO potentially offers more stable and reliable signals.
The synergy between the Kalman-filtered price data and the two momentum indicators creates an oscillator that attempts to capture market dynamics more effectively. The RSI contributes its strength in measuring the magnitude and speed of price movements, while Williams %R adds sensitivity to overbought and oversold conditions. Basing these calculations on Kalman-filtered data may help reduce false signals and provide a clearer picture of underlying market trends.
A notable aspect of the KSO is its dynamic weighting system. This approach adjusts the relative importance of the RSI and Williams %R based on their current strengths, allowing the indicator to emphasize the most relevant information as market conditions change. This flexibility, combined with the noise-reduction properties of the Kalman filter, positions the KSO as a potentially useful tool for different market conditions.
In practice, traders might find that the KSO offers several potential benefits:
Smoother oscillator movements, which could aid in trend identification and reversal detection.
Possibly reduced whipsaws, particularly in choppy or volatile markets.
Potential for improved divergence detection, which might lead to more timely reversal signals.
Consistent performance across different timeframes, due to the adaptive nature of the Kalman filter.
While the KSO builds upon existing concepts in technical analysis, its integration of the Kalman filter with traditional momentum indicators offers traders an interesting tool for market analysis. It represents an attempt to address common challenges in technical analysis, such as noise reduction and false signal minimization.
As with any technical indicator, the KSO should be used as part of a broader trading strategy rather than in isolation. Its effectiveness will depend on how well it aligns with a trader's individual approach and market conditions. For traders looking to explore a more refined momentum oscillator, the Kalman Synergy Oscillator could be a worthwhile addition to their analytical toolkit.
Triple Smoothed Signals [AlgoAlpha]Introducing the Triple Smoothed Signals indicator by AlgoAlpha, a powerful tool designed to help traders identify trend direction and market momentum with greater accuracy. By applying triple smoothing techniques to your chosen data source, this indicator filters out market noise, allowing you to focus on significant price movements. Perfect for traders looking to enhance their technical analysis and gain an edge in the markets.
Key Features
🎨 Customizable Moving Averages : Choose between EMA, SMA, RMA, or WMA for both the triple smoothing and the signal line to tailor the indicator to your trading style.
🛠 Adjustable Smoothing Lengths : Configure the main smoothing length and signal length to fit different timeframes and market conditions.
🌈 Dynamic Color Fills : Visual gradients and fills highlight trend strength and direction, making chart analysis more intuitive.
🔔 Alerts : Set alerts for bullish and bearish crossover signals to stay ahead of market moves without constant chart monitoring.
📈 Clear Signal Visualization : Bullish and bearish signals are plotted directly on your chart for easy interpretation and timely decision-making.
Quick Guide to Using the Triple Smoothed Signals Indicator
🛠 Add the Indicator : Add the indicator to your TradingView chart by clicking on the star icon to add it to your favorites. Customize the settings such as the main smoothing length, signal length, data source, and moving average types to match your trading strategy.
📊 Market Analysis : Monitor the crossovers between the triple smoothed moving average and the signal line. A bullish signal is generated when the signal line crosses under the triple smoothed MA, indicating a potential upward trend. Conversely, a bearish signal occurs when the signal line crosses over the triple smoothed MA, suggesting a possible downward trend.
🔔 Alerts : Enable notifications for reversal signals and trend shifts to stay informed about market movements without constantly monitoring the chart.
How It Works
The Triple Smoothed Signals indicator enhances trend detection by applying a triple smoothing process to your selected data source using the moving average type of your choice (EMA, SMA, RMA, or WMA). This triple smoothed moving average (v1) effectively reduces short-term fluctuations and noise, revealing the underlying market trend. A signal line (v2) is then calculated by smoothing the triple smoothed MA with a separate moving average, further refining the signal. The indicator calculates the normalized distance between the triple smoothed MA and the signal line over a specified period, which is used to create dynamic color gradients and fills on the chart. These visual elements provide immediate insight into trend strength and direction. Bullish and bearish signals are generated based on the crossovers between the signal line and the triple smoothed MA, and are plotted directly on the chart along with customizable alerts to assist traders in making timely decisions.
ATR% Multiple from Key Moving AverageThis script gives signal when the ATR% multiple from any chosen moving average is beyond the configurable threshold value. This indicator quantifies how extended the stock is from a given key moving average.
A lot of traders use ATR% multiple from 10DMA, 21EMA, 50SMA or 200SMA to determine how extended a stock is and accordingly sell partials or exit. By default the indicator takes 50SMA and when the ATR% multiple is greater than 7 then it gives the signal to take partials. You can back test this indicator with previous trades and determine the ideal threshold for the signal. For small and midcaps a threshold of 7 to 10 ATR% multiples from 50SMA is where partials can be taken while large caps can revert to mean even earlier at 3 to 5 ATR% multiples from 50SMA.
You can modify this script and use it anyway you please as long as you make it opensource on TradingView.
Position Size Using Manual Stop Loss [odnac]
This indicator calculates the risk per position based on user-defined settings.
Two Calculation Methods
1. Manual Stop Loss (%) & Manual Leverage
2. Manual Stop Loss (%) & Optimized Leverage
Settings
1. init_capital
Enter your current total capital.
2. Maximum Risk (%) per Position of Total Capital
Specify the percentage of your total funds to be risked for a single position.
3. manual_SL(%)
Enter the stop-loss percentage.
Range: 0.01 ~ 100
4. manual_leverage
Enter the leverage you wish to use.
Range: 1 ~ 100
Used in the first method (Manual Stop Loss (%) & Manual Leverage).
5. Safety Margin
Specify the safety margin for optimized leverage.
Range: 0.01 ~ 1
Used in the second method (Manual Stop Loss (%) & Optimized Leverage). Details are explained below.
Indicator Colors
Black: Indicates which method is being used.
White: Leverage.
First Green: Funds to be invested.
Second Green: Funds to be invested * Leverage.
First Red: Stop-loss (%).
Second Red: Stop-loss (%) * Leverage.
Details for Each Method:
1. Manual Stop Loss (%) & Manual Leverage
This method calculates the size of the funds based on user-defined stop-loss (%) and leverage settings.
White: manual_leverage.
First Green: Investment = Maximum Risk / (manual_SL / 100) / manual_leverage
Second Green: Maximum Risk * (manual_SL / 100)
First Red: manual_SL.
Second Red: manual_SL * manual_leverage
Ensure that the product of manual_SL and manual_leverage does not exceed 100.
If it does, there is a risk of liquidation.
2. Manual Stop Loss (%) & Optimized Leverage
This method calculates optimized leverage based on the user-defined stop-loss (%) and determines the size of the funds.
Optimization_LEVER = auto_leverage * safety_margin
auto_leverage = 100 / stop-loss (%), rounded down to the nearest whole number.
(Exception: If the stop-loss (%) is in the range of 0 ~ 1%, auto_leverage is always 100.)
Example:
If the stop-loss is 4%, auto_leverage = 25 (100 / 4 = 25).
However, 4% × 25 leverage equals 100%, meaning liquidation occurs even with a stop-loss.
To reduce this risk, the safety_margin value is applied.
White: auto_leverage * safety_margin
First Green: Investment = Maximum Risk / (manual_SL / 100) / optimization_LEVER
Second Green: Maximum Risk * (manual_SL / 100)
First Red: manual_SL.
Second Red: manual_SL * optimization_LEVER
lib_smcLibrary "lib_smc"
This is an adaptation of LuxAlgo's Smart Money Concepts indicator with numerous changes. Main changes include integration of object based plotting, plenty of performance improvements, live tracking of Order Blocks, integration of volume profiles to refine Order Blocks, and many more.
This is a library for developers, if you want this converted into a working strategy, let me know.
buffer(item, len, force_rotate)
Parameters:
item (float)
len (int)
force_rotate (bool)
buffer(item, len, force_rotate)
Parameters:
item (int)
len (int)
force_rotate (bool)
buffer(item, len, force_rotate)
Parameters:
item (Profile type from robbatt/lib_profile/32)
len (int)
force_rotate (bool)
swings(len)
INTERNAL: detect swing points (HH and LL) in given range
Parameters:
len (simple int) : range to check for new swing points
Returns: values are the price level where and if a new HH or LL was detected, else na
method init(this)
Namespace types: OrderBlockConfig
Parameters:
this (OrderBlockConfig)
method delete(this)
Namespace types: OrderBlock
Parameters:
this (OrderBlock)
method clear_broken(this, broken_buffer)
INTERNAL: delete internal order blocks box coordinates if top/bottom is broken
Namespace types: map
Parameters:
this (map)
broken_buffer (map)
Returns: any_bull_ob_broken, any_bear_ob_broken, broken signals are true if an according order block was broken/mitigated, broken contains the broken block(s)
create_ob(id, mode, start_t, start_i, top, end_t, end_i, bottom, break_price, early_confirmation_price, config, init_plot, force_overlay)
INTERNAL: set internal order block coordinates
Parameters:
id (int)
mode (int) : 1: bullish, -1 bearish block
start_t (int)
start_i (int)
top (float)
end_t (int)
end_i (int)
bottom (float)
break_price (float)
early_confirmation_price (float)
config (OrderBlockConfig)
init_plot (bool)
force_overlay (bool)
Returns: signals are true if an according order block was broken/mitigated
method align_to_profile(block, align_edge, align_break_price)
Namespace types: OrderBlock
Parameters:
block (OrderBlock)
align_edge (bool)
align_break_price (bool)
method create_profile(block, opens, tops, bottoms, closes, values, resolution, vah_pc, val_pc, args, init_calculated, init_plot, force_overlay)
Namespace types: OrderBlock
Parameters:
block (OrderBlock)
opens (array)
tops (array)
bottoms (array)
closes (array)
values (array)
resolution (int)
vah_pc (float)
val_pc (float)
args (ProfileArgs type from robbatt/lib_profile/32)
init_calculated (bool)
init_plot (bool)
force_overlay (bool)
method create_profile(block, resolution, vah_pc, val_pc, args, init_calculated, init_plot, force_overlay)
Namespace types: OrderBlock
Parameters:
block (OrderBlock)
resolution (int)
vah_pc (float)
val_pc (float)
args (ProfileArgs type from robbatt/lib_profile/32)
init_calculated (bool)
init_plot (bool)
force_overlay (bool)
track_obs(swing_len, hh, ll, top, btm, bull_bos_alert, bull_choch_alert, bear_bos_alert, bear_choch_alert, min_block_size, max_block_size, config_bull, config_bear, init_plot, force_overlay, enabled, extend_blocks, clear_broken_buffer_before, align_edge_to_value_area, align_break_price_to_poc, profile_args_bull, profile_args_bear, use_soft_confirm, soft_confirm_offset, use_retracements_with_FVG_out)
Parameters:
swing_len (int)
hh (float)
ll (float)
top (float)
btm (float)
bull_bos_alert (bool)
bull_choch_alert (bool)
bear_bos_alert (bool)
bear_choch_alert (bool)
min_block_size (float)
max_block_size (float)
config_bull (OrderBlockConfig)
config_bear (OrderBlockConfig)
init_plot (bool)
force_overlay (bool)
enabled (bool)
extend_blocks (simple bool)
clear_broken_buffer_before (simple bool)
align_edge_to_value_area (simple bool)
align_break_price_to_poc (simple bool)
profile_args_bull (ProfileArgs type from robbatt/lib_profile/32)
profile_args_bear (ProfileArgs type from robbatt/lib_profile/32)
use_soft_confirm (simple bool)
soft_confirm_offset (float)
use_retracements_with_FVG_out (simple bool)
method draw(this, config, extend_only)
Namespace types: OrderBlock
Parameters:
this (OrderBlock)
config (OrderBlockConfig)
extend_only (bool)
method draw(blocks, config)
INTERNAL: plot order blocks
Namespace types: array
Parameters:
blocks (array)
config (OrderBlockConfig)
method draw(blocks, config)
INTERNAL: plot order blocks
Namespace types: map
Parameters:
blocks (map)
config (OrderBlockConfig)
method cleanup(this, ob_bull, ob_bear)
removes all Profiles that are older than the latest OrderBlock from this profile buffer
Namespace types: array
Parameters:
this (array type from robbatt/lib_profile/32)
ob_bull (OrderBlock)
ob_bear (OrderBlock)
_plot_swing_points(mode, x, y, show_swing_points, linecolor_swings, keep_history, show_latest_swings_levels, trail_x, trail_y, trend)
INTERNAL: plot swing points
Parameters:
mode (int) : 1: bullish, -1 bearish block
x (int) : x-coordingate of swing point to plot (bar_index)
y (float) : y-coordingate of swing point to plot (price)
show_swing_points (bool) : switch to enable/disable plotting of swing point labels
linecolor_swings (color) : color for swing point labels and lates level lines
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
show_latest_swings_levels (bool)
trail_x (int) : x-coordinate for latest swing point (bar_index)
trail_y (float) : y-coordinate for latest swing point (price)
trend (int) : the current trend 1: bullish, -1: bearish, to determine Strong/Weak Low/Highs
_pivot_lvl(mode, trend, hhll_x, hhll, super_hhll, filter_insignificant_internal_breaks)
INTERNAL: detect whether a structural level has been broken and if it was in trend direction (BoS) or against trend direction (ChoCh), also track the latest high and low swing points
Parameters:
mode (simple int) : detect 1: bullish, -1 bearish pivot points
trend (int) : current trend direction
hhll_x (int) : x-coordinate of newly detected hh/ll (bar_index)
hhll (float) : y-coordinate of newly detected hh/ll (price)
super_hhll (float) : level/y-coordinate of superior hhll (if this is an internal structure pivot level)
filter_insignificant_internal_breaks (bool) : if true pivot points / internal structure will be ignored where the wick in trend direction is longer than the opposite (likely to push further in direction of main trend)
Returns: coordinates of internal structure that has been broken (x,y): start of structure, (trail_x, trail_y): tracking hh/ll after structure break, (bos_alert, choch_alert): signal whether a structural level has been broken
_plot_structure(x, y, is_bos, is_choch, line_color, line_style, label_style, label_size, keep_history)
INTERNAL: plot structural breaks (BoS/ChoCh)
Parameters:
x (int) : x-coordinate of newly broken structure (bar_index)
y (float) : y-coordinate of newly broken structure (price)
is_bos (bool) : whether this structural break was in trend direction
is_choch (bool) : whether this structural break was against trend direction
line_color (color) : color for the line connecting the structural level and the breaking candle
line_style (string) : style (line.style_dashed/solid) for the line connecting the structural level and the breaking candle
label_style (string) : style (label.style_label_down/up) for the label above/below the line connecting the structural level and the breaking candle
label_size (string) : size (size.small/tiny) for the label above/below the line connecting the structural level and the breaking candle
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
structure_values(length, super_hh, super_ll, filter_insignificant_internal_breaks)
detect (and plot) structural breaks and the resulting new trend
Parameters:
length (simple int) : lookback period for swing point detection
super_hh (float) : level/y-coordinate of superior hh (for internal structure detection)
super_ll (float) : level/y-coordinate of superior ll (for internal structure detection)
filter_insignificant_internal_breaks (bool) : if true pivot points / internal structure will be ignored where the wick in trend direction is longer than the opposite (likely to push further in direction of main trend)
Returns: trend: direction 1:bullish -1:bearish, (bull_bos_alert, bull_choch_alert, top_x, top_y, trail_up_x, trail_up): whether and which level broke in a bullish direction, trailing high, (bbear_bos_alert, bear_choch_alert, tm_x, btm_y, trail_dn_x, trail_dn): same in bearish direction
structure_plot(trend, bull_bos_alert, bull_choch_alert, top_x, top_y, trail_up_x, trail_up, hh, bear_bos_alert, bear_choch_alert, btm_x, btm_y, trail_dn_x, trail_dn, ll, color_bull, color_bear, show_swing_points, show_latest_swings_levels, show_bos, show_choch, line_style, label_size, keep_history)
detect (and plot) structural breaks and the resulting new trend
Parameters:
trend (int) : crrent trend 1: bullish, -1: bearish
bull_bos_alert (bool) : if there was a bullish bos alert -> plot it
bull_choch_alert (bool) : if there was a bullish choch alert -> plot it
top_x (int) : latest shwing high x
top_y (float) : latest swing high y
trail_up_x (int) : trailing high x
trail_up (float) : trailing high y
hh (float) : if there was a higher high
bear_bos_alert (bool) : if there was a bearish bos alert -> plot it
bear_choch_alert (bool) : if there was a bearish chock alert -> plot it
btm_x (int) : latest swing low x
btm_y (float) : latest swing low y
trail_dn_x (int) : trailing low x
trail_dn (float) : trailing low y
ll (float) : if there was a lower low
color_bull (color) : color for bullish BoS/ChoCh levels
color_bear (color) : color for bearish BoS/ChoCh levels
show_swing_points (bool) : whether to plot swing point labels
show_latest_swings_levels (bool) : whether to track and plot latest swing point levels with lines
show_bos (bool) : whether to plot BoS levels
show_choch (bool) : whether to plot ChoCh levels
line_style (string) : whether to plot BoS levels
label_size (string) : label size of plotted BoS/ChoCh levels
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
structure(length, color_bull, color_bear, super_hh, super_ll, filter_insignificant_internal_breaks, show_swing_points, show_latest_swings_levels, show_bos, show_choch, line_style, label_size, keep_history, enabled)
detect (and plot) structural breaks and the resulting new trend
Parameters:
length (simple int) : lookback period for swing point detection
color_bull (color) : color for bullish BoS/ChoCh levels
color_bear (color) : color for bearish BoS/ChoCh levels
super_hh (float) : level/y-coordinate of superior hh (for internal structure detection)
super_ll (float) : level/y-coordinate of superior ll (for internal structure detection)
filter_insignificant_internal_breaks (bool) : if true pivot points / internal structure will be ignored where the wick in trend direction is longer than the opposite (likely to push further in direction of main trend)
show_swing_points (bool) : whether to plot swing point labels
show_latest_swings_levels (bool) : whether to track and plot latest swing point levels with lines
show_bos (bool) : whether to plot BoS levels
show_choch (bool) : whether to plot ChoCh levels
line_style (string) : whether to plot BoS levels
label_size (string) : label size of plotted BoS/ChoCh levels
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
enabled (bool)
_check_equal_level(mode, len, eq_threshold, enabled)
INTERNAL: detect equal levels (double top/bottom)
Parameters:
mode (int) : detect 1: bullish/high, -1 bearish/low pivot points
len (int) : lookback period for equal level (swing point) detection
eq_threshold (float) : maximum price offset for a level to be considered equal
enabled (bool)
Returns: eq_alert whether an equal level was detected and coordinates of the first and the second level/swing point
_plot_equal_level(show_eq, x1, y1, x2, y2, label_txt, label_style, label_size, line_color, line_style, keep_history)
INTERNAL: plot equal levels (double top/bottom)
Parameters:
show_eq (bool) : whether to plot the level or not
x1 (int) : x-coordinate of the first level / swing point
y1 (float) : y-coordinate of the first level / swing point
x2 (int) : x-coordinate of the second level / swing point
y2 (float) : y-coordinate of the second level / swing point
label_txt (string) : text for the label above/below the line connecting the equal levels
label_style (string) : style (label.style_label_down/up) for the label above/below the line connecting the equal levels
label_size (string) : size (size.tiny) for the label above/below the line connecting the equal levels
line_color (color) : color for the line connecting the equal levels (and it's label)
line_style (string) : style (line.style_dotted) for the line connecting the equal levels
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
equal_levels_values(len, threshold, enabled)
detect (and plot) equal levels (double top/bottom), returns coordinates
Parameters:
len (int) : lookback period for equal level (swing point) detection
threshold (float) : maximum price offset for a level to be considered equal
enabled (bool) : whether detection is enabled
Returns: (eqh_alert, eqh_x1, eqh_y1, eqh_x2, eqh_y2) whether an equal high was detected and coordinates of the first and the second level/swing point, (eql_alert, eql_x1, eql_y1, eql_x2, eql_y2) same for equal lows
equal_levels_plot(eqh_x1, eqh_y1, eqh_x2, eqh_y2, eql_x1, eql_y1, eql_x2, eql_y2, color_eqh, color_eql, show, keep_history)
detect (and plot) equal levels (double top/bottom), returns coordinates
Parameters:
eqh_x1 (int) : coordinates of first point of equal high
eqh_y1 (float) : coordinates of first point of equal high
eqh_x2 (int) : coordinates of second point of equal high
eqh_y2 (float) : coordinates of second point of equal high
eql_x1 (int) : coordinates of first point of equal low
eql_y1 (float) : coordinates of first point of equal low
eql_x2 (int) : coordinates of second point of equal low
eql_y2 (float) : coordinates of second point of equal low
color_eqh (color) : color for the line connecting the equal highs (and it's label)
color_eql (color) : color for the line connecting the equal lows (and it's label)
show (bool) : whether plotting is enabled
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
Returns: (eqh_alert, eqh_x1, eqh_y1, eqh_x2, eqh_y2) whether an equal high was detected and coordinates of the first and the second level/swing point, (eql_alert, eql_x1, eql_y1, eql_x2, eql_y2) same for equal lows
equal_levels(len, threshold, color_eqh, color_eql, enabled, show, keep_history)
detect (and plot) equal levels (double top/bottom)
Parameters:
len (int) : lookback period for equal level (swing point) detection
threshold (float) : maximum price offset for a level to be considered equal
color_eqh (color) : color for the line connecting the equal highs (and it's label)
color_eql (color) : color for the line connecting the equal lows (and it's label)
enabled (bool) : whether detection is enabled
show (bool) : whether plotting is enabled
keep_history (bool) : weater to remove older swing point labels and only keep the most recent
Returns: (eqh_alert) whether an equal high was detected, (eql_alert) same for equal lows
_detect_fvg(mode, enabled, o, h, l, c, filter_insignificant_fvgs, change_tf)
INTERNAL: detect FVG (fair value gap)
Parameters:
mode (int) : detect 1: bullish, -1 bearish gaps
enabled (bool) : whether detection is enabled
o (float) : reference source open
h (float) : reference source high
l (float) : reference source low
c (float) : reference source close
filter_insignificant_fvgs (bool) : whether to calculate and filter small/insignificant gaps
change_tf (bool) : signal when the previous reference timeframe closed, triggers new calculation
Returns: whether a new FVG was detected and its top/mid/bottom levels
_clear_broken_fvg(mode, upper_boxes, lower_boxes)
INTERNAL: clear mitigated FVGs (fair value gaps)
Parameters:
mode (int) : detect 1: bullish, -1 bearish gaps
upper_boxes (array) : array that stores the upper parts of the FVG boxes
lower_boxes (array) : array that stores the lower parts of the FVG boxes
_plot_fvg(mode, show, top, mid, btm, border_color, extend_box)
INTERNAL: plot (and clear broken) FVG (fair value gap)
Parameters:
mode (int) : plot 1: bullish, -1 bearish gap
show (bool) : whether plotting is enabled
top (float) : top level of fvg
mid (float) : center level of fvg
btm (float) : bottom level of fvg
border_color (color) : color for the FVG box
extend_box (int) : how many bars into the future the FVG box should be extended after detection
fvgs_values(o, h, l, c, filter_insignificant_fvgs, change_tf, enabled)
detect (and plot / clear broken) FVGs (fair value gaps), and return alerts and level values
Parameters:
o (float) : reference source open
h (float) : reference source high
l (float) : reference source low
c (float) : reference source close
filter_insignificant_fvgs (bool) : whether to calculate and filter small/insignificant gaps
change_tf (bool) : signal when the previous reference timeframe closed, triggers new calculation
enabled (bool) : whether detection is enabled
Returns: (bullish_fvg_alert, bull_top, bull_mid, bull_btm): whether a new bullish FVG was detected and its top/mid/bottom levels, (bearish_fvg_alert, bear_top, bear_mid, bear_btm): same for bearish FVGs
fvgs_plot(bullish_fvg_alert, bull_top, bull_mid, bull_btm, bearish_fvg_alert, bear_top, bear_mid, bear_btm, color_bull, color_bear, extend_box, show)
Parameters:
bullish_fvg_alert (bool)
bull_top (float)
bull_mid (float)
bull_btm (float)
bearish_fvg_alert (bool)
bear_top (float)
bear_mid (float)
bear_btm (float)
color_bull (color) : color for bullish FVG boxes
color_bear (color) : color for bearish FVG boxes
extend_box (int) : how many bars into the future the FVG box should be extended after detection
show (bool) : whether plotting is enabled
Returns: (bullish_fvg_alert, bull_top, bull_mid, bull_btm): whether a new bullish FVG was detected and its top/mid/bottom levels, (bearish_fvg_alert, bear_top, bear_mid, bear_btm): same for bearish FVGs
fvgs(o, h, l, c, filter_insignificant_fvgs, change_tf, color_bull, color_bear, extend_box, enabled, show)
detect (and plot / clear broken) FVGs (fair value gaps)
Parameters:
o (float) : reference source open
h (float) : reference source high
l (float) : reference source low
c (float) : reference source close
filter_insignificant_fvgs (bool) : whether to calculate and filter small/insignificant gaps
change_tf (bool) : signal when the previous reference timeframe closed, triggers new calculation
color_bull (color) : color for bullish FVG boxes
color_bear (color) : color for bearish FVG boxes
extend_box (int) : how many bars into the future the FVG box should be extended after detection
enabled (bool) : whether detection is enabled
show (bool) : whether plotting is enabled
Returns: (bullish_fvg_alert): whether a new bullish FVG was detected, (bearish_fvg_alert): same for bearish FVGs
OrderBlock
Fields:
id (series int)
dir (series int)
left_top (chart.point)
right_bottom (chart.point)
break_price (series float)
early_confirmation_price (series float)
ltf_high (array)
ltf_low (array)
ltf_volume (array)
plot (Box type from robbatt/lib_plot_objects/49)
profile (Profile type from robbatt/lib_profile/32)
trailing (series bool)
extending (series bool)
awaiting_confirmation (series bool)
touched_break_price_before_confirmation (series bool)
soft_confirmed (series bool)
has_fvg_out (series bool)
hidden (series bool)
broken (series bool)
OrderBlockConfig
Fields:
show (series bool)
show_last (series int)
show_id (series bool)
show_profile (series bool)
args (BoxArgs type from robbatt/lib_plot_objects/49)
txt (series string)
txt_args (BoxTextArgs type from robbatt/lib_plot_objects/49)
delete_when_broken (series bool)
broken_args (BoxArgs type from robbatt/lib_plot_objects/49)
broken_txt (series string)
broken_txt_args (BoxTextArgs type from robbatt/lib_plot_objects/49)
broken_profile_args (ProfileArgs type from robbatt/lib_profile/32)
use_profile (series bool)
profile_args (ProfileArgs type from robbatt/lib_profile/32)
Hybrid Triple Exponential Smoothing🙏🏻 TV, I present you HTES aka Hybrid Triple Exponential Smoothing, designed by Holt & Winters in the US, assembled by me in Saint P. I apply exponential smoothing individually to the data itself, then to residuals from the fitted values, and lastly to one-point forecast (OPF) errors, hence 'hybrid'. At the same time, the method is a closed-form solution and purely online, no need to make any recalculations & optimize anything, so the method is O(1).
^^ historical OPFs and one-point forecasting interval plotted instead of fitted values and prediction interval
Before the How-to, first let me tell you some non-obvious things about Triple Exponential smoothing (and about Exponential Smoothing in general) that not many catch. Expo smoothing seems very straightforward and obvious, but if you look deeper...
1) The whole point of exponential smoothing is its incremental/online nature, and its O(1) algorithm complexity, making it dope for high-frequency streaming data that is also univariate and has no weights. Consequently:
- Any hybrid models that involve expo smoothing and any type of ML models like gradient boosting applied to residuals rarely make much sense business-wise: if you have resources to boost the residuals, you prolly have resources to use something instead of expo smoothing;
- It also concerns the fashion of using optimizers to pick smoothing parameters; honestly, if you use this approach, you have to retrain on each datapoint, which is crazy in a streaming context. If you're not in a streaming context, why expo smoothing? What makes more sense is either picking smoothing parameters once, guided by exogenous info, or using dynamic ones calculated in a minimalistic and elegant way (more on that in further drops).
2) No matter how 'right' you choose the smoothing parameters, all the resulting components (level, trend, seasonal) are not pure; each of them contains a bit of info from the other components, this is just how non-sequential expo smoothing works. You gotta know this if you wanna use expo smoothing to decompose your time series into separate components. The only pure component there, lol, is the residuals;
3) Given what I've just said, treating the level (that does contain trend and seasonal components partially) as the resulting fit is a mistake. The resulting fit is level (l) + trend (b) + seasonal (s). And from this fit, you calculate residuals;
4) The residuals component is not some kind of bad thing; it is simply the component that contains info you consciously decide not to include in your model for whatever reason;
5) Forecasting Errors and Residuals from fitted values are 2 different things. The former are deltas between the forecasts you've made and actual values you've observed, the latter are simply differences between actual datapoints and in-sample fitted values;
6) Residuals are used for in-sample prediction intervals, errors for out-of-sample forecasting intervals;
7) Choosing between single, double, or triple expo smoothing should not be based exclusively on the nature of your data, but on what you need to do as well. For example:
- If you have trending seasonal data and you wanna do forecasting exclusively within the expo smoothing framework, then yes, you need Triple Exponential Smoothing;
- If you wanna use prediction intervals for generating trend-trading signals and you disregard seasonality, then you need single (simple) expo smoothing, even on trending data. Otherwise, the trend component will be included in your model's fitted values → prediction intervals.
8) Kind of not non-obvious, but when you put one smoothing parameter to zero, you basically disregard this component. E.g., in triple expo smoothing, when you put gamma and beta to zero, you basically end up with single exponential smoothing.
^^ data smoothing, beta and gamma zeroed out, forecasting steps = 0
About the implementation
* I use a simple power transform that results in a log transform with lambda = 0 instead of the mainstream-used transformers (if you put lambda on 2 in Box-Cox, you won't get a power of 2 transform)
* Separate set of smoothing parameters for data, residuals, and errors smoothing
* Separate band multipliers for residuals and errors
* Both typical error and typical residuals get multiplied by math.sqrt(math.pi / 2) in order to approach standard deviation so you can ~use Z values and get more or less corresponding probabilities
* In script settings → style, you can switch on/off plotting of many things that get calculated internally:
- You can visualize separate components (just remember they are not pure);
- You can switch off fit and switch on OPF plotting;
- You can plot residuals and their exponentially smoothed typical value to pick the smoothing parameters for both data and residuals;
- Or you might plot errors and play with data smoothing parameters to minimize them (consult SAE aka Sum of Absolute Errors plot);
^^ nuff said
More ideas on how to use the thing
1) Use Double Exponential Smoothing (data gamma = 0) to detrend your time series for further processing (Fourier likes at least weakly stationary data);
2) Put single expo smoothing on your strategy/subaccount equity chart (data alpha = data beta = 0), set prediction interval deviation multiplier to 1, run your strat live on simulator, start executing on real market when equity on simulator hits upper deviation (prediction interval), stop trading if equity hits lower deviation on simulator. Basically, let the strat always run on simulator, but send real orders to a real market when the strat is successful on your simulator;
3) Set up the model to minimize one-point forecasting errors, put error forecasting steps to 1, now you're doing nowcasting;
4) Forecast noisy trending sine waves for fun.
^^ nuff said 2
All Good TV ∞
Wick Length Display + Alert conditionsDescription of the Wick Length Display (Advanced) script
Originality and purpose of the script
The Wick Length Display (Advanced) script is an innovative tool for traders who want to gain detailed insights into the length of candle wicks. It stands out for its versatility and user-friendly customization options. It combines precise technical calculations with visual representation to provide important information about market movements and dynamics right on the chart.
Functionality
The script calculates and displays the length of the upper and lower wicks of each candle on the chart. It also provides additional visual cues such as:
• “Bull pressure”: When green candles do not have upper wicks, this indicates strong buying pressure.
• “Bear pressure”: When red candles do not have lower wicks, this indicates strong selling pressure.
• Threshold conditions: Only displays wicks that exceed a certain threshold (optional).
• Display in pips: Allows you to display wick lengths in pips, which is useful for forex traders.
How it works
The script analyzes each candle using the following calculations:
1. Wick length calculation:
◦ Upper wick length = High - (top of the body)
◦ Lower wick length = (bottom of the body) - Low
2. Display conditions:
◦ It distinguishes between bullish and bearish candles.
◦ It checks if the calculated wicks exceed the defined thresholds before displaying them.
3. Dynamic labels:
◦ Labels are placed above or below the respective candles.
◦ Size, color and type of labels are fully customizable.
4. Limitation of labels:
◦ To ensure clarity, a maximum number of labels is defined.
Usage
1. Customization:
◦ Open the script in the Pine Script Editor in TradingView.
◦ Use the input options to customize parameters such as color selection, label size, thresholds and other details according to your requirements.
2. Enable thresholds:
◦ Enable thresholds to show labels only for relevant wicks (default is 6).
◦ Define the minimum wick lengths for bullish (green) and bearish (red) candles.
3. Show in pips:
◦ Enable the “Show wick length in pips” option to show the results in pips (especially suitable for Forex).
4. Edit pressure labels:
◦ Turn the “Bull Pressure” and “Bear Pressure” features on or off depending on your analysis settings.
Concepts behind the calculations
• Technical market analysis: Wick lengths can indicate buying or selling pressure and provide important information on market psychology.
• Thresholds and filtering: The script uses thresholds to avoid visual overload and highlight only essential data.
• Label display: Dynamic labels improve chart readability and give the user instant feedback on market developments.
Usage
This script is great for:
• Intraday trading: Analyzing short-term movements using wick lengths.
• Forex trading: Tracking market momentum using the pip indicator.
• Swing trading: Identifying buying or selling pressure in key markets.
• Visual support: Ideal for traders who prefer a graphical display.
Description of the Wick Length Display (Advanced) script
Originality and purpose of the script
The Wick Length Display (Advanced) script is an innovative tool for traders who want to gain detailed insights into the length of candle wicks. It stands out for its versatility and user-friendly customization options. It combines precise technical calculations with visual representation to provide important information about market movements and dynamics right on the chart.
Functionality
The script calculates and displays the length of the upper and lower wicks of each candle on the chart. It also provides additional visual cues such as:
• “Bull pressure”: When green candles do not have upper wicks, this indicates strong buying pressure.
• “Bear pressure”: When red candles do not have lower wicks, this indicates strong selling pressure.
• Threshold conditions: Only displays wicks that exceed a certain threshold (optional).
• Display in pips: Allows you to display wick lengths in pips, which is useful for forex traders.
How it works
The script analyzes each candle using the following calculations:
1. Wick length calculation:
◦ Upper wick length = High - (top of the body)
◦ Lower wick length = (bottom of the body) - Low
2. Display conditions:
◦ It distinguishes between bullish and bearish candles.
◦ It checks if the calculated wicks exceed the defined thresholds before displaying them.
3. Dynamic labels:
◦ Labels are placed above or below the respective candles.
◦ Size, color and type of labels are fully customizable.
4. Limitation of labels
Alert conditions:
Alerts are triggered when the wick length of a bullish or bearish candle exceeds the defined thresholds.
Alert function:
alert() is used to issue messages with a frequency of once per candle when the conditions are met.
How to set up alerts
Save the script and add it to your chart.
Open the alert settings in TradingView.
Select the script's custom message as a trigger.
Adjust the frequency and notification type (popup, email, etc.).
Now you have a powerful tool with visual analysis and alert function!
Daily Moving Averages on Intraday ChartsThis moving average script displays the chosen 5 daily moving averages on intraday (minute) charts. It automatically adjusts the intervals to show the proper moving averages.
In a day there are 375 trading minutes from 9:15 AM to 3:30PM in Indian market. In 5 days there are 1875 minutes. For other markets adjust this data accordingly.
If 5DMA is chosen on a five minute chart the moving average will use 375 interval values (1875/5 = 375) of 5minute chart to calculate moving average. Same 5DMA on 25minute chart will use 75 interval values (1875/25 = 75).
On a 1minute chart the 5DMA plot will use 1875 interval values to arrive at the moving average.
Since tradingview only allows 5000 intervals to lookback, if a particular daily moving average on intraday chart needs more than 5000 candle data it won't be shown. E.g 200DMA on 5minute chart needs 15000 candles data to plot a correct 200DMA line. Anything less than that would give incorrect moving average and hence it won't be shown on the chart.
MA crossover for the first two MAs is provided. If you want to use that option, make sure you give the moving averages in the correct order.
You can enhance this script and use it in any way you please as long as you make it opensource on TradingView. Feedback and improvement suggestions are welcome.
Special thanks to @JohnMuchow for his moving averages script for all timeframes.
Candle ThermalsThis indicator color candles based on their percentage price change, relative to the average, maximum, and minimum changes over the last 100 candles.
-It calculates the percentage change of all candles
-Calculates the minimum, maximum and average in the last 100 bars in percentage change
-Changes color of the candle based on the range between the current percent and min/max value
-The brightest candle provides the highest compound effect to you account if you act on it at the open.
-Candles that have a percentage close to the average then they are barely visible = lowest compound effect to your account
This indicator functions like a "heatmap" for candles, highlighting the relative volatility of price movements in both directions. Strong bullish candles are brighter green, and strong bearish candles are brighter red. It's particularly useful for traders wanting quick visual feedback on price volatility and strength trends within the last 100 bars.
Z The Good Stuff +I created this script to have a couple datapoints that I want to look at when going through charts to find trade ideas. Qullamaggie is one of my biggest inspirations and I built in a couple of his concepts with a touch to help me with sizing properly, all explained below:
Box 1: ADR %, Average Daily Range, gives and indication of how volatile the stock is. It uses the 20 day average % move of the current stock on the chart.
Box 2: LOD Distance, low of day distance is a quality of life element I created. It calculates the low for the current candle and color codes it red or green depending on if it's higher or lower than the daily ADR. The logic is that if a stock has an average speed, buying on a setup it is preferred if the stop distance (assuming a low of day stop) should be less than the ADR to improve the odds of more upside.
Box 3: Todays DV, this shows a rough estimate of how much money was traded on the particular day.
Box 4: ADV 20 days, similar to above this shows the 20 day $ traded average. The point to look at it is to have a better idea what position size is possible to not get stuck in something too illiquid.
Box 5: Market cap, just shows the market cap of the stock to know what size the company is.
Box 6: Number of shares, this is an additional quality of life aspect. If using low of day stops, this part calculates based on the users' inputted portfolio size and portfolio risk preference and then calculates how many stocks to buy to stay within the risk parameters. It is obviously not a sole decision making parameter nor does it guarantee any execution, but if a stock is showing an entry you want to take you can use the number of shares to help you know how many to buy. The preset is a portfolio of 10000 and a risk of 0.25%. This means that the number of shares to buy will be at the current price with lod stop that would result in a 0.25% portfolio loss. OF COURSE the actual loss depends on the execution and if the user places a stop loss order.
Hope you find it useful and feel free to give feedback! Cheers!
100s Level LinesPurpose of the Script
- Visualize Key Levels: The script highlights round-number levels (e.g., 100, 200, 300) automatically, making it easy to identify areas where price action might react.
- Improve Decision-Making: These levels can serve as benchmarks for entry, exit, stop-loss, or take-profit placement.
- Simplicity: Instead of manually drawing levels, the script dynamically updates to match the chart's price range.
Features of the Script
- Dynamic Level Calculation: The script calculates 100s levels based on the asset's current price range and plots lines above and below the visible chart area.
- Customizable Settings: Adjust line color, style (solid, dashed, or dotted), and width to suit your charting preferences.
- Auto-Scaling: Automatically adjusts to the chart's visible price range, ensuring plotted levels are always relevant.
- Labeling: Each line can optionally display its exact value (e.g., "1400," "1500") for easy reference.
- Performance Optimization: Efficient calculations ensure the script doesn’t slow down TradingView, even on volatile instruments like the US100.
How the Script Works
- The script detects the highest and lowest visible prices on the chart to define the range.
- Starting from the lowest 100-point increment within the visible range, the script calculates all 100-point levels up to the highest visible price.
- It plots horizontal lines across the chart for each calculated level.
- Optionally, labels can be added to display the value of each level.
How to Use the Script
- Copy the script code into the Pine Script editor in TradingView and apply it to your chart.
- Open the script settings to adjust line color, style, width, and label visibility.
- Use the plotted 100s levels as psychological support and resistance zones for trade entries, exits, and stop-loss or take-profit placement.
Example Use Cases
- Identify potential reversal points as the price approaches a 100s level in intraday trading.
- Confirm support or resistance zones on higher timeframes for swing trading setups.
- Use the levels to trail stop-losses during trending markets and lock in profits incrementally.
Customizable Options
- Line Color: Change the color of the horizontal lines.
- Line Style: Choose solid, dashed, or dotted lines.
- Line Width: Adjust the thickness of the lines for better visibility.
- Show Labels: Toggle price values on or off for each level.
Advantages
- Saves Time: Automatically plots levels, eliminating manual effort.
- Adaptable: Works on all timeframes and assets.
- Psychological Relevance: Highlights levels that align with trader psychology and market behavior.
Volatility-Adjusted Trend Deviation Statistics (C-Ratios)The Pine Script logic provided generates and displays a table with key information derived from VWMA, EMA, and ATR-based "C Ratios," alongside stochastic oscillators, correlation coefficients, Z-scores, and bias indicators. Here’s an explanation of the logic and what the output in the table informs:
Key Calculations and Their Purpose
VWMA and EMA (Smoothing Lengths):
Multiple EMAs are calculated using VWMA as the source, with lengths spanning short-term (13) to long-term (233).
These EMAs provide a hierarchy of smoothed price levels to assess trends over various time horizons.
ATR-Based "C Ratios":
The C Ratios measure deviations of smoothed prices (a_1 to a_7) from the source price relative to ATR at corresponding lengths.
These values normalize deviations, giving insight into the price's relative movement strength and direction over various periods.
Stochastic Oscillator for C Ratios:
Calculates normalized stochastic values for each C Ratio to assess overbought/oversold conditions dynamically over a rolling window.
Helps identify short-term momentum trends within the broader context of C Ratios.
Displays the average stochastic value derived from all C Ratios.
Text: Shows overbought/oversold conditions (Overbought, Oversold, or ---).
Color: Green for strong upward momentum, red for downward, and white for neutral.
Weighted and Mean C Ratio:
The script computes both an arithmetic mean (c_mean) and a weighted mean (c_mean_w) for all C Ratios.
Weighted mean emphasizes short-term values using predefined weights.
Trend Bias and Reversal Detection:
The script calculates Z-scores for c_mean to identify statistically significant deviations.
It combines Z-scores and weighted C Ratio values to determine:
Bias (Bullish/Bearish based on Z-score thresholds and mean values).
Reversals (Based on relative positioning and how the weighted c_mean and un-weighted C_mean move. ).
Correlation Coefficient:
Correlation of mean C Ratios (c_mean) with bar indices over the short-term length (sl) assesses the strength and direction of trend consistency.
Table Output and Its Meaning
Stochastic Strength:
Long-term Correlation:
List of Lengths: Define the list of lengths for EMA and ATR explicitly (e.g., ).
Calculate Mean C Ratios: For each length in the list, calculate the mean C Ratio
Average these values over the entire dataset.
Store Lengths and Mean C Ratios: Maintain arrays for lengths and their corresponding mean C Ratios.
Correlation: compute the Pearson correlation between the list of lengths and the mean C Ratios.
Text: Indicates Uptrend, Downtrend, or neutral (---).
Color: Green for positive (uptrend), red for negative (downtrend), and white for neutral.
Z-Score Bias:
Assesses the statistical deviation of C Ratios from their historical mean.
Text: Bullish Bias, Bearish Bias, or --- (neutral).
Color: Green or red based on the direction and significance of the Z-score.
C-Ratio Mean:
Displays the weighted average C Ratio (c_mean_w) or a reversal condition.
Text: If no reversal is detected, shows c_mean_w; otherwise, a reversal condition (Bullish Reversal, Bearish Reversal).
Color: Indicates the strength and direction of the bias or reversal.
Practical Insights
Trend Identification: Correlation coefficients, Z-scores, and stochastic values collectively highlight whether the market is trending and the trend's direction.
Momentum and Volatility: Stochastic and ATR-normalized C Ratios provide insights into the momentum and price movement consistency across different timeframes.
Bias and Reversal Detection: The script highlights potential shifts in market sentiment or direction (bias or reversal) using statistical measures.
Customization: Users can toggle plots and analyze specific EMA lengths or focus on combined metrics like the weighted C Ratio.
Position Sizing Calculator (Real-Time)█ SUMMARY
The following indicator is a Position Sizing Calculator based on Average True Range (ATR), originally developed by market technician J. Welles Wilder Jr., intended for real-time trading.
This script utilizes the user's account size, acceptable risk percentage, and a stop-loss distance based on ATR to dynamically calculate the appropriate position size for each trade in real time.
█ BACKGROUND
Developed for use on the 5-minute timeframe, this script provides traders with continuously updated, dynamic position sizes. It enables traders to instantly determine the exact number of shares and dollar amount to use for entering a trade within their acceptable risk tolerance whenever a trade opportunity arises.
This real-time position sizing tool helps traders make well-informed decisions when planning trade entries and calculating maximum stop-loss levels, ultimately enhancing risk management.
█ USER INPUTS
Trading Account Size: Total dollar value of the user's trading account.
Acceptable Risk (%): Maximum percentage of the trading account that the user is willing to risk per trade.
ATR Multiplier for Stop-Loss: Multiplier used to determine the distance of the stop-loss from the current price, based on the ATR value.
ATR Length: The length of the lookback period used to calculate the ATR value.
Fractal Trail [UAlgo]The Fractal Trail is designed to identify and utilize Williams fractals as dynamic trailing stops. This tool serves traders by marking key fractal points on the chart and leveraging them to create adaptive stop-loss trails, enhancing risk management and trade decision-making.
Williams fractals are pivotal in identifying potential reversals and critical support/resistance levels. By plotting fractals dynamically and providing configurable options, this indicator allows for personalized adjustments based on the trader's strategy.
This script integrates both visual fractal markers and adjustable trailing stops, offering insights into market trends while catering to a wide variety of trading styles and timeframes.
🔶 Key Features
Williams Fractals Identification: The indicator marks Williams Fractals on the chart, which are significant highs and lows within a specified range. These fractals are crucial for identifying potential reversal points in the market.
Dynamic Trailing Stops: The indicator generates dynamic trailing stops based on the identified fractals. These stops adjust automatically as new fractals are formed, providing a responsive and adaptive approach to risk management.
Fractal Range: Users can specify the number of bars to the left and right for analyzing fractals, allowing for flexibility in identifying significant price points.
Trail Buffer Percentage: A percentage-based safety margin can be added between the fractal price and the trailing stop, providing additional control over risk management.
Trail Invalidation Source: Users can choose whether the trailing stop flips based on candle closing prices or the extreme points (high/low) of the candles.
Alerts and Notifications: The indicator provides alerts for when the price crosses the trailing stops, as well as when new Williams Fractals are confirmed. These alerts can be customized to fit the trader's notification preferences.
🔶 Interpreting the Indicator
Fractal Markers: The triangles above and below the bars indicate Williams Fractals. These markers help traders identify potential reversal points in the market.
Trailing Stops: The dynamic trailing stops are plotted as lines on the chart. These lines adjust based on the latest identified fractals, providing a visual representation of potential support and resistance levels.
Fill Colors: The optional fill colors between the trailing stops and the price action help traders quickly identify the current trend and potential pullback zones.
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
New Bar AlertThis is probably the simplest indicator on Tradingview, it generates an alert on every new bar.
Useful for strategies where you only need chart attention at the new bar, see if you have a setup.
Helps not having to stare at the charts, the alert will tell you when it's time to take a look.
Works on all timeframes but in order to keep your sanity, best used on higher timeframes, 5mins and up.
Structure Pilot Vision [Wang Indicators]Built and refined with Dave Teaches, the HTF Vision Pro supercharges the trader, providing them with the tools to approach price with a layered analysis.
Providing the trader the instruments to put on the spotlight significant zones to anticipate price deliveries
HTF CANDLE VISION
Displays up to 3 series of HTF Candles
Shows candlesticks from a higher time frame (e.g., daily, 4-hour, weekly) on a lower time frame chart (e.g., 1-hour, 15-minute). This allows traders to simultaneously observe both short-term and long-term market dynamics.
Customizable Time Frames: Users can select any higher time frame to overlay on the current chart. Common time frames include daily, weekly, and monthly candles, but other custom time frames can also be used.
Color Coding: The HTF candles are color-coded for easy differentiation from the lower time frame candles. Users can customize colors to suit their preferences.
Open, High, Low, Close (OHLC) Representation: The indicator displays the full candlestick pattern for the chosen HTF, including the open, high, low, and close values. This helps traders easily identify key price levels and trends.
Settings :
Number of candles
Space between the chart and the HTF candles
Space between candles sets
Size : from Tiny (2x regular candle size) to Large (x8 regular candle size)
Space between candles
Colors of candles, borders and wicks
Incorporating a Higher Time Frame (HTF) candle into your Lower Time Frame (LTF) chart can be immensely beneficial for traders looking to enhance their analysis and decision-making process.
Use Cases for HTF Candles on LTF Charts:
Trend Confirmation:
Use Case: A trader might be looking at a 15-minute chart (LTF) but wants to confirm if the short-term trends align with the daily trend (HTF). Plotting a daily candle on the 15-minute chart helps visualize whether the short-term movements are part of a broader, longer-term trend.
Support and Resistance Identification:
Use Case: By plotting a weekly candle on a daily chart, traders can quickly identify levels that have acted as significant support or resistance in the past on the higher time frame, which might not be as visible or influential on the daily chart alone.
Entry and Exit Points Enhancement:
Use Case: When preparing to enter a trade based on a 1-hour chart, overlaying a 4-hour candle can provide insights into potential reversal points or continuation patterns that are more significant on the higher time frame, thus refining entry and exit strategies.
Volatility and Breakout Analysis:
Use Case: Seeing how a single HTF candle (like a monthly candle on a weekly chart) closes can give traders an idea of the market's volatility or the strength behind breakouts. A long wick on the HTF candle might suggest a rejected breakout or a potential reversal.
Risk Management:
Use Case: Using an HTF candle can help set more informed stop-loss levels. For instance, if a trader uses a 4-hour candle on a 1-hour chart, they might place their stop-loss just beyond the low of the HTF candle, assuming this represents a significant level of support or resistance.
Contextual Trading Decisions:
Use Case: For scalpers or day traders, understanding where the current price action sits within the context of a higher timeframe can lead to better decision-making. For instance, trading within an HTF consolidation range might suggest less aggressive moves, while being near the top or bottom of such a range might indicate potential for larger movements.
Market Sentiment Analysis:
Use Case: The color (red for bearish, green for bullish) and size of the HTF candle can give a quick visual cue of the market sentiment over that period, helping traders assess whether they are going with or against the broader market flow.
Swing Trading:
Use Case: Swing traders might plot a weekly candle on a daily chart to align their trades with the direction of the weekly trend, ensuring they're not fighting the broader market momentum.
Educational and Visual Reference:
Use Case: For educational purposes, having an HTF candle overlay can serve as a visual reminder for students or new traders about how price movements on different time frames can influence each other, aiding in teaching concepts like "the trend is your friend."
Wang use cases :
The way it is intended to be used is as follow
If you trade the 1 min chart and have a set of 5 min HTF candles plotted on your charts it could be used as follow :
As long as the 5 min keep providing close below the last 5 min candle if you're short you're safe ... if the 5 min candle stop closing below the last ones and start giving up-close you should consider closing your trade
Another use of HTF Candle is to find fractals responsible (up or down internal mouv before the breakout that creates a new zone). This fractal acts as supply and demand zone responsible for maintening the trend or for a reversal.
See examples below :
These fractals are interesting zones because they often cause the price to react, so following a flip in the fractal, you can take a short in bearish zones and a long in bullish zones. Fractals are easier to detect thanks to the HTF candles function, and allow you to enter positions with greater confidence. They can be used in the same way as the 70%, 50% and 30% interest zones, or they can be used simultaneously.
Use with zones :
▫️ VERTICAL BARS VISION ▫️
The vertical bars provide a view of market fractality: on a low time frame chart, they show the size of a candle in a higher time frame, and thus give a better understanding of the price fractality essential to the strategy we use.
Example :
For your information, when you modify data in the vertical bars or HTF candles parameters, the two are synchronized automatically.
The Vertical HTF Candle Closures Indicator is a simple yet effective tool that helps traders visually track the closing times of higher time frame (HTF) candles (such as 4H, 1H, 15M) on a lower time frame chart (e.g., 1-minute).
This feature plots vertical lines on the chart at the exact closure time of each selected HTF, allowing traders to quickly recognize key moments when the HTF candles close, or better yet when we trade above / below the last one and reverse ''sweepy sweepy'' .
Its more like a vertical and more micro visualisation than the HTF Candles.
Wang usage :
its a great tool to be able to reverse engineer what's in a HTFcandle precisely its a good combination with HTF candle projections to train the eyes of the traders about Whats is inside a candle that formed on the higher time frame
Limitation & know issues :
The chart may become cluttered with too many lines if multiple time frames are selected. Adjusting the line style or disabling certain time frames can help reduce visual noise.
On low time frame (<30s), some bar may notshow exactly on time (e.g : in 10sec timeframe, the 15min bar can be displayed at 01:15:10 instead of 01:15:00).
Because of the data provider and the interpreter of Trading View, if there is not data for a candle, Trading view just "skip" the candle. Sometime, those skip are on the candle that goes to 15min, 1 hour or 4 hour. As this is a Trading View issue. There is pretty much nothing we can do.
Some users may experience vertical bars at 1am, 5am, 9am ... instead of 0am, 4am, 8am ... That is because of the difference between the Timezone set on the chart and the timezone of the market they trade. Vertical bar will always refer to the symbol displayed
BacktestLibraryLibrary "BacktestLibrary"
A library providing functions for equity calculation and performance metrics.
since(date, active)
: Calculates the number of candles since a specified date.
Parameters:
date (simple float) : (simple float): The starting date in timestamp format (e.g., input.time(timestamp()))
active (simple bool) : (simple bool): If true, counts the number of candles since the date; if false, returns 0.
Returns: (int): The number of candles since the specified date.
buy_and_hold(r, startDate)
: Calculates the Buy and Hold Equity from a specified date.
Parameters:
r (float) : (series float): Daily returns of the asset (e.g., 0.02 for 2% move).
startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
Returns: (float): Buy and Hold Equity of the asset from the specified date.
equity(sig, threshold, r, startDate, signals)
: Calculates the strategy's equity on a candle-by-candle basis.
Parameters:
sig (float) : (series float): Signal values; positive for long, negative for short.
threshold (simple float) : (simple float): Signal threshold for entering trades.
r (float) : (series float): Daily returns of the asset (e.g., 0.02 for 2% move).
startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
signals (simple string) : (simple string): Type of signals to backtest ("Long & Short", "Long Only", "Short Only").
Returns: (float): Strategy equity on a candle-by-candle basis.
PerformanceMetrics(base, Lookback, startDate)
: Calculates performance metrics of a strategy from a specified date.
Parameters:
base (float) : (series float): Equity values of the strategy or Buy and Hold equity.
Lookback (int) : (series int): Number of periods since the start date; recommended to use the 'since' function.
startDate (simple float) : (simple float): Timestamp of the starting date for the equity calculation.
Returns: (float ): Array of performance metrics.
PerfMetricTable(buy_and_hold, strategy)
: Plots a table comparing performance metrics of Buy and Hold and Strategy equity.
Parameters:
buy_and_hold (array) : (float ): Metrics from the PerformanceMetrics() function for Buy and Hold.
strategy (array) : (float ): Metrics from the PerformanceMetrics() function for the strategy.
Returns: : Table displaying the performance metrics comparison.
ImbalancesThis Pine Script is a trading indicator designed to identify imbalances in the market, specifically on candlestick charts. An imbalance refers to situations where there is a significant difference between buyers and sellers, which can create gaps or areas of inefficiency in the price. These imbalances often act as zones where price may return to "fill" or correct these inefficiencies.
1. Identifying Imbalances
The script analyzes candlestick patterns to detect imbalances based on the relationship between the highs, lows, and closes of consecutive candles. Specifically, it looks for:
Top Imbalances (Bearish): Areas where selling pressure has dominated, causing inefficiencies in the price. These are represented by patterns like multiple consecutive bearish candles or bearish gaps.
Bottom Imbalances (Bullish): Areas where buying pressure has dominated, leading to bullish gaps or inefficiencies.
When an imbalance is detected, the script highlights the area using visual boxes on the chart.
2. Visual Representation
The indicator uses colored boxes to show imbalances directly on the chart:
Top (Bearish) Imbalances: Highlighted using shades of red.
Bottom (Bullish) Imbalances: Highlighted using shades of green.
The boxes are further categorized into three states based on their level of mitigation:
Unmitigated: The imbalance has not been "filled" by price yet.
Partially Mitigated: Price has entered the imbalance zone but not completely filled it.
Fully Mitigated: Price has completely filled the imbalance zone.
3. Mitigation Logic
The concept of mitigation refers to the price revisiting an imbalance zone to correct the inefficiency:
If price fully or partially revisits an imbalance zone, the box's color changes to indicate the mitigation level (e.g., from unmitigated to partially/fully mitigated).
Fully mitigated boxes may be removed or recolored, depending on user preferences.
4. User Customization
The script provides several inputs to customize its behavior:
Enable or disable top and bottom imbalance detection.
Color settings: Users can define different colors for unmitigated, partially mitigated, and fully mitigated imbalances.
Mitigation display options: Users can choose whether to show fully mitigated imbalances on the chart or remove them.
5. Key Calculations
Imbalance Size: The size of the imbalance is calculated as the price difference between a candle's high and low across the relevant pattern.
Pattern Detection: The script checks for specific candlestick patterns (e.g., three consecutive bearish candles) to identify potential imbalances.
6. Practical Use Case
This indicator is useful for traders who:
Rely on supply and demand zones for their trading strategies.
Look for areas where price is likely to return (retesting unmitigated imbalances can signal potential trade setups).
Want to visually track market inefficiencies over time.
In Summary
The "Imbalances" indicator highlights and tracks price inefficiencies on candlestick charts. It marks zones where buying or selling pressure was dominant, and it dynamically updates these zones based on price action to indicate their mitigation status. This tool is particularly helpful for traders who use price action and market structure in their strategies.