Volume Profile Free Ultra SLI (100 Levels Value Area VWAP) - RRBVolume Profile Free Ultra SLI by RagingRocketBull 2019
Version 1.0
This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 100 horizontal bars.
This is basically the MAX SLI version with +50 more Pinescript v4 line objects added as levels.
It can also show Point of Control (POC), Developing POC, Value Area/VWAP StdDev High/Low as dynamically moving levels.
Free accounts can't access Standard TradingView Volume Profile, hence this indicator. 
There are several versions: Free Pro, Free MAX SLI, Free Ultra SLI, Free History. This is the Free Ultra SLI version. The Differences are listed below:
 - Free Pro: 25 levels, +Developing POC, Value Area/VWAP High/Low Levels, Above/Below Area Dimming
 - Free MAX SLI: 50 levels, 2x SLI modes for Buy/Sell or even higher res 150 levels
 - Free Ultra SLI: 100 levels, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 300 levels
 - Free History: auto highest/lowest, historic poc/va levels for each session
Features:
 - High-Res Volume Profile with up to 100 levels (line implementation)
 - 2x SLI modes for even higher res: 300 levels with 3x vertical SLI, 100 buy/sell levels with 2x horiz SLI
 - Calculate Volume Profile on full history
 - POC, Developing POC Levels
 - Buy/Sell/Total volume modes
 - Side Cover
 - Value Area, VAH/VAL dynamic levels
 - VWAP High/Low dynamic levels with Source, Length, StdDev as params
 - Show/Hide all levels
 - Dim Non Value Area Zones
 - Custom Range with Highlighting
 - 3 Anchor points for Volume Profile
 - Flip Levels Horizontally
 - Adjustable width, offset and spacing of levels
 - Custom Color for POC/VA/VWAP levels, Transparency for buy/sell levels
 
WARNING: 
 - Compilation Time: 1 min 20 sec
Usage:
 - specify max_level/min_level/spacing (required)
 - select range (start_bar, range length), confirm with range highlighting
 - select volume type: Buy/Sell/Total
 - select mode Value Area/VWAP to show corresponding levels
 - flip/select anchor point to position the buy/sell levels
 - use Horiz Buy/Sell SLI mode with 100 or Vertical SLI with 300 levels if needed
 - use POC/Developing POC/VA/VWAP High/Low as S/R levels. Usually daily values from 1-3 days back are used as levels for the current day.
SLI:
use SLI modes to extend the functionality of the indicator:
   - Horiz Buy/Sell 2x SLI lets you view 100 Buy/Sell Levels at the same time
   - Vertical Max_Vol 3x SLI lets you increase the resolution to 300 levels
   - you need at least 2 instances of the indicator attached to the same chart for SLI to work
1) Enable Horiz SLI:
   - attach 2 indicator instances to the chart
   - make sure all instances have the same min_level/max_level/range/spacing settings
   - select volume type for each instance: you can have a buy/sell or buy/total or sell/total SLI. Make sure your buy volume instance is the last attached to be displayed on top of sell/total instances without overlapping.
   - set buy_sell_sli_mode to true for indicator instances with volume_type = buy/sell, for type total this is optional.
   - this basically tells the script to calculate % lengths based on total volume instead of individual buy/sell volumes and use ext offset for sell levels
   - Sell Offset is calculated relative to Buy Offset to stack/extend sell after buy. Buy Offset = Zero - Buy Length. Sell Offset = Buy Offset - Sell Length = Zero - Buy Length - Sell Length
   - there are no master/slave instances in this mode, all indicators are equal, poc/va levels are not affected and can work independently, i.e. one instance can show va levels, another - vwap.
2) Enable Vertical SLI:
   - attach the first instance and evaluate the full range to roughly determine where is the highest max_vol/poc level i.e. 0..20000, poc is in the bottom half (third, middle etc) or
   - add more instances and split the full vertical range between them, i.e. set min_level/max_level of each corresponding instance to 0..10000, 10000..20000 etc
   - make sure all instances have the same range/spacing settings
   - an instance with a subrange containing the poc level of the full range is now your master instance (bottom half). All other instances are slaves, their levels will be calculated based on the max_vol/poc of the master instance instead of local values
   - set show_max_vol_sli to true for the master instance. for slave instances this is optional and can be used to check if master/slave max_vol values match and slave can read the master's value. This simply plots the max_vol value
   - you can also attach all instances and set show_max_vol_sli to true in all of them - the instance with the largest max_vol should become the master
   Auto/Manual Ext Max_Vol Modes:
   - for auto vertical max_vol SLI mode set max_vol_sli_src in all slave instances to the max_vol of the master indicator: "VolumeProfileFree_MAX_RRB: Max Volume for Vertical SLI Mode". It can be tricky with 2+ instances
   - in case auto SLI mode doesn't work - assign max_vol_sli_ext in all slave instances the max_vol value of the master indicator manually and repeat on each change
   - manual override max_vol_sli_ext has higher priority than auto max_vol_sli_src when both values are assigned, when they are 0 and close respectively - SLI is disabled
   - master/slave max_vol values must match on each bar at all times to maintain proper level scale, otherwise slave's levels will look larger than they should relative to the master's levels. 
   - Max_vol (red) is the last param in the long list of indicator outputs
   - the only true max_vol/poc in this SLI mode is the master's max_vol/poc. All poc/va levels in slaves will be irrelevant and are disabled automatically. Slaves can only show VWAP levels.
   - VA Levels of the master instance in this SLI mode are calculated based on the subrange, not the whole range and may be inaccurate. Cross check with the full range.
   WARNING! 
   - auto mode max_vol_sli_src is experimental and may not work as expected
   - you can only assign auto mode max_vol_sli_src = max_vol once due to some bug with unhandled exception/buffer overflow in Tradingview. Seems that you can clear the value only by removing the indicator instance
   - sometimes you may see a "study in error state" error when attempting to set it back to close. Remove indicator/Reload chart and start from scratch
   - volume profile may not finish to redraw and freeze in an ugly shape after an UI parameter change when max_vol_sli_src is assigned a max_vol value. Assign it to close - VP should redraw properly, but it may not clear the assigned max_vol value
   - you can't seem to be able to assign a proper auto max_vol value to the 3rd slave instance
   - 2x Vertical SLI works and tested in both auto/manual, 3x SLI - only manual seems to work (you can have a mixed mode: 2nd instance - auto, 3rd - manual)
