Historical VolatilityHistorical Volatility Indicator with Custom Trading Sessions
Overview
This indicator calculates **annualized Historical Volatility (HV)** using logarithmic returns and standard deviation. Unlike standard HV indicators, this version allows you to **customize trading sessions and holidays** for different markets, ensuring accurate volatility calculations for options pricing and risk management.
Key Features
✅ Custom Trading Sessions - Define multiple trading sessions per day with precise start/end times
✅ Multiple Markets Support - Pre-configured for US, Russian, European, and crypto markets
✅ Clearing Periods Handling - Account for intraday clearing breaks
✅ Flexible Calendar - Set trading days per year for different countries
✅ All Timeframes - Works correctly on intraday, daily, weekly, and monthly charts
✅ Info Table - Optional display showing calculation parameters
How It Works
The indicator uses the classical volatility formula:
σ_annual = σ_period × √(periods per year)
Where:
- σ_period = Standard deviation of logarithmic returns over the specified period
- Periods per year = Calculated based on actual trading time (not calendar time)
Calculation Method
1. Computes log returns: ln(close / close )
2. Calculates standard deviation over the lookback period
3. Annualizes using the square root rule with accurate period count
4. Displays as percentage
Settings
Calculation
- Period (default: 10) - Lookback period for volatility calculation
Trading Schedule
- Trading Days Per Year (default: 252) - Number of actual trading days
- USA: 252
- Russia: 247-250
- Europe: 250-253
- Crypto (24/7): 365
- Trading Sessions - Define trading hours in format: `hh:mm:ss-hh:mm:ss, hh:mm:ss-hh:mm:ss`
Display
- Show Info Table - Shows calculation parameters in real-time
Market Presets
United States (NYSE/NASDAQ)
Trading Sessions: 09:30:00-16:00:00
Trading Days Per Year: 252
Trading Minutes Per Day: 390
Russia (MOEX)
Trading Sessions: 10:00:00-14:00:00, 14:05:00-18:40:00
Trading Days Per Year: 248
Trading Minutes Per Day: 515
Europe (LSE)
Trading Sessions: 08:00:00-16:30:00
Trading Days Per Year: 252
Trading Minutes Per Day: 510
Germany (XETRA)
Trading Sessions: 09:00:00-17:30:00
Trading Days Per Year: 252
Trading Minutes Per Day: 510
Cryptocurrency (24/7)
Trading Sessions: 00:00:00-23:59:59
Trading Days Per Year: 365
Trading Minutes Per Day: 1440
Use Cases
Options Trading
- Compare HV vs IV - Historical volatility compared to implied volatility helps identify mispriced options
- Volatility mean reversion - Identify when volatility is unusually high or low
- Straddle/strangle selection - Choose optimal strikes based on historical movement
Risk Management
- Position sizing - Adjust position size based on current volatility
- Stop-loss placement - Set stops based on expected price movement
- Portfolio volatility - Monitor individual asset volatility contribution
Market Analysis
- Regime identification - Detect transitions between low and high volatility environments
- Cross-market comparison - Compare volatility across different assets and markets
Why Accurate Trading Hours Matter
Standard HV indicators assume 24-hour trading or use simplified day counts, leading to significant errors in annualized volatility:
- 5-minute chart error : Can be off by 50%+ if using wrong period count
- Options pricing impact : Even 2-3% HV error affects option values substantially
- Intraday vs overnight : Correctly excludes non-trading periods
This indicator ensures your HV calculations match the methodology used in professional options pricing models.
Technical Notes
- Uses actual trading minutes, not calendar days
- Handles multiple clearing periods within a single trading day
- Properly scales volatility across all timeframes
- Logarithmic returns for more accurate volatility measurement
- Compatible with Pine Script v6
Author Notes: This indicator was designed specifically for options traders who need precise volatility measurements across different global markets. The customizable trading sessions ensure your HV calculations align with actual market hours and industry-standard options pricing models.
Indicateurs et stratégies
MGG_FX//@version=5
indicator('MGG_FX', overlay=true, max_bars_back=1000, max_labels_count=500, max_lines_count=500, max_boxes_count=500)
var GRP1 = "ASIAN RANGE"
showLines = input(title='Show Lines', defval=true, group=GRP1)
showBackground = input(title='Show Background', defval=true, group=GRP1)
showMiddleLine = input(title='Show Middle Line', defval=true, group=GRP1)
extendLines = input(title='Extend Line', defval=true, group=GRP1)
rangeTime = input.session(title='Session Time', defval='1700-0100', group=GRP1)
extendTime = input.session(title='Extend Until', defval='0100-0500', group=GRP1)
linesWidth = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP1)
boxLineColor = input(color.new(#434651,50), 'Box Line Color', group=GRP1)
middleLineColor = input(color.new(#434651,50), 'Middle Line Color', group=GRP1)
backgroundColor = input(color.new(#9598a1,90), 'Box Background Color', group=GRP1)
var GRP5 = "LONDON"
showLines4 = input(title='Show Lines', defval=true, group=GRP5)
showBackground4 = input(title='Show Background', defval=true, group=GRP5)
rangeTime4 = input.session(title='Session Time', defval='0300-0400', group=GRP5)
linesWidth4 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP5)
boxLineColor4 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP5)
backgroundColor4 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP5)
var GRP6 = "NEWYORK"
showLines5 = input(title='Show Lines', defval=true, group=GRP6)
showBackground5 = input(title='Show Background', defval=true, group=GRP6)
rangeTime5 = input.session(title='Session Time', defval='0900-1000', group=GRP6)
linesWidth5 = input.int(1, 'Box And Lines Width', minval=1, maxval=4, group=GRP6)
boxLineColor5 = input(color.new(#b2b5be, 95), 'Box Line Color', group=GRP6)
backgroundColor5 = input(color.new(#b2b5be, 90), 'Box Background Color', group=GRP6)
////////////////////////////////////////////
inSession = not na(time(timeframe.period, rangeTime))
inExtend = not na(time(timeframe.period, extendTime))
startTime = 0
startTime := inSession and not inSession ? time : startTime
//Box lines
var line lowHLine = na
var line topHLine = na
var line leftVLine = na
var line rightVLine = na
var line middleHLine = na
var box bgBox = na
var low_val = 0.0
var high_val = 0.0
if inSession and not inSession
low_val := low
high_val := high
high_val
// Plot lines
if inSession and timeframe.isintraday
if inSession
line.delete(lowHLine)
line.delete(topHLine)
line.delete(leftVLine)
line.delete(rightVLine)
line.delete(middleHLine)
box.delete(bgBox)
if low < low_val
low_val := low
low_val
if high > high_val
high_val := high
high_val
//Create Box
//x1, y1, x2, y2
if showBackground
bgBox := box.new(startTime, high_val, time, low_val, xloc=xloc.bar_time, bgcolor=backgroundColor, border_width=0)
if showLines
lowHLine := line.new(startTime, low_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
topHLine := line.new(startTime, high_val, time, high_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
leftVLine := line.new(startTime, high_val, startTime, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
rightVLine := line.new(time, high_val, time, low_val, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
//Create Middle line
if showMiddleLine
middleHLine := line.new(startTime, (high_val + low_val) / 2, time, (high_val + low_val) / 2, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
else
if inExtend and extendLines and not inSession and timeframe.isintraday
time1 = line.get_x1(lowHLine)
time2 = line.get_x2(lowHLine)
price = line.get_y1(lowHLine)
line.delete(lowHLine)
lowHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(topHLine)
time2 := line.get_x2(topHLine)
price := line.get_y1(topHLine)
line.delete(topHLine)
topHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=boxLineColor, style=line.style_solid, width=linesWidth)
time1 := line.get_x1(middleHLine)
time2 := line.get_x2(middleHLine)
price := line.get_y1(middleHLine)
line.delete(middleHLine)
middleHLine := line.new(time1, price, time, price, xloc=xloc.bar_time, color=middleLineColor, style=line.style_solid, width=linesWidth)
middleHLine
////////////////////////////////////////////
inSession4 = not na(time(timeframe.period, rangeTime4))
startTime4 = 0
startTime4 := inSession4 and not inSession4 ? time : startTime4
//Box lines
var line lowHLine4 = na
var line topHLine4 = na
var line leftVLine4 = na
var line rightVLine4 = na
var line middleHLine4 = na
var box bgBox4 = na
var low_val4 = 0.0
var high_val4 = 0.0
if inSession4 and not inSession4
low_val4 := low
high_val4 := high
high_val4
// Plot lines
if inSession4 and timeframe.isintraday
if inSession4
line.delete(lowHLine4)
line.delete(topHLine4)
line.delete(leftVLine4)
line.delete(rightVLine4)
line.delete(middleHLine4)
box.delete(bgBox4)
if low < low_val4
low_val4 := low
low_val4
if high > high_val4
high_val4 := high
high_val4
//Create Box
//x1, y1, x2, y2
if showBackground4
bgBox4 := box.new(startTime4, high_val4, time, low_val4, xloc=xloc.bar_time, bgcolor=backgroundColor4, border_width=0)
if showLines4
lowHLine4 := line.new(startTime4, low_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
topHLine4 := line.new(startTime4, high_val4, time, high_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
leftVLine4 := line.new(startTime4, high_val4, startTime4, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
rightVLine4 := line.new(time, high_val4, time, low_val4, xloc=xloc.bar_time, color=boxLineColor4, style=line.style_solid, width=linesWidth4)
////////////////////////////////////////////
inSession5 = not na(time(timeframe.period, rangeTime5))
startTime5 = 0
startTime5 := inSession5 and not inSession5 ? time : startTime5
//Box lines
var line lowHLine5 = na
var line topHLine5 = na
var line leftVLine5 = na
var line rightVLine5 = na
var line middleHLine5 = na
var box bgBox5 = na
var low_val5 = 0.0
var high_val5 = 0.0
if inSession5 and not inSession5
low_val5 := low
high_val5 := high
high_val5
// Plot lines
if inSession5 and timeframe.isintraday
if inSession5
line.delete(lowHLine5)
line.delete(topHLine5)
line.delete(leftVLine5)
line.delete(rightVLine5)
line.delete(middleHLine5)
box.delete(bgBox5)
if low < low_val5
low_val5 := low
low_val5
if high > high_val5
high_val5 := high
high_val5
//Create Box
//x1, y1, x2, y2
if showBackground5
bgBox5 := box.new(startTime5, high_val5, time, low_val5, xloc=xloc.bar_time, bgcolor=backgroundColor5, border_width=0)
if showLines5
lowHLine5 := line.new(startTime5, low_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
topHLine5 := line.new(startTime5, high_val5, time, high_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
leftVLine5 := line.new(startTime5, high_val5, startTime5, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
rightVLine5 := line.new(time, high_val5, time, low_val5, xloc=xloc.bar_time, color=boxLineColor5, style=line.style_solid, width=linesWidth5)
///////////////////////////////////////////////
//INPUTS
ffRange = input.session(title='Time: ', defval='0200-0201', inline='a', group='FF')
ffcolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="FF")
ffStyle = input.string(title="-", defval=line.style_solid, options= ,inline="s_1",group="FF")
mmm1Range = input.session(title='Time: ', defval='0430-0431', inline='a', group='MMM1')
mmm1color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM1")
mmm1Style = input.string(title="-", defval=line.style_solid, options= ,inline="s_1",group="MMM1")
mmm2Range = input.session(title='Time: ', defval='0630-0631', inline='a', group='MMM2')
mmm2color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="MMM2")
mmm2Style = input.string(title="-", defval=line.style_solid, options= ,inline="s_1",group="MMM2")
mmm3Range = input.session(title='Time: ', defval='0800-0801', inline='a', group='MMM3')
mmm3color = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="mmm3")
mmm3Style = input.string(title="-", defval=line.style_solid, options= ,inline="s_1",group="MMM3")
lcRange = input.session(title='Time: ', defval='1100-1101', inline='a', group='LC')
lccolor = input.color(color.new(#b2b5be,20),title="Color:",inline="s_1",group="LC")
lcStyle = input.string(title="-", defval=line.style_solid, options= ,inline="s_1",group="LC")
//Plot lines
in_session_ff = time(timeframe.period, ffRange)
sessionffActive = in_session_ff and timeframe.multiplier <= 240
var line ff = na
if sessionffActive and sessionffActive == false
ff := line.new(bar_index,high+0.001,bar_index,low-0.001,color=ffcolor, style=ffStyle)
in_session_mmm1 = time(timeframe.period, mmm1Range)
sessionmmm1Active = in_session_mmm1 and timeframe.multiplier <= 240
var line mmm1 = na
if sessionmmm1Active and sessionmmm1Active == false
mmm1 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm1color, style=mmm1Style)
in_session_mmm2 = time(timeframe.period, mmm2Range)
sessionmmm2Active = in_session_mmm2 and timeframe.multiplier <= 240
var line mmm2 = na
if sessionmmm2Active and sessionmmm2Active == false
mmm2 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm2color, style=mmm2Style)
in_session_mmm3 = time(timeframe.period, mmm3Range)
sessionmmm3Active = in_session_mmm3 and timeframe.multiplier <= 240
var line mmm3 = na
if sessionmmm3Active and sessionmmm3Active == false
mmm3 := line.new(bar_index,high+0.001,bar_index,low-0.001,color=mmm3color, style=mmm3Style)
in_session_lc = time(timeframe.period, lcRange)
sessionlcActive = in_session_lc and timeframe.multiplier <= 240
var line lc = na
if sessionlcActive and sessionlcActive == false
lc := line.new(bar_index,high+0.001,bar_index,low-0.001,color=lccolor, style=lcStyle)
//////////////////////////////////////////////////////////////////////
// Inputs
var GRP10 = "Daily Open"
daily = input.string(title='View', defval='Daily Open', group=GRP10)
_offset = input.int(0, title='Offset', minval=0, maxval=2)
o_color = input.color(color.new(#000000, 0), "Open Color", inline="1", group = GRP10)
// FUNCTIONS
t = time
isNewbar = not na(t) and (na(t ) or t > t )
tfInMinutes(simple string tf = "") =>
float chartTf =
timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
float result = tf == "" ? chartTf : request.security(syminfo.tickerid, tf, chartTf)
inTimeframe(_t) => tfInMinutes(_t) > tfInMinutes(timeframe.period)
// Range
reso(exp, res) => request.security(syminfo.tickerid, res, exp, lookahead=barmerge.lookahead_on)
getData(_t, _var) =>
o = reso(open , _t)
show = _var != "Off" and inTimeframe(_t)
_time = time(_t)
newbar = na(_time ) or _time > _time
oc = _var == 'Daily Open'
// ---------- Daily ----------
= getData("D", daily)
if d_newbar
if d_oc
line.new(x1=time, y1=d_o, x2=time_close("D"), y2=d_o, xloc=xloc.bar_time, style=line.style_dotted, color=o_color)
//-------------------- WATERMARK--------------------
////////////////////////////////////////////////////
//text inputs
title = input.string("JDVID_FX", "Tittle", group = "NICK NAME")
subtitle = input.string("𝗖𝗬𝗖𝗟𝗘 | 𝗧𝗜𝗠𝗜𝗡𝗚 | 𝗣𝗥𝗘𝗖𝗜𝗦𝗜𝗢𝗡", "Subtitle", group = "text")
//symbol info
symInfoCheck = input.bool(title="Show Symbol Info", defval=true, group = "watermark position")
symInfo = syminfo.ticker + " | " + timeframe.period + (timeframe.isminutes ? "M" : na)
date = str.format("{0}/{1}/{2}", dayofmonth(time_close), month(time_close), year(time_close))
//text positioning
textVPosition = input.string("top", "Vertical Position", options = , group = "watermark position")
textHPosition = input.string("center", "Horizontal Position", options = , group = "watermark position")
//symbol info positioning
symVPosition = input.string("bottom", "Vertical Position", options = , group = "symbol position")
symHPosition = input.string("center", "Horizontal Position", options = , group = "symbol position")
//cell size
cellWidthPercent = input.float(0, "Cell Width (%)", minval = 0, maxval = 100, tooltip = "The width of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the width based on the text inside the cell. Value 0 has the same effect.", group = "cell size")
cellHeightPercent = input.float(0, "Cell Height (%)", minval = 0, maxval = 100, tooltip = "The height of the cell as a % of the indicator's visual space. Optional. By default, auto-adjusts the height based on the text inside of the cell. Value 0 has the same effect.", group = "cell size")
//title settings
c_title = input(color.new(color.black, 0), "Title Color", group = "title settings")
s_title = input.string("large", "Title Size", options = , group = "title settings")
a_title = input.string("center","Title Alignment", options = , group = "title settings")
//subtitle settings
c_subtitle = input(color.new(color.black, 30), "Subtitle Color", group = "subtitle settings")
s_subtitle = input.string("small", "Subtitle Size", options = , group = "subtitle settings")
a_subtitle = input.string("center","Subtitle Alignment", options = , group = "subtitle settings")
//symbol settings
c_symInfo = input(color.new(color.black, 30), "Subtitle Color", group = "symbol settings")
s_symInfo = input.string("normal", "Subtitle Size", options = , group = "symbol settings")
a_symInfo = input.string("center","Subtitle Alignment", options = , group = "symbol settings")
c_bg = input(color.new(color.blue, 100), "Background", group = "background")
//text watermark creation
var table textWatermark = table.new(textVPosition + "_" + textHPosition, 1, 3)
table.cell(textWatermark, 0, 0, title, width = cellWidthPercent, height = cellHeightPercent, text_color = c_title, text_halign = a_title, text_size = s_title, bgcolor = c_bg)
table.cell(textWatermark, 0, 1, subtitle, width = cellWidthPercent, height = cellHeightPercent, text_color = c_subtitle, text_halign = a_subtitle, text_size= s_subtitle, bgcolor = c_bg)
//symbol info watermark creation
var table symWatermark = table.new(symVPosition + "_" + symHPosition, 5, 5)
if symInfoCheck
table.cell(symWatermark, 0, 1, symInfo, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
table.cell(symWatermark, 0, 0, date, width = cellWidthPercent, height = cellHeightPercent, text_color = c_symInfo, text_halign = a_symInfo, text_size = s_symInfo, bgcolor = c_bg)
Dynamic Volume Trace Profile [ChartPrime]⯁ OVERVIEW
Dynamic Volume Trace Profile is a reimagined take on volume profile analysis. Instead of plotting a static horizontal histogram on the side of your chart, this indicator projects dynamic volume trace lines directly onto the price action. Each bin is color-graded according to its relative strength, creating a living “volume skeleton” of the market. The orange trace highlights the current Point of Control (POC)—the price level with maximum historical traded volume within the lookback window. On the right side, the tool builds a mini profile, showing absolute volume per bin alongside its percentage share, where the POC always represents 100% strength .
⯁ KEY FEATURES
Dynamic On-Chart Bins:
The range between highest high and lowest low is split into 25 bins. Each bin is drawn as a horizontal trace line across the lookback chart period.
Gradient Color Encoding:
Trace lines fade from transparent to teal depending on relative volume size. The more intense the teal, the stronger the historical traded activity at that level.
Automatic POC Highlight:
The bin with the highest aggregated volume is flagged with an orange line . This POC adapts bar-by-bar as volume distribution shifts.
Right-Side Volume Profile:
At the chart’s right edge, the script prints a box-style profile. Each bin shows:
• Total volume (absolute units).
• Percentage of max volume, in parentheses (POC bin = 100%).
This gives both raw and normalized context at a glance.
Adjustable Lookback Window:
The lookback defines how many bars feed the profile. Increase for stable HTF zones or decrease for responsive intraday distributions.
POC Toggle & Styling:
Optionally toggle POC highlighting on/off, adjust colors, and set line thickness for better integration with your chart theme.
⯁ HOW IT WORKS (UNDER THE HOOD)
Step Sizing:
over last 100 bars is divided by to calculate bin height.
Volume Aggregation:
For each bar in the , the script checks which bin the close falls into, then adds that bar’s volume to the bin’s counter.
Gradient Mapping:
Bin volume is normalized against the max volume across all bins. That value is mapped onto a gradient from transparent → teal.
POC Logic:
The bin with highest volume is colored orange both on the dynamic trace and in the right-side profile.
Right-Hand Profile:
Boxes are drawn for each bin proportional to volume / maxVolume × 50 units, with text labels showing both absolute volume and normalized %.
⯁ USAGE
Use the orange trace as the dominant “magnet” level—price often gravitates to the POC.
Watch for clusters of strong teal traces as areas of high acceptance; thin or faint zones mark low-liquidity gaps prone to fast moves.
On intraday charts, tighten lookback to reveal session-based distributions . For swing or position trading, expand lookback to surface more durable volume shelves.
Compare the right-side profile % to judge how “top-heavy” or “bottom-heavy” the current distribution is.
Use bright, intense color traces as context for confluence with structure, OBs, or liquidity hunts.
⯁ CONCLUSION
Dynamic Volume Trace Profile takes the traditional volume profile and fuses it into the body of price itself. Instead of a fixed sidebar, you see gradient traces layered directly on the chart, giving real-time context of where volume concentrated and where price may be drawn. With built-in POC highlighting, normalized % readouts, and an adaptive right-side profile, it offers both precision levels and market structure awareness in a cleaner, more intuitive form.
Session Opens UTC +1 LDN shows session time opens for Asia, London and New York when London is on UTC +1 (GMT +1) time
SM ZONE AND IC CANDLES OANDASM AND IC MARKING INDICATOR where you can mark the daily indicator for the SM zone and london and new york zones automatically for OANDA
Session Opens UTC LDN (AO, LO, NO)shows session time opens for Asia, London and New York when London is on UTC (GMT +0) time
Séparateur Journée 3h & 16h 🕒 Daily Session Separator – 3:00 & 16:00
This indicator automatically plots two vertical lines each trading day:
✅ A green line at 3:00 AM
✅ A red line at 16:00 (4:00 PM)
These visual markers help you:
Clearly separate different phases of the trading day
Spot key moments tied to volatility shifts and session overlaps (Europe/US)
Organize your chart for more effective intraday or swing analysis
A simple, clean, and practical tool to structure your daily trading sessions.
Candle % Changehow much price change inside a candle in %
Idea is simple enough to give a visual of how much in % price changed
JBK & Qassim — Setup1 + Setup2 (Liquidations/Corps/Mèches/EMA)JBK & Qassim — Setup1 + Setup2 (Liquidations/Corps/Mèches/EMA)
JBK — Liquidation + Corps% + EMA + Mèches réglablesJBK — Liquidation + Corps% + EMA + Mèches réglables
CarolTradeLibLibrary "CarolTradeLib"
f_generateSignalID(strategyName)
Parameters:
strategyName (string)
f_buildJSON(orderType, action, symbol, price, strategyName, apiKey, additionalFields, indicatorJSON)
Parameters:
orderType (string)
action (string)
symbol (string)
price (float)
strategyName (string)
apiKey (string)
additionalFields (string)
indicatorJSON (string)
sendSignal(action, symbol, price, strategyName, apiKey, indicatorJSON)
Parameters:
action (string)
symbol (string)
price (float)
strategyName (string)
apiKey (string)
indicatorJSON (string)
marketOrder(action, symbol, price, strategyName, apiKey, stopLoss, takeProfit, rrRatio, size, indicatorJSON)
Parameters:
action (string)
symbol (string)
price (float)
strategyName (string)
apiKey (string)
stopLoss (float)
takeProfit (float)
rrRatio (float)
size (float)
indicatorJSON (string)
limitOrder(action, symbol, price, strategyName, apiKey, limitPrice, size, indicatorJSON)
Parameters:
action (string)
symbol (string)
price (float)
strategyName (string)
apiKey (string)
limitPrice (float)
size (float)
indicatorJSON (string)
stopLimitOrder(action, symbol, price, strategyName, apiKey, stopPrice, limitPrice, size, indicatorJSON)
Parameters:
action (string)
symbol (string)
price (float)
strategyName (string)
apiKey (string)
stopPrice (float)
limitPrice (float)
size (float)
indicatorJSON (string)
Rolling Highest + Qualified Ghost (price-synced)[돌파]English Guide
What this indicator does
Plots a rolling highest line hh = ta.highest(src, len) that step-changes whenever the highest value inside the last len bars changes.
When a step ends after being flat for at least minHold bars (a “plateau”), it draws a short horizontal ghost line for ghostLen bars to the right at the previous step level.
By default, the ghost appears only on step-down events (behaves like a short-lived resistance trace). You can allow both directions with the onlyOnDrop setting.
Everything is rendered with plot() series (not drawing objects), bound to the right price scale → it moves perfectly with the chart.
Inputs
len — Lookback window (bars) for the rolling highest.
basis — Price basis used to compute the highest: High / Close / HLC3 / OHLC4.
minHold — Minimum plateau length (bars). Only steps that stayed flat at least this long qualify for a ghost.
ghostLen — Number of bars to keep the horizontal ghost to the right.
onlyOnDrop — If true, make ghosts only when the step moves down (default). If false, also create ghosts on step-ups.
Visuals: mainColor/mainWidth for the main rolling highest line; ghostColor/ghostTrans/ghostWidth for the ghost.
How it works (logic)
Rolling highest:
hh = ta.highest(src, len) produces a stair-like line.
Step detection:
stepUp = hh > hh
stepDown = hh < hh
startUp / startDown mark the first bar of a new step (prevents retriggering while the step continues).
Plateau length (runLen):
Counts consecutive bars where hh remained equal:
runLen := (hh == hh ) ? runLen + 1 : 1
Qualification:
On the first bar of a step change, check previous plateau length prevHold = runLen .
If prevHold ≥ minHold and direction matches onlyOnDrop, start a ghost:
ghostVal := hh (the previous level)
ghostLeft := ghostLen
Ghost series:
While ghostLeft > 0, output ghostVal; otherwise output na.
It’s plotted with plot.style_linebr so the line appears as short, clean horizontal segments instead of connecting across gaps.
Why it stays synced to price
The indicator uses overlay=true, scale=scale.right, format=format.price, and pure series plot().
No line.new() objects → no “stuck on screen” behavior when panning/zooming.
Tips & customization
If your chart is a line chart (close), set basis = Close so visuals align perfectly.
Want ghosts on both directions? Turn off onlyOnDrop.
Make ghosts subtler by increasing ghostTrans (e.g., 60–80).
If ghosts appear too often or too rarely, tune minHold and len.
Larger minHold = only long, meaningful plateaus will create ghosts.
Edge cases
If len is very small or the market is very volatile, plateaus may be rare → fewer ghosts.
If the stair level changes almost every few bars, raise len or minHold.
한글 설명서
기능 요약
최근 len개 바 기준의 롤링 최고가 hh를 그립니다. 값이 바뀔 때마다 계단식(step)으로 변합니다.
어떤 계단이 최소 minHold봉 이상 유지된 뒤 스텝이 끝나면, 직전 레벨을 기준으로 우측 ghostLen봉짜리 수평선(고스트) 을 그립니다.
기본값은 하락 스텝에서만 고스트를 생성(onlyOnDrop=true). 꺼두면 상승 스텝에서도 만듭니다.
전부 plot() 시리즈 기반 + 우측 가격 스케일 고정 → 차트와 완전히 동기화됩니다.
입력값
len — 롤링 최고가 계산 윈도우(바 수).
basis — 최고가 계산에 사용할 기준: High / Close / HLC3 / OHLC4.
minHold — 플래토(같은 값 유지) 최소 길이. 이 이상 유지된 스텝만 고스트 대상.
ghostLen — 우측으로 고스트를 유지할 바 수.
onlyOnDrop — 체크 시 하락 스텝에서만 고스트 생성(기본). 해제하면 상승 스텝도 생성.
표시 옵션: 본선(mainColor/mainWidth), 고스트(ghostColor/ghostTrans/ghostWidth).
동작 원리
롤링 최고가:
hh = ta.highest(src, len) → 계단형 라인.
스텝 변화 감지:
stepUp = hh > hh , stepDown = hh < hh
startUp / startDown 으로 첫 바만 잡아 중복 트리거 방지.
플래토 길이(runLen):
hh가 같은 값으로 연속된 길이를 누적:
runLen := (hh == hh ) ? runLen + 1 : 1
자격 판정:
스텝이 바뀌는 첫 바에서 직전 플래토 길이 prevHold = runLen 가 minHold 이상이고, 방향이 설정(onlyOnDrop)과 맞으면 고스트 시작:
ghostVal := hh (직전 레벨)
ghostLeft := ghostLen
고스트 출력:
ghostLeft > 0 동안 ghostVal을 출력, 아니면 na.
plot.style_linebr로 짧은 수평 구간만 보이게 합니다(NA 구간에서 선을 끊음).
가격과 동기화되는 이유
overlay=true, scale=scale.right, format=format.price로 가격 스케일에 고정, 그리고 모두 plot() 시리즈로 그립니다.
line.new() 같은 도형 객체를 쓰지 않아 스크롤/줌 시 화면에 박히는 현상이 없습니다.
활용 팁
차트를 라인(종가) 로 보신다면 basis = Close로 맞추면 시각적으로 더욱 정확히 겹칩니다.
고스트가 너무 자주 나오면 minHold를 올리거나 len을 키워서 스텝 빈도를 낮추세요.
고스트를 더 은은하게: ghostTrans 값을 크게(예: 60–80).
저항/지지 라인처럼 보이게 하려면 기본 설정(onlyOnDrop=true)이 잘 맞습니다.
주의할 점
변동성이 큰 종목/타임프레임에선 플래토가 짧아 고스트가 드물 수 있습니다.
len이 너무 작으면 스텝이 잦아져 노이즈가 늘 수 있습니다.
Swing T3 Ribbon with Dynamic Bandswing T3 Ribbon with Dynamic Bands
This indicator combines T3 moving averages with a dynamic Bollinger-style ribbon to highlight early trend changes and volatility-driven price moves.
Key Features:
T3 Ribbon: Fast T3 vs. Slow T3 shows trend direction; ribbon color is green for bullish, red for bearish.
Dynamic Bands: Bands fluctuate with recent price volatility, similar to Bollinger Bands, providing a visual guide for overbought/oversold areas.
Early Swing Markers:
E0 (Early Upswing): Price above top band while trend is temporarily bearish.
Ex (Early Downswing): Price below bottom band while trend is temporarily bullish.
Alerts:
Early upswing (E0)
Early downswing (Ex)
Price crossing the bottom (red) band from below.
Purpose:
Helps traders detect early trend reversals or price breakouts in the context of volatility.
Dynamic bands adapt to changing market conditions, giving a more responsive signal than fixed-width ribbons.
Multi-Symbol 2m EMA DashboardIndicator Summary for Publishing
The Multi-Symbol 2-Minute EMA Dashboard is a streamlined tool designed to monitor multiple symbols simultaneously using key EMAs and crossover signals. It provides a clear, color-coded table for quick trend analysis and trade signal tracking.
Key Features:
Multi-Symbol Support: Track up to 4 symbols at once in a single dashboard.
2-Minute Timeframe: All calculations are standardized to a 2-minute chart for fast-paced trading decisions.
EMA Columns:
EMA13, EMA48, EMA200 — Displays whether price is above (B, green) or below (S, red) each EMA.
Crossover Signals (TBuy / TSell):
TBuy (green) when EMA13 crosses above EMA48 — bullish momentum signal.
TSell (red) when EMA13 crosses below EMA48 — bearish momentum signal.
The column always displays the latest crossover event, making it easy to track the most recent trend shift.
Clean Visuals:
Table format with intuitive colors for fast decision-making.
Black background indicates neutral/no crossover state.
Relative Strength Index_ShRelative Strength Index updated to keep upper level at 60 while lower at 40
Time Cycles (90/30/10)This indicator plots hierarchical market cycles inside the 07:00 – 11:00 session (UTC-4), tailored for intraday NASDAQ trading on the 1-minute chart.
🔹 Cycles included:
90-minute cycle (primary)
30-minute cycles nested inside the 90m
10-minute cycles nested inside the 30m
🔹 Features:
Session-based: automatically resets daily at 07:00
Strict cutoff at 11:00 (no cycles extend past session close)
Adaptive box coloring to distinguish between nested cycles
Dynamic highs and lows: cycle boxes expand as new bars print
🔹 Use cases:
Visualize intraday rhythm & price structure
Spot potential turning points within nested timeframes
Enhance trade timing with cycle alignment
BBKC Combined Channels OverlayBBKC Combined Channels Overlay (Volatility & Mean Reversion)This indicator provides a clean, single-view envelope combining the Bollinger Bands (BB) and Keltner Channels (KC) directly onto your price chart. It is an essential tool for traders operating with Volatility Compression (The Squeeze) and Mean Reversion strategies in fast-moving markets like Futures, High BTC Beta Equities, and Crypto. The goal of this tool is twofold: to visually frame the market's current volatility state and to identify high-probability entry points based on expansion or extreme contraction. How to Use the BBKC Overlay: Spotting the Squeeze (Accumulation Phase):The Squeeze is identified when the Bollinger Bands (BB) contract and fit inside the Keltner Channels (KC).The area is clearly marked with a subtle Orange Background Highlight on the main chart. This is the Accumulation phase, signaling low volatility before a potential large directional move. Trading Mean Reversion: When price pushes aggressively outside the outermost bands (the BB Upper/Lower), it signals an extreme volatility expansion and over-extension. This is a strong setup for mean reversion—a high-probability trade targeting a snap-back towards the central Basis Line (SMA).Customizing for Extreme Compression: For traders looking only for the tightest, highest-probability Squeezes, adjust the following setting: KC Multiplier (ATR): Lower this value from the default of 1.5 down to 1.25 or 1.0. This narrows the KC, forcing the Bollinger Bands to contract even further to trigger the Squeeze signal, thus filtering for only the most minimal volatility. Recommended Synergy: For a complete volatility system, pair this BBKC Combined Channels Overlay (your visualization tool) with the BBKC Squeeze Indicator (the sub-pane momentum histogram).Overlay (Main Chart): Shows where the Squeeze is occurring and identifies mean reversion targets. Squeeze Indicator (Lower Pane): Shows if the Squeeze is active and the directional momentum building up, helping you time the breakout entry for the Manipulation/Distribution phase.
Bollinger Keltner Squeeze Indicator (BBKC)Bollinger Keltner Squeeze Indicator (BBKC)This single-pane indicator combines the power of Bollinger Bands (BB) and Keltner Channels (KC) to accurately identify periods of low volatility compression—the famous Squeeze—which often precedes large, directional moves.Designed for traders utilizing Accumulation, Manipulation, Distribution (AMD) strategies, this tool makes spotting the 'Accumulation' phase simple and visually clear, perfect for high BTC Beta equities or futures markets like MES and MNQ.Key Features:Clear Squeeze Visualization:The background of the main chart is shaded Orange when the Squeeze is active (BB is inside KC). This immediately highlights periods of extreme compression.A simple Red/Green Dot below the chart confirms the Squeeze state (Red = Squeeze ON, Green = Squeeze OFF).Momentum Histogram:A built-in momentum oscillator smooths price action and guides the anticipated direction of the breakout.Teal/Orange Bars: Indicate momentum direction while the Squeeze is active (building pressure).Bright Green/Red Bars: Indicate momentum direction after the Squeeze has broken (expansion/breakout).How to Find Maximum Volatility Compression (The "Tightest" Squeeze)To align this indicator with a strategy focused on catching only the most extreme volatility compression—the key to those explosive moves—traders should adjust the Keltner Channel Multiplier setting.Setting Name: KC Multiplier (ATR)Default Value: 1.5Recommended Adjustment: To filter for only the absolute tightest squeezes (where price is least volatile), decrease this multiplier value, typically down to 1.25 or even 1.0.By lowering the KC Multiplier (ATR), you narrow the Keltner Channel boundaries. This requires the Bollinger Bands to compress even further to fit inside, ensuring the indicator only signals the Squeeze state during moments of truly minimal volatility, setting you up for maximum opportunity.
Smart Session Levels - Step 1 (NY Prep Lines)It shows three vertical lines at 6 PM 12 AM and 6 AM for preparation at New York session to determine Asian high and Asia low levels also London high and London low levels
CCI MACDCCI and MACD in one indicator. CCI implementation with MACD like histogram. The result is the same as MACD with zero log.
TrailingStopLossLibrary "TrailingStopLoss"
简易追踪止损; 未充分测试,欢迎提交issue
drawdown_percent(entry_bar_index, direction_long)
drawdown_percent: 回撤百分比
Parameters:
entry_bar_index (int)
direction_long (bool)
Returns: percentage: 回撤百分比 > 0
closure_needed(entry_bar_index, initial_sl_price, percentage_ts, num_bars_tolerance, extra_drawdown_distance)
closure_needed: 是否满足平仓条件
Parameters:
entry_bar_index (int)
initial_sl_price (float)
percentage_ts (float)
num_bars_tolerance (int)
extra_drawdown_distance (float)
Returns: do_closure: bool 是否平仓