Notes:
 - This code uses Pinescript v3 compatibility framework
 - This code is 20x-30x faster (main for cycle is removed) especially on lower tfs with long history - only 4-5 sec load/redraw time vs 30-60 sec of the old Pro versions
 - Instead of repeatedly calculating the total sum of volumes for the whole range on each bar, vol sums are now increased on each bar and passed to the next in the range making it a per range vs per bar calculation that reduces time dramatically
 - 100 levels consist of 50 main plot levels and 50 line objects used as alternate levels, differences are:
   - line objects are always shown on top of other objects, such as plot levels, zero line and side cover, it's not possible to cover/move them below.
   - all line objects have variable lengths, use actual x,y coords and don't need side cover, while all plot levels have a fixed length of 100 bars, use offset and require cover.
   - all key properties of line objects, such as x,y coords, color can be modified, objects can be moved/deleted, while this is not possible for static plot levels.
   - large width values cause line objects to expand only up/down from center while their length remains the same and stays within the level's start/end points similar to an area style.
   - large width values make plot levels expand in all directions (both h/v), beyond level start/end points, sometimes overlapping zero line, making them an inaccurate % length representation, as opposed to line objects/plot levels with area style.
   - large width values translate into different widths on screen for line objects and plot levels.
   - you can't compensate for this unwanted horiz width expansion of plot levels because width uses its own units, that don't translate into bars/pixels.
   - line objects are visible only when num_levels > 50, plot levels are used otherwise
 - Since line objects are lines, plot levels also use style line because other style implementations will break the symmetry/spacing between levels.
 - if you don't see a volume profile check range settings: min_level/max_level and spacing, set spacing to 0 (or adjust accordingly based on the symbol's precision, i.e. 0.00001)
 - you can view either of Buy/Sell/Total volumes, but you can't display Buy/Sell levels at the same time using a single instance (this would 2x reduce the number of levels). Use 2 indicator instances in horiz buy/sell sli mode for that.
 - Volume Profile/Value Area are calculated for a given range and updated on each bar. Each level has a fixed length. Offsets control visible level parts. Side Cover hides the invisible parts.
 - Custom Color for POC/VA/VWAP levels - UI Style color/transparency can only change shape's color and doesn't affect textcolor, hence this additional option
 - Custom Width - UI Style supports only width <= 4, hence this additional option
 - POC is visible in both modes. In VWAP mode Developing POC becomes VWAP, VA High and Low => VWAP High and Low correspondingly to minimize the number of plot outputs
 - You can't change buy/sell level colors from input (only transparency) - this requires 2x plot outputs => 2x reduces the number of levels to fit the max 64 limit. That's why 2 additional plots are used to dim the non Value Area zones
 - You can change level transparency of line objects. Due to Pinescript limitations, only discrete values are supported.
 - Inverse transp correlation creates the necessary illusion of "covered" line objects, although they are shown on top of the cover all the time
 - If custom lines_transp is set the illusion will break because transp range can't be skewed easily (i.e. transp 0..100 is always mapped to 100..0 and can't be mapped to 50..0)
 - transparency can applied to lines dynamically but nva top zone can't be completely removed because plot/mixed type of levels are still used when num_levels < 50 and require cover
 - transparency can't be applied to plot levels dynamically from script this can be done only once from UI, and you can't change plot color for the past length bars
 - All buy/sell volume lengths are calculated as % of a fixed base width = 100 bars (100%). You can't set show_last from input to change it
 - Range selection/Anchoring is not accurate on charts with time gaps since you can only anchor from a point in the future and measure distance in time periods, not actual bars, and there's no way of knowing the number of future gaps in advance.
 - Adjust Width for Log Scale mode now also works on high precision charts with small prices (i.e. 0.00001)
 - in Adjust Width for Log Scale mode Level1 width extremes can be capped using max deviation (when level1 = 0, shift = 0 width becomes infinite)
 - There's no such thing as buy/sell volume, there's just volume, but for the purposes of the Volume Profile method, assume: bull candle = buy volume, bear candle = sell volume
P.S. I am your grandfather, Luke! Now, join the Dark Side in your father's steps or be destroyed! Once more the Sith will rule the Galaxy, and we shall have peace...
"莱加内斯VS皇家社会"に関するスクリプトを検索
Hull MA and Candle crossHull MA vs price cossover . not 2 Hull MA's crossing, and also a  price vs previous price crossover :
current price higher than previous = buy
current price lower than previous = sell
Price value set to OPEN to avoid repaint during candle
Volume Profile Free MAX SLI (50 Levels Value Area VWAP) by RRBVolume Profile Free MAX SLI by RagingRocketBull 2019
Version 1.0
All available Volume Profile Free MAX SLI versions are listed below (They are very similar and I don't want to publish them as separate indicators):
ver 1.0: style columns implementation
ver 2.0: style histogram implementation 
ver 3.0: style line implementation
This indicator calculates Volume Profile for a given range and shows it as a histogram consisting of 50 horizontal bars. 
It can also show Point of Control (POC), Developing POC, Value Area/VWAP StdDev High/Low as dynamically moving levels.
Free accounts can't access Standard TradingView Volume Profile, hence this indicator. 
There are several versions: Free Pro, Free MAX SLI, Free History. This is the Free MAX SLI version. The Differences are listed below:
 - Free Pro: 25 levels, +Developing POC, Value Area/VWAP High/Low Levels, Above/Below Area Dimming
 - Free MAX SLI: 50 levels, packed to the limit, 2x SLI modes for Buy/Sell or even higher res 150 levels
 - Free History: auto highest/lowest, historic poc/va levels for each session
Features:
 - High-Res Volume Profile with up to 50 levels (3 implementations)
 - 20-30x faster than the old Pro versions especially on lower tfs with long history
 - 2x SLI modes for even higher res: 150 levels with 3x vertical SLI, 50 buy/sell levels with 2x horiz SLI
 - Calculate Volume Profile on full history
 - POC, Developing POC Levels
 - Buy/Sell/Total volume modes
 - Side Cover
 - Value Area, VAH/VAL dynamic levels
 - VWAP High/Low dynamic levels with Source, Length, StdDev as params
 - Show/Hide all levels
 - Dim Non Value Area Zones
 - Custom Range with Highlighting
 - 3 Anchor points for Volume Profile
 - Flip Levels Horizontally
 - Adjustable width, offset and spacing of levels
 - Custom Color for POC/VA/VWAP levels and Transparency for buy/sell levels
Usage:
 - specify max_level/min_level/spacing (required)
 - select range (start_bar, range length), confirm with range highlighting
 - select volume type: Buy/Sell/Total
 - select mode Value Area/VWAP to show corresponding levels
 - flip/select anchor point to position the buy/sell levels
 - use Horiz SLI mode for 50 Buy/Sell or Vertical SLI for 150 levels if needed
 - use POC/Developing POC/VA/VWAP High/Low as S/R levels. Usually daily values from 1-3 days back are used as levels for the current day.
SLI:
 - use SLI modes to extend the functionality of the indicator:
   - Horiz Buy/Sell 2x SLI lets you view 50 Buy/Sell Levels at the same time
   - Vertical Max_Vol 3x SLI lets you increase the resolution to 150 levels
   - you need at least 2 instances of the indicator attached to the same chart for SLI to work
1) Enable Horiz SLI:
   - attach 2 indicator instances to the chart
   - make sure all instances have the same min_level/max_level/range/spacing settings
   - select volume type for each instance: you can have a buy/sell or buy/total or sell/total SLI. Make sure your buy volume instance is the last attached to be displayed on top of sell/total instances without overlapping.
   - set buy_sell_sli_mode to true for indicator instances with volume_type = buy/sell, for type total this is optional.
   - this basically tells the script to calculate % lengths based on total volume instead of individual buy/sell volumes and use ext offset for sell levels
   - Sell Offset is calculated relative to Buy Offset to stack/extend sell after buy. Buy Offset = Zero - Buy Length. Sell Offset = Buy Offset - Sell Length = Zero - Buy Length - Sell Length
   - there are no master/slave instances in this mode, all indicators are equal, poc/va levels are not affected and can work independently, i.e. one instance can show va levels, another - vwap.
2) Enable Vertical SLI:
   - attach the first instance and evaluate the full range to roughly determine where is the highest max_vol/poc level i.e. 0..20000, poc is in the bottom half (third, middle etc) or
   - add more instances and split the full vertical range between them, i.e. set min_level/max_level of each corresponding instance to 0..10000, 10000..20000 etc
   - make sure all instances have the same range/spacing settings
   - an instance with a subrange containing the poc level of the full range is now your master instance (bottom half). All other instances are slaves, their levels will be calculated based on the max_vol/poc of the master instance instead of local values
   - set show_max_vol_sli to true for the master instance. for slave instances this is optional and can be used to check if master/slave max_vol values match and slave can read the master's value. This simply plots the max_vol value
   - you can also attach all instances and set show_max_vol_sli to true in all of them - the instance with the largest max_vol should become the master
  Auto/Manual Ext Max_Vol Modes:
   - for auto vertical max_vol SLI mode set max_vol_sli_src in all slave instances to the max_vol of the master indicator: "VolumeProfileFree_MAX_RRB: Max Volume for Vertical SLI Mode". It can be tricky with 2+ instances
   - in case auto SLI mode doesn't work - assign max_vol_sli_ext in all slave instances the max_vol value of the master indicator manually and repeat on each change
   - manual override max_vol_sli_ext has higher priority than auto max_vol_sli_src when both values are assigned, when they are 0 and close respectively - SLI is disabled
   - master/slave max_vol values must match on each bar at all times to maintain proper level scale, otherwise slave's levels will look larger than they should relative to the master's levels. 
   - Max_vol (red) is the last param in the long list of indicator outputs
   - the only true max_vol/poc in this SLI mode is the master's max_vol/poc. All poc/va levels in slaves will be irrelevant and are disabled automatically. Slaves can only show VWAP levels.
   - VA Levels of the master instance in this SLI mode are calculated based on the subrange, not the whole range. Cross check with the full range.
  WARNING! 
   - auto mode max_vol_sli_src is experimental and may not work as expected
   - you can only assign auto mode max_vol_sli_src = max_vol once due to some bug with unhandled exception/buffer overflow in Tradingview. Seems that you can clear the value only by removing the indicator instance
   - sometimes you may see a "study in error state" error when attempting to set it back to close. Remove indicator/Reload chart and start from scratch
   - volume profile may not finish to redraw and freeze in an ugly shape after an UI parameter change when max_vol_sli_src is assigned a max_vol value. Assign it to close - VP should redraw properly, but it may not clear the assigned max_vol value
   - you can't seem to be able to assign a proper auto max_vol value to the 3rd slave instance
   - 2x Vertical SLI works and tested in both auto/manual, 3x SLI - only manual seems to work
Notes:
 - This code is 20x-30x faster (main for cycle is removed) especially on lower tfs with long history - only 2-3 sec load/redraw time vs 30-60 sec of the old Pro versions
 - Instead of repeatedly calculating the total sum of volumes for the whole range on each bar, vol sums are now increased on each bar and passed to the next in the range making it a per range vs per bar calculation that reduces time dramatically
 - hist_base for levels still results is ugly redraw
 - if you don't see a volume profile check range settings: min_level/max_level and spacing, set spacing to 0 (or adjust accordingly based on the symbol's precision, i.e. 0.00001)
 - you can view either of Buy/Sell/Total volumes, but you can't display Buy/Sell levels at the same time using a single instance (this would 2x reduce the number of levels). Use 2 indicator instances in horiz buy/sell sli mode for that.
 - Volume Profile/Value Area are calculated for a given range and updated on each bar. Each level has a fixed length. Offsets control visible level parts. Side Cover hides the invisible parts.
 - Custom Color for POC/VA/VWAP levels - UI Style color/transparency can only change shape's color and doesn't affect textcolor, hence this additional option
 - Custom Width - UI Style supports only width <= 4, hence this additional option
 - POC is visible in both modes. In VWAP mode Developing POC becomes VWAP, VA High and Low => VWAP High and Low correspondingly to minimize the number of plot outputs
 - You can't change buy/sell level colors from input (only plot transparency) - this requires 2x plot outputs => 2x reduces the number of levels to fit the max 64 limit. That's why 2 additional plots are used to dim the non Value Area zones
 - All buy/sell volume lengths are calculated as % of a fixed base width = 100 bars (100%). You can't set show_last from input to change it
 - There's no such thing as buy/sell volume, there's just volume, but for the purposes of the Volume Profile method, assume: bull candle = buy volume, bear candle = sell volume
P.S. Gravitonium Levels Are Increasing. Unobtainium is nowhere to be found!
Links on Volume Profile and Value Area calculation and usage:
www.tradingview.com
stockcharts.com
onlinelibrary.wiley.com
Bitfinex Margin ComparisonDisplays the RSI of Longs vs Shorts from Bitfinex for most majors ( BTC , ETH, LTC, XRP, EOS, NEO). 
Displays RSI of both longs and shorts to gauge the short term momentum of both while also showing the ratio of Longs vs Shorts as the background.
Premium ComparisonScript to display futures premium/discount vs basis; uses Bitmex XBTUSD 10.99% as basis vs XBTM18 and XBTU18 futures , but these are configurable.
ST_Trend_ReversalSTRONG TREND REVERSAL INDICATOR
The code is the percentage difference between the spot price of a given financial asset and its 200-day MA of that period. My standard setup is Daily, and I think it's got very good predictive power at that timeframe. 
It can be read in two ways:
1. Values extremely above or below the 200-period MA present chances of buying/selling agains the prevailing trend.
2. Values closely above or below the 200-period MA are make-or-break market periods, where a medium-term trend becomes evident. Breaks above or below the MA are associated with strong chances of directional movements. But it's not fool-proof as false breaks have become commonplace nowadays. 
Other way to use it is as confirmation of breakdowns: For example, an asset that loses its 200-day MA and then can't rally above it becomes exposed to steep losses afterwards.
It's also helpful to use in volatility trading: the closer the asset goes to its MA, the lower goes implied vol, and thus better opportiunities to be long volatility on those occasions where direction is hard to predict.
STRI = close/(200dMA)
Values over 100 indicate percentage premiums of spot vs its moving average.
Values below indicate percentage discounts of spot vs its moving average.
Ersoy-intersection(Kesisme)-Update-1website: www.ersoytoptas.com
Newspaper :  tr.investing.com
hi , Friends
i wanna be someone who wants to help everyone
updated my script he published some time ago.
What happened?
* intersection When ever Bar Color Yellow Be
* Alarms  to be more comprehensible
* Short and Long Days Choosing a Opportunities
* Source Opportunities
All Charts Usable(  Example ;15,30,60 ... vs) and ALL MARKETS ( Stocks , forex , ... vs)
i  strive to improve further
Easy to get
Best Time Slots — Auto-Adapt (v6, TF-safe) + Range AlertsTime & binning
Auto-adapt to timeframe
Makes all time windows scale to your chart’s bar size (so it “just works” on 1m, 15m, 4H, Daily).
• On = recommended. • Off = fixed default lengths.
Minimum Bin (minutes)
The size of each daily time slot we track (e.g., 5-min bins). The script uses the larger of this and your bar size.
• Higher = fewer, broader slots; smoother stats. • Lower = more, narrower slots; needs more history.
• Try: 5–15 on intraday, 60–240 on higher TFs.
Lookback windows (used when Auto-adapt = ON)
Target ER Window (minutes)
How far back we look to judge Efficiency Ratio (how “straight” the move was).
• Higher = stricter/smoother; fewer bars qualify as “movement”. • Lower = more sensitive.
• Try: 60–120 min intraday; 240–600 min for higher TFs.
Target ATR Window (minutes)
How far back we compute ATR (typical range).
• Higher = steadier ATR baseline. • Lower = reacts faster.
• Try: 30–120 min intraday; 240–600 min higher TFs.
Target Normalization Window (minutes)
How far back for the average ATR (the baseline we compare to).
• Higher = stricter “above average range” check. • Lower = easier to pass.
• Try: ~500–1500 min.
What counts as “movement”
ER Threshold (0–1)
Minimum efficiency a bar must have to count as movement.
• Higher = only very “clean, one-direction” bars count. • Lower = more bars count.
• Try: 0.55–0.65. (0.60 = balanced.)
ATR Floor vs SMA(ATR)
Requires range to be at least this many × average ATR.
• Higher (e.g., 1.2) = demand bigger-than-usual ranges. • Lower (e.g., 0.9) = allow smaller ranges.
• Try: 1.0 (above average).
How history is averaged
Recent Days Weight (per-day decay)
Gives more weight to recent days. Example: 0.97 ≈ each day old counts ~3% less.
• Higher (0.99) = slower fade (older days matter more). • Lower (0.95) = faster fade.
• Try: 0.97–0.99.
Laplace Prior Seen / Laplace Prior Hit
“Starter counts” so early stats aren’t crazy when you have little data.
• Higher priors = probabilities start closer to average; need more real data to move.
• Try: Seen=3, Hit=1 (defaults).
Min Samples (effective)
Don’t highlight a slot unless it has at least this many effective samples (after decay + priors).
• Higher = safer, but fewer highlights early.
• Try: 3–10.
When to highlight on the chart
Min Probability to Highlight
We shade/mark bars only if their slot’s historical movement probability is ≥ this.
• Higher = pickier, fewer highlights. • Lower = more highlights.
• Try: 0.45–0.60.
Show Markers on Good Bins
Draws a small square on bars that fall in a “good” slot (in addition to the soft background).
Limit to market hours (optional)
Restrict to Session + Session
Only learn/score inside this time window (e.g., “0930-1600”). Uses the chart/exchange timezone.
• Turn on if you only care about RTH.
Range (chop) alerts
Range START if ER ≤
Triggers range when efficiency drops below this level (price starts zig-zagging).
• Higher = easier to call “range”. • Lower = stricter.
Range START if ATR ≤ this × SMA(ATR)
Also triggers range when ATR shrinks below this fraction of its average (volatility contraction).
• Higher (e.g., 1.0) = stricter (must be at/under average). • Lower (e.g., 0.9) = easier to call range.
Alerts on bar close
If ON, alerts fire once per bar close (cleaner). If OFF, they can trigger intrabar (faster, noisier).
Quick “what happens if I change X?”
Want more highlighted times? ↓ Min Probability, ↓ ER Threshold, or ↓ ATR Floor (e.g., 0.9).
Want stricter highlights? ↑ Min Probability, ↑ ER Threshold, or ↑ ATR Floor (e.g., 1.2).
Want recent days to matter more? ↑ Recent Days Weight toward 0.99.
On 4H/Daily, widen Minimum Bin (e.g., 60–240) and maybe lower Min Probability a bit.
Ripster Clouds (EMA + MTF)v6🧠 Purpose
This indicator combines Ripster EMA Clouds and Multi-Timeframe (MTF) EMA Clouds into one script.
It allows you to visualize short vs long exponential (or simple) moving averages as colored “clouds” to identify trend direction and momentum — across both your current timeframe and a higher timeframe (e.g., daily).
⚙️ Main Features
1. EMA Clouds (Local Timeframe)
Up to 5 separate EMA/SMA cloud sets (8/9, 5/12, 34/50, 72/89, 180/200 by default).
Each can be individually enabled/disabled in the settings.
MA type toggle → Choose between EMA and SMA.
Optional line display toggle for showing the short and long MA lines.
Color-coded trend clouds:
Greenish tones = bullish (short > long)
Reddish tones = bearish (short < long)
Configurable leading offset and global offset for alignment.
2. MTF Clouds (Higher Timeframe)
Two sets of higher timeframe EMA clouds (default: 50/55 and 20/21).
Uses request.security() to pull EMA data from a selected higher timeframe (default = Daily).
Optional line visibility toggle (Display Lines).
Blue and teal semi-transparent fills to distinguish from local clouds.
Each MTF cloud can be toggled independently.
3. Unified Controls
Master toggles:
✅ Show EMA Clouds
✅ Show MTF Clouds
Transparent cloud fills with dynamically changing colors based on EMA crossovers and slope.
No local-scope plot() or fill() calls — fully compliant with Pine v6 rules.
🎨 Color Logic
Each EMA cloud uses a unique color pair (5 total).
Cloud color changes dynamically based on whether the short EMA is above or below the long EMA.
Line color changes with slope:
Olive = EMA rising
Maroon = EMA falling
📊 Technical Structure
Written in Pine Script v6.
All plot() and fill() calls are at global scope to prevent compilation errors.
Uses helper functions only for math/color logic.
Performance-optimized for TradingView’s rendering limits.
🧩 Quick Setup in TradingView
Paste the script into the Pine Editor.
Add to chart.
In settings:
Toggle on/off any EMA or MTF clouds.
Adjust timeframe (Resolution), line visibility, or offsets.
Choose EMA or SMA as the base calculation.
✅ Result
You now have one unified, customizable Ripster EMA + MTF Cloud indicator, stable in Pine v6, with complete flexibility to toggle, style, and analyze multiple timeframe trends on a single chart.
Tri-Align Crypto Trend (EMA + Slope)**Tri-Align Crypto Trend (EMA + Slope)**
Quickly see whether your coin is trending *with* Bitcoin. The indicator evaluates three pairs—**COIN/USDT**, **BTC/USDT**, and **COIN/BTC**—using a fast/slow EMA crossover plus the fast EMA’s slope. Each pair is tagged **Bullish / Bearish / Neutral** in a compact, color-coded table. Alerts fire when **all three** trends align (all bullish or all bearish).
**How to use**
1. Add the indicator to any crypto chart.
2. Set the three symbols (defaults: BNB/USDT, BTC/USDT, BNB/BTC) and optionally choose a signal timeframe.
3. Tune **Fast EMA**, **Slow EMA**, **Slope Lookback**, and **Min |Slope| %** to filter noise and require stronger momentum.
4. Create alerts: *Add alert →* choose the indicator and select **All Three Bullish**, **All Three Bearish**, or **All Three Aligned**.
**Logic**
* Bullish: `EMA_fast > EMA_slow` **and** fast EMA slope ≥ threshold
* Bearish: `EMA_fast < EMA_slow` **and** fast EMA slope ≤ −threshold
* Otherwise: Neutral
Tip: The **COIN/BTC** row reflects relative strength vs BTC—use it to avoid chasing coins that lag the benchmark. (For educational purposes; not financial advice.)
Tri-Align Crypto Trend (EMA + Slope)**Tri-Align Crypto Trend (EMA + Slope)**
Quickly see whether your coin is trending *with* Bitcoin. The indicator evaluates three pairs—**COIN/USDT**, **BTC/USDT**, and **COIN/BTC**—using a fast/slow EMA crossover plus the fast EMA’s slope. Each pair is tagged **Bullish / Bearish / Neutral** in a compact, color-coded table. Alerts fire when **all three** trends align (all bullish or all bearish).
**How to use**
1. Add the indicator to any crypto chart.
2. Set the three symbols (defaults: BNB/USDT, BTC/USDT, BNB/BTC) and optionally choose a signal timeframe.
3. Tune **Fast EMA**, **Slow EMA**, **Slope Lookback**, and **Min |Slope| %** to filter noise and require stronger momentum.
4. Create alerts: *Add alert →* choose the indicator and select **All Three Bullish**, **All Three Bearish**, or **All Three Aligned**.
**Logic**
* Bullish: `EMA_fast > EMA_slow` **and** fast EMA slope ≥ threshold
* Bearish: `EMA_fast < EMA_slow` **and** fast EMA slope ≤ −threshold
* Otherwise: Neutral
Tip: The **COIN/BTC** row reflects relative strength vs BTC—use it to avoid chasing coins that lag the benchmark. (For educational purposes; not financial advice.)
Percentile Rank Oscillator (Price + VWMA)A statistical oscillator designed to identify potential market turning points using percentile-based price analytics and volume-weighted confirmation. 
 What is PRO? 
Percentile Rank Oscillator measures how extreme current price behavior is relative to its own recent history. It calculates a rolling percentile rank of price midpoints and VWMA deviation (volume-weighted price drift). When price reaches historically rare levels – high or low percentiles – it may signal exhaustion and potential reversal conditions.
 How it works 
 
 Takes midpoint of each candle ((H+L)/2)
 Ranks the current value vs previous N bars using rolling percentile rank
 Maps percentile to a normalized oscillator scale (-1..+1 or 0–100)
 Optionally evaluates VWMA deviation percentile for volume-confirmed signals
 Highlights extreme conditions and confluence zones
 
 Why percentile rank? 
Median-based percentiles ignore outliers and read the market statistically – not by fixed thresholds. Instead of guessing “overbought/oversold” values, the indicator adapts to current volatility and structure.
 Key features 
 
 Rolling percentile rank of price action
 Optional VWMA-based percentile confirmation
 Adaptive, noise-robust structure
 User-selectable thresholds (default 95/5)
 Confluence highlighting for price + VWMA extremes
 Optional smoothing (RMA)
 Visual extreme zone fills for rapid signal recognition
 
 How to use 
 
 High percentile values –> statistically extreme upward deviation (potential top)
 Low percentile values –> statistically extreme downward deviation (potential bottom)
 Price + VWMA confluence strengthens reversal context
 Best used as part of a broader trading framework (market structure, order flow, etc.)
 
 Tip:  Look for percentile spikes at key HTF levels, after extended moves, or where liquidity sweeps occur. Strong moves into rare percentile territory may precede mean reversion.
 Suggested settings 
 
 Default length: 100 bars
 Thresholds: 95 / 5
 Smoothing: 1–3 (optional)
 
 Important note 
This tool does not predict direction or guarantee outcomes. It provides statistical context for price extremes to help traders frame probability and timing. Always combine with sound risk management and other tools.
FVG MagicFVG Magic — Fair Value Gaps with Smart Mitigation, Inversion & Auto-Clean-up
FVG Magic finds every tradable Fair Value Gap (FVG), shows who powered it, and then manages each gap intelligently as price interacts with it—so your chart stays actionable and clean.
Attribution
This tool is inspired by the idea popularized in “Volumatic Fair Value Gaps  ” by BigBeluga (licensed CC BY-NC-SA 4.0). Credit to BigBeluga for advancing FVG visualization in the community.
Important: This is a from-scratch implementation—no code was copied from the original. I expanded the concept substantially with a different detection stack, a gap state machine (ACTIVE → 50% SQ → MITIGATED → INVERSED), auto-clean up rules, lookback/nearest-per-side pruning, zoom-proof volume meters, and timeframe auto-tuning for 15m/H1/H4.
What makes this version more accurate
Full-coverage detection (no “missed” gaps)
Default ICT-minimal rule (Bullish: low > high , Bearish: high < low ) catches all valid 3-candle FVGs.
Optional Strict filter (stricter structure checks) for traders who prefer only “clean” gaps.
Optional size percentile filter—off by default so nothing is hidden unless you choose to filter.
Correct handling of confirmations (wick vs close)
Mitigation Source is user-selectable: high/low (wick-based) or close (strict).
This avoids false “misses” when you expect wick confirmations (50% or full fill) but your logic required closes.
State-aware labelling to prevent misleading data
The Bull%/Bear% meter is shown only while a gap is ACTIVE.
As soon as a gap is 50% SQ, MITIGATED, or INVERSED, the meter is hidden and replaced with a clear tag—so you never read stale participation stats.
Robust zoom behaviour
The meter uses a fixed bar-width (not pixels), so it stays proportional and readable at any zoom level.
Deterministic lifecycle (no stale boxes)
Remove on 50% SQ (instant or delayed).
Inversion window after first entry: if price enters but doesn’t invert within N bars, the box auto-removes once fully filled.
Inversion clean up: after a confirmed flip, keep for N bars (context) then delete (or 0 = immediate).
Result: charts auto-maintain themselves and never “lie” about relevance.
Clarity near current price
Nearest-per-side (keep N closest bullish & bearish gaps by distance to the midpoint) focuses attention where it matters without altering detection accuracy.
Lookback (bars) ensures reproducible behaviour across accounts with different data history.
Timeframe-aware defaults
Sensible auto-tuning for 15m / H1 / H4 (right-extension length, meter width, inversion windows, clean up bars) to reduce setup friction and improve consistency.
What it does (under the hood)
Detects FVGs using ICT-minimal (default) or a stricter rule.
Samples volume from a 10× lower timeframe to split participation into Bull % / Bear % (sum = 100%).
Manages each gap through a state machine:
ACTIVE → 50% SQ (midline) → MITIGATED (full) → INVERSED (SR flip after fill).
Auto-clean up keeps only relevant levels, per your rules.
Dashboard (top-right) displays counts by side and the active state tags.
How to use it
First run (show everything)
Use Strict FVG Filter: OFF
Enable Size Filter (percentile): OFF
Mitigation Source: high/low (wick-based) or close (stricter), as you prefer.
Remove on 50% SQ: ON, Delay: 0
Read the context
While ACTIVE, use the Bull%/Bear% meter to gauge demand/supply behind the impulse that created the gap.
Confluence with your HTF structure, sessions, VWAP, OB/FVG, RSI/MACD, etc.
Trade interactions
50% SQ: often the highest-quality interaction; if removal is ON, the box clears = “job done.”
Full mitigation then rejection through the other side → tag changes to INVERSED (acts like SR). Keep for N bars, then auto-remove.
Keep the chart tidy (optional)
If too busy, enable Size Filter or set Nearest per side to 2–4.
Use Lookback (bars) to make behaviour consistent across symbols and histories.
Inputs (key ones)
Use Strict FVG Filter: OFF(default)/ON
Enable Size Filter (percentile): OFF(default)/ON + threshold
Mitigation Source: high/low or close
Remove on 50% SQ + Delay
Inversion window after entry (bars)
Remove inversed after (bars)
Lookback (bars), Nearest per side (N)
Right Extension Bars, Max FVGs, Meter width (bars)
Colours: Bullish, Bearish, Inversed fill
Suggested defaults (per TF)
15m: Extension 50, Max 12, Inversion window 8, Clean up 8, Meter width 20
H1: Extension 25, Max 10, Inversion window 6, Clean up 6, Meter width 15
H4: Extension 15, Max 8, Inversion window 5, Clean up 5, Meter width 10
Notes & edge cases
If a wick hits 50% or the far edge but state doesn’t change, you’re likely on close mode—switch to high/low for wick-based behaviour.
If a gap disappears, it likely met a clean up condition (50% removal, inversion window, inversion clean up, nearest-per-side, lookback, or max-cap).
Meters are hidden after ACTIVE to avoid stale percentages.
Rolling Correlation vs Another Symbol (SPY Default)This indicator visualizes the rolling correlation between the current chart symbol and another selected asset, helping traders understand how closely the two move together over time.
It calculates the Pearson correlation coefficient over a user-defined period (default 22 bars) and plots it as a color-coded line:
	•	Green line → positive correlation (move in the same direction)
	•	Red line → negative correlation (move in opposite directions)
	•	A gray dashed line marks the zero level (no correlation).
The background highlights periods of strong relationship:
	•	Light green when correlation > +0.7 (strong positive)
	•	Light red when correlation < –0.7 (strong negative)
Use this tool to quickly spot diversification opportunities, confirm hedges, or understand how assets interact during different market regimes.
RSI MT5-Style RSI Zones (20/30/70/80) with Signals & Alerts
Description (English first)
What it does
This script reproduces an MT5-style RSI with four-level zones (20/30/70/80) to better distinguish early/late overbought-oversold conditions. It highlights zone transitions, plots optional background shading, and triggers entry/exit alerts on precise crossings.
How it works (high-level logic)
Core is Wilder’s RSI on close (length = ).
Two oversold bands at 20 and 30; two overbought bands at 70 and 80.
Optional smoothing (), and MTF confirmation (optional) compares current RSI vs a higher timeframe RSI.
Signals:
Long setup: RSI crosses above 20 (early) or 30 (conservative); confirmation if higher-TF RSI is rising.
Take-profit / exit: RSI fails to hold above 70 or crosses below 70 after being >80.
Short setup: mirror logic with 70/80 → 30/20.
Inputs
RSI Length (<14>), Source (close)
Upper Bands (70, 80), Lower Bands (30, 20)
Smoothing ( on RSI, optional)
Higher Timeframe (), Confirm with HTF (on/off)
Background Zones (on/off), Alerts (on/off)
How to use
Choose your market/timeframe. For FX/indices, M5–H1 works well; for swing, H1–H4.
Pick your aggressiveness: use 20/80 for early reversals, 30/70 for conservative trend pullbacks.
With MTF confirmation on, prioritize entries aligned with the higher timeframe RSI slope.
Combine with structure (S/R) or a simple MA filter for trend direction.
Originality & usefulness
Unlike generic RSI scripts, this version provides dual-zone logic (20/30/70/80) with clear visual states, optional HTF confirmation, and ready-made alerts designed to match MetaTrader-like RSI workflows. It is not a direct clone of public open-source scripts; zone handling and alert conditions are purpose-built for timing pullbacks vs. extremes.
Best markets & limitations
Works on FX, gold (XAUUSD), and indices (US30/NAS100).
In strong trends, overbought/oversold can persist—use bands as context, not standalone signals.
Spikes around news can cause false triggers—consider widening bands or disabling trades near events.
Alerts included
RSI Crosses Above 20, RSI Crosses Above 30
RSI Crosses Below 70, RSI Crosses Below 80
MTF Confirmed Long/Short (optional)
User interface translations (if your UI is in Spanish)
RSI Length → Periodo RSI
Upper Bands → Bandas Superiores
Lower Bands → Bandas Inferiores
Smoothing → Suavizado
Higher Timeframe → Marco Temporal Superior
Confirm with HTF → Confirmar con MTS
Background Zones → Zonas de Fondo
Alerts → Alertas
Disclaimer
This tool is for educational purposes. Not financial advice.
Buying/Selling PressureBuying/Selling Pressure - Volume-Based Market Sentiment 
Buying/Selling Pressure identifies market dominance by separating volume into buying and selling components. The indicator uses Volume ATR normalization to create a universal pressure oscillator that works consistently across all markets and timeframes.
 What is Buying/Selling Pressure? 
This indicator answers a fundamental question: Are buyers or sellers in control? By analyzing how volume distributes within each bar, it calculates cumulative buying and selling pressure, then normalizes the result using Volume ATR for cross-market comparability.
 Formula:    × 100
Where Delta = Buying Volume - Selling Volume
 Calculation Methods 
 Money Flow (Recommended): 
Volume weighted by close position in bar range. Close near high = buying pressure, close near low = selling pressure.
Formula:   / (high - low)
 Simple Delta: 
Basic approach where bullish bars = 100% buying, bearish bars = 100% selling.
 Weighted Delta: 
Volume weighted by body size relative to total range, focusing on candle strength.
 Key Features 
 
 Volume ATR Normalization:  Adapts to volume volatility for consistent readings across assets
 Cumulative Delta:  Tracks net buying/selling pressure over time (similar to OBV)
 Signal Line:  EMA smoothing for trend identification and crossover signals
 Zero Line:  Clear visual separation between buyer and seller dominance
 Color-Coded Display:  Green area = buyers control, red area = sellers control
 
 Interpretation 
 Above Zero:  Buyers dominating - cumulative buying pressure exceeds selling
 Below Zero:  Sellers dominating - cumulative selling pressure exceeds buying
 Cross Signal Line:  Momentum shift - pressure trend changing direction
 Increasing Magnitude:  Strengthening pressure in current direction
 Decreasing Magnitude:  Weakening pressure, potential reversal
 Volume vs Pressure 
High volume with low pressure indicates balanced battle between buyers and sellers. High pressure with high volume confirms strong directional conviction. This separation provides insights beyond traditional volume analysis.
 Best Practices 
 
 Use with price action for confirmation
 Divergences signal potential reversals (price makes new high/low but pressure doesn't)
 Large volume with near-zero pressure = indecision, breakout preparation
 Signal line crossovers provide momentum change signals
 Extreme readings suggest potential exhaustion
 
 Settings 
 
 Calculation Method:  Choose Money Flow, Simple Delta, or Weighted Delta
 EMA Length:  Period for cumulative delta smoothing (default: 21)
 Signal Line:  Optional EMA of oscillator for crossover signals (default: 9)
 
Buying/Selling Pressure transforms volume analysis into actionable market sentiment, revealing whether buyers or sellers control price action beneath surface volatility.
 This indicator is designed for educational and analytical purposes. Past performance does not guarantee future results. Always conduct thorough research and consider consulting with financial professionals before making investment decisions. 
🔥 QUANT MOMENTUM SKORQUANT MOMENTUM SCORE – Description (EN)
Summary: This indicator fuses Price ROC, RSI, MACD, Trend Strength (ADX+EMA) and Volume into a single 0-100 “Momentum Score.” Guide bands (50/60/70/80) and ready-to-use alert conditions are included. 
How it works
Price Momentum (ROC): Rate of change normalized to 0-100.
RSI Momentum: RSI treated as a momentum proxy and mapped to 0-100.
MACD Momentum: MACD histogram normalized to capture acceleration.
Trend Strength: ADX is direction-aware (DI+ vs DI–) and blended with EMA state (above/below) to form a combined trend score.
Volume Momentum: Volume relative to its moving average (ratio-based).
Weighting: All five components are weighted, auto-normalized, and summed into the final 0-100 score.
Visuals & Alerts: Score line with 50/60/70/80 guides; threshold-cross alerts for High/Strong/Ultra-Strong regimes. 
Inputs, weights and thresholds are configurable; total weights are normalized automatically. 
How to use
Timeframes: Works on any timeframe—lower TFs react faster; higher TFs reduce noise.
Reading the score:
<50: Weak momentum
50-60: Transition
60-70: Moderate-Strong (potential acceleration)
≥70: Strong, ≥80: Ultra Strong
Practical tip: Use it as a filter, not a stand-alone signal. Combine score breakouts with market structure/trend context (e.g., pullback-then-re-acceleration) to improve selectivity.
Disclaimer: This is not financial advice; past performance does not guarantee future results.
5x Relative Volume vs 30-Day AverageRelative Volume.
If today's volume is more than average of last 30 days volume by 5x.
Up vs Down Volume  Compared to PriceHi team,
I’ve put together a simple TradingView indicator that breaks down the last N candles into up-moves and down-moves, showing how much volume supported each side. It helps you quickly see whether the market is rallying on strong participation or just drifting higher on weak volume.
The tool tracks total up-volume versus down-volume, compares their ratios, and flags when pullbacks are happening with noticeably lower volume than the prior push up — a setup that often signals a healthy continuation rather than a reversal.
It also shows key metrics like total volume, price change, and up/down ratios directly on the chart for quick assessment. You’ll instantly know if you’re looking at a light-volume pullback or a heavy-volume sell-off.
Let’s test it out across a few symbols and discuss any tweaks we’d like — maybe layering an EMA or VWAP filter for cleaner trend confirmation.
Double Weighted Moving Average (DWMA)# DWMA: Double Weighted Moving Average
## Overview and Purpose
The Double Weighted Moving Average (DWMA) is a technical indicator that applies weighted averaging twice in sequence to create a smoother signal with enhanced noise reduction. Developed in the late 1990s as an evolution of traditional weighted moving averages, the DWMA was created by quantitative analysts seeking enhanced smoothing without the excessive lag typically associated with longer period averages. By applying a weighted moving average calculation to the results of an initial weighted moving average, DWMA achieves more effective filtering while preserving important trend characteristics.
## Core Concepts
* **Cascaded filtering:** DWMA applies weighted averaging twice in sequence for enhanced smoothing and superior noise reduction
* **Linear weighting:** Uses progressively increasing weights for more recent data in both calculation passes
* **Market application:** Particularly effective for trend following strategies where noise reduction is prioritized over rapid signal response
* **Timeframe flexibility:** Works across multiple timeframes but particularly valuable on daily and weekly charts for identifying significant trends
The core innovation of DWMA is its two-stage approach that creates more effective noise filtering while minimizing the additional lag typically associated with longer-period or higher-order filters. This sequential processing creates a more refined output that balances noise reduction and signal preservation better than simply increasing the length of a standard weighted moving average.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback period for both WMA calculations | Increase for smoother signals in volatile markets, decrease for more responsiveness |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For trend following, use a length of 10-14 with DWMA instead of a single WMA with double the period - this provides better smoothing with less lag than simply increasing the period of a standard WMA.
## Calculation and Mathematical Foundation
**Simplified explanation:**
DWMA first calculates a weighted moving average where recent prices have more importance than older prices. Then, it applies the same weighted calculation again to the results of the first calculation, creating a smoother line that reduces market noise more effectively.
**Technical formula:**
```
DWMA is calculated by applying WMA twice:
1. First WMA calculation:
   WMA₁ = (P₁ × w₁ + P₂ × w₂ + ... + Pₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
2. Second WMA calculation applied to WMA₁:
   DWMA = (WMA₁₁ × w₁ + WMA₁₂ × w₂ + ... + WMA₁ₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
```
Where:
- Linear weights: most recent value has weight = n, second most recent has weight = n-1, etc.
- n is the period length
- Sum of weights = n(n+1)/2
**O(1) Optimization - Inline Dual WMA Architecture:**
This implementation uses an advanced O(1) algorithm with two complete inline WMA calculations. Each WMA uses the dual running sums technique:
1. **First WMA (source → wma1)**:
   - Maintains buffer1, sum1, weighted_sum1
   - Recurrence: `W₁_new = W₁_old - S₁_old + (n × P_new)`
   - Cached denominator norm1 after warmup
2. **Second WMA (wma1 → dwma)**:
   - Maintains buffer2, sum2, weighted_sum2
   - Recurrence: `W₂_new = W₂_old - S₂_old + (n × WMA₁_new)`
   - Cached denominator norm2 after warmup
**Implementation details:**
- Both WMAs fully integrated inline (no helper functions)
- Each maintains independent state: buffers, sums, counters, norms
- Both warm up independently from bar 1
- Performance: ~16 operations per bar regardless of period (vs ~10,000 for naive O(n²) implementation)
**Why inline architecture:**
Unlike helper functions, the inline approach makes all state variables and calculations visible in a single scope, eliminating function call overhead and making the dual-pass nature explicit. This is ideal for educational purposes and when debugging complex cascaded filters.
> 🔍 **Technical Note:** The dual-pass O(1) approach creates a filter that effectively increases smoothing without the quadratic increase in computational cost. Original O(n²) implementations required ~10,000 operations for period=100; this optimized version requires only ~16 operations, achieving a 625x speedup while maintaining exact mathematical equivalence.
## Interpretation Details
DWMA can be used in various trading strategies:
* **Trend identification:** The direction of DWMA indicates the prevailing trend
* **Signal generation:** Crossovers between price and DWMA generate trade signals, though they occur later than with single WMA
* **Support/resistance levels:** DWMA can act as dynamic support during uptrends and resistance during downtrends
* **Trend strength assessment:** Distance between price and DWMA can indicate trend strength
* **Noise filtering:** Using DWMA to filter noisy price data before applying other indicators
## Limitations and Considerations
* **Market conditions:** Less effective in choppy, sideways markets where its lag becomes a disadvantage
* **Lag factor:** More lag than single WMA due to double calculation process
* **Initialization requirement:** Requires more data points for full calculation, showing more NA values at chart start
* **Short-term trading:** May miss short-term trading opportunities due to increased smoothing
* **Complementary tools:** Best used with momentum oscillators or volume indicators for confirmation
## References
* Jurik, M. "Double Weighted Moving Averages: Theory and Applications in Algorithmic Trading Systems", Jurik Research Papers, 2004
* Ehlers, J.F. "Cycle Analytics for Traders," Wiley, 2013
Weighted Moving Average (WMA)This implementation uses O(1) algorithm that eliminates the need to loop through all period values on each bar. It also generates valid WMA values from the first bar and is not returning NA when number of bars is less than period.
## Overview and Purpose
The Weighted Moving Average (WMA) is a technical indicator that applies progressively increasing weights to more recent price data. Emerging in the early 1950s during the formative years of technical analysis, WMA gained significant adoption among professional traders through the 1970s as computational methods became more accessible. The approach was formalized in Robert Colby's 1988 "Encyclopedia of Technical Market Indicators," establishing it as a staple in technical analysis software. Unlike the Simple Moving Average (SMA) which gives equal weight to all prices, WMA assigns greater importance to recent prices, creating a more responsive indicator that reacts faster to price changes while still providing effective noise filtering.
## Core Concepts
* **Linear weighting:** WMA applies progressively increasing weights to more recent price data, creating a recency bias that improves responsiveness
* **Market application:** Particularly effective for identifying trend changes earlier than SMA while maintaining better noise filtering than faster-responding averages like EMA
* **Timeframe flexibility:** Works effectively across all timeframes, with appropriate period adjustments for different trading horizons
The core innovation of WMA is its linear weighting scheme, which strikes a balance between the equal-weight approach of SMA and the exponential decay of EMA. This creates an intuitive and effective compromise that prioritizes recent data while maintaining a finite lookback period, making it particularly valuable for traders seeking to reduce lag without excessive sensitivity to price fluctuations.
## Common Settings and Parameters
| Parameter | Default | Function | When to Adjust |
|-----------|---------|----------|---------------|
| Length | 14 | Controls the lookback period | Increase for smoother signals in volatile markets, decrease for responsiveness |
| Source | close | Price data used for calculation | Consider using hlc3 for a more balanced price representation |
**Pro Tip:** For most trading applications, using a WMA with period N provides better responsiveness than an SMA with the same period, while generating fewer whipsaws than an EMA with comparable responsiveness.
## Calculation and Mathematical Foundation
**Simplified explanation:**
WMA calculates a weighted average of prices where the most recent price receives the highest weight, and each progressively older price receives one unit less weight. For example, in a 5-period WMA, the most recent price gets a weight of 5, the next most recent a weight of 4, and so on, with the oldest price getting a weight of 1.
**Technical formula:**
```
WMA = (P₁ × w₁ + P₂ × w₂ + ... + Pₙ × wₙ) / (w₁ + w₂ + ... + wₙ)
```
Where:
- Linear weights: most recent value has weight = n, second most recent has weight = n-1, etc.
- The sum of weights for a period n is calculated as: n(n+1)/2
- For example, for a 5-period WMA, the sum of weights is 5(5+1)/2 = 15
**O(1) Optimization - Dual Running Sums:**
The key insight is maintaining two running sums:
1. **Unweighted sum (S)**: Simple sum of all values in the window
2. **Weighted sum (W)**: Sum of all weighted values
The recurrence relation for a full window is:
```
W_new = W_old - S_old + (n × P_new)
```
This works because when all weights decrement by 1 (as the window slides), it's mathematically equivalent to subtracting the entire unweighted sum. The implementation:
- **During warmup**: Accumulates both sums as the window fills, computing denominator each bar
- **After warmup**: Uses cached denominator (constant at n(n+1)/2), updates both sums in constant time
- **Performance**: ~8 operations per bar regardless of period, vs ~100+ for naive O(n) implementation
> 🔍 **Technical Note:** Unlike EMA which theoretically considers all historical data (with diminishing influence), WMA has a finite memory, completely dropping prices that fall outside its lookback window. This creates a cleaner break from outdated market conditions. The O(1) optimization achieves 12-25x speedup over naive implementations while maintaining exact mathematical equivalence.
## Interpretation Details
WMA can be used in various trading strategies:
* **Trend identification:** The direction of WMA indicates the prevailing trend with greater responsiveness than SMA
* **Signal generation:** Crossovers between price and WMA generate trade signals earlier than with SMA
* **Support/resistance levels:** WMA can act as dynamic support during uptrends and resistance during downtrends
* **Moving average crossovers:** When a shorter-period WMA crosses above a longer-period WMA, it signals a potential uptrend (and vice versa)
* **Trend strength assessment:** Distance between price and WMA can indicate trend strength
## Limitations and Considerations
* **Market conditions:** Still suboptimal in highly volatile or sideways markets where enhanced responsiveness may generate false signals
* **Lag factor:** While less than SMA, still introduces some lag in signal generation
* **Abrupt window exit:** The oldest price suddenly drops out of calculation when leaving the window, potentially causing small jumps
* **Step changes:** Linear weighting creates discrete steps in influence rather than a smooth decay
* **Complementary tools:** Best used with volume indicators and momentum oscillators for confirmation
## References
* Colby, Robert W. "The Encyclopedia of Technical Market Indicators." McGraw-Hill, 2002
* Murphy, John J. "Technical Analysis of the Financial Markets." New York Institute of Finance, 1999
* Kaufman, Perry J. "Trading Systems and Methods." Wiley, 2013






















