5 EMA vs 50 EMA Crossover with PCO/NCO//@version=5
indicator("5 EMA vs 50 EMA Crossover with PCO/NCO", overlay=true)
// EMA Calculations
emaFast = ta.ema(close, 5)
emaSlow = ta.ema(close, 50)
// Crossover Conditions
buySignal = ta.crossover(emaFast, emaSlow)
sellSignal = ta.crossunder(emaFast, emaSlow)
// Plot EMAs
plot(emaFast, color=color.blue, title="5 EMA")
plot(emaSlow, color=color.orange, title="50 EMA")
// Plot Buy/Sell Signals
plotshape(buySignal, title="Buy (PCO)", location=location.belowbar, color=color.green, style=shape.labelup, text="PCO")
plotshape(sellSignal, title="Sell (NCO)", location=location.abovebar, color=color.red, style=shape.labeldown, text="NCO")
// Optional Alerts
alertcondition(buySignal, title="Buy Alert (PCO)", message="PCO: 5 EMA crossed above 50 EMA")
alertcondition(sellSignal, title="Sell Alert (NCO)", message="NCO: 5 EMA crossed below 50 EMA")
อินดิเคเตอร์และกลยุทธ์
Forked from Micha Stocks WatermarkShow Alternate data for selected symbol, ticker ID, MarkCap, SMA Below or Above Icon (red/green), ATR, Next Earning Days left, I added Float (Outstanding Number of Shares tradable)
WMD Weekly OR (IST) Sidweekly OR (First hour) and mid point for various instruments based on indian standard time.
CosmicFXLibraryLibrary "CosmicFXLibrary"
isMarketHours(session)
Parameters:
session (string)
cosmicBackgroundColor(enable, isBull, enablePulse, intensity, pulseSource, bullC1, bullC2, bearC1, bearC2)
Parameters:
enable (bool)
isBull (bool)
enablePulse (bool)
intensity (int)
pulseSource (string)
bullC1 (color)
bullC2 (color)
bearC1 (color)
bearC2 (color)
starLayer1()
starLayer2()
starLayer3()
explosionTrigger(enable, breakout, session)
Parameters:
enable (bool)
breakout (bool)
session (string)
explosionStrength()
EMA13-EMA21 Difference Indicator# EMA13-EMA21 Difference Indicator
## Description
This indicator calculates the difference between the 13-period Exponential Moving Average (EMA13) and the 21-period Exponential Moving Average (EMA21), helping traders visually assess short-term market momentum.
**Core Logic:**
- When the difference is positive (green), the short-term EMA is above the long-term EMA, indicating a bullish trend
- When the difference is negative (red), the short-term EMA is below the long-term EMA, indicating a bearish trend
- Crossovers of the zero line can serve as potential trend reversal signals
**Use Cases:**
- Trend direction identification
- Momentum strength analysis
- Entry and exit timing assistance
**Disclaimer:**
This indicator is for reference only. It is recommended to combine it with other technical analysis tools for comprehensive judgment. This does not constitute investment advice.
Implicit Dolar MEPWhich stock or CEDEAR offers the best implied MEP dollar rate?
This indicator displays labels positioned at the level of the implied MEP dollar rate for the 10 equity instruments (stocks, CEDEARs and ETFs) with the highest trading volume in MEP dollars over the last month on the BYMA market.
The implied rate for each asset is calculated as the ratio between its price in ARS and its price in MEP dollars, for example:
GGAL / GGALD.
As a reference (benchmark), a white line is plotted representing the implied MEP dollar rate of the AL30 bond, calculated as AL30 / AL30D, which is the most liquid government bond in the BYMA market.
Settings
• The user may enter the ticker of any bi-currency instrument (fixed income or equity) to add its label to the chart.
Key information
An information box highlights:
• The asset with the most expensive implied dollar (Best SELL).
• The asset with the cheapest implied dollar (Best BUY).
Not an investment recommendation.
This information is provided for informational purposes only and does not constitute an offer, solicitation, or investment advice. Investment decisions are the sole responsibility of the investor.
Bar CountCount K bars based on sessions
Support at most 3 sessions
Customize the session's timezone and period
Set steps between each number
Use with the built-in Trading Session indicator is a great convenience
50-Point Psych Levels (Multiples of 50)50-Point Psychological Levels (Multiples of 50)
This indicator plots static psychological price levels at fixed point intervals (default every 50 points) across the chart. These levels are commonly watched by traders as natural areas of reaction, balance, support, and resistance, especially on index futures such as NQ, ES, YM, and RTY.
The script automatically centers the levels around the current market price and draws them across a configurable range above and below price. All levels extend across the entire chart and are drawn once only, keeping the display clean and preventing redraw lag.
Key Features
Plots horizontal levels at fixed point spacing (default: 50 points)
Automatically anchors around the latest price
Configurable range above and below price
Customizable line color, width, and style
Lightweight, non-repainting, static reference levels
Best Use Cases
Identifying psychological support and resistance
Confluence with VWAP, EMA structure, ORB levels, and volume
Futures trading (NQ, ES, YM, RTY), indexes, and large-tick instruments
Yield Curve Inversion Indicator Will track the TVC:US10Y and TVC:US03MY spread, often followed for the "yield curve inversion" trade/indicator.
When an inversion occurs, which lasts a minimum of the defined days (default 10) the indicator will paint forward a warning period (default is 365 days).
The yield curve being inverted is not the signal, the REVERSION back to a positive curve is the associated signal, namely the following 12 months after a reversion. This is often used as an early warning of trouble in markets.
Hope this helpful for those who follow macro/internal warning signals.
N Days Back Session DividerThis Pine Script acts as a smart vertical marker that identifies exactly where a trading day began a specific number of sessions ago. It is designed to ignore "dead time" (like weekends or holidays) by focusing on actual market activity.
Candle Pattern Library [1CG]Candle Pattern Library
A comprehensive and easy-to-use Pine Script™ library for detecting single, two, and three-candle patterns. This library provides detailed pattern analysis including size classification, direction validation, and specific pattern identification.
Quick Start
1. Import the Library
import OneCleverGuy/CandlePatternLibrary/1 as CPL
2. Analyze Candles
Use the main analysis functions to detect patterns. You can analyze the current forming candle or confirmed historical candles.
// 1. Analyze candles (Current , Previous , and the one before )
// Note: We use full variable names for clarity.
CandleData candleNewest = CPL.analyzeCandle(open, high, low, close, 250, 50, 10, 50, 85)
CandleData candleMiddle = CPL.analyzeCandle(open , high , low , close , 250, 50, 10, 50, 85)
CandleData candleOldest = CPL.analyzeCandle(open , high , low , close , 250, 50, 10, 50, 85)
// 2. Analyze multi-candle patterns
// Pass candles in chronological order: Oldest -> Newest
var twoCandleData = CPL.analyzeTwoCandlePattern(candleMiddle, candleNewest, 10, 85)
var threeCandleData = CPL.analyzeThreeCandlePattern(candleOldest, candleMiddle, candleNewest)
Enums Reference
These are the Enum Types exported by the library. When checking results, use the pattern Alias.EnumType.Value (e.g., CPL.CandlePattern.Hammer).
CandlePattern
Enum Type for single-candle formations.
Usage: CPL.CandlePattern.
Values:
Unknown : No specific pattern detected.
RegularBullish : A standard bullish candle.
RegularBearish : A standard bearish candle.
BullishMarubozu : Bullish candle with little to no wicks.
BearishMarubozu : Bearish candle with little to no wicks.
Hammer : Small body at the top of the range (bullish reversal).
ShootingStar : Small body at the bottom of the range (bearish reversal).
SpinningTop : Small body centered in the range.
Doji : Open and close are effectively equal.
LongLeggedDoji : Doji with long upper and lower wicks.
CrossDoji : Doji with the body in the upper section.
DragonflyDoji : Doji where open/close are at the high.
InvertedCrossDoji : Doji with the body in the lower section.
GravestoneDoji : Doji where open/close are at the low.
FourPriceDoji : Open, High, Low, and Close are all equal.
TwoCandlePattern
Enum Type for two-candle formations.
Usage: CPL.TwoCandlePattern.
Values:
None : No two-candle pattern detected.
BullishEngulfingWeak : Bullish candle engulfs the previous body (close does not engulf range).
BullishEngulfingStrong : Bullish candle completely engulfs the previous body close outside range.
BearishEngulfingWeak : Bearish candle engulfs the previous body.
BearishEngulfingStrong : Bearish candle completely engulfs the previous body.
InsideBar : The second candle is completely contained within the first.
TweezerTop : Two candles with matching highs (bearish reversal).
TweezerBottom : Two candles with matching lows (bullish reversal).
BullishRailRoad : Two opposite Marubozus (Down -> Up).
BearishRailRoad : Two opposite Marubozus (Up -> Down).
ThreeCandlePattern
Enum Type for three-candle formations.
Usage: CPL.ThreeCandlePattern.
Values:
None : No three-candle pattern detected.
ThreeWhiteSoldiers : Three consecutive bullish candles.
ThreeBlackCrows : Three consecutive bearish candles.
ThreeWhiteSoldiersWithBullishFVG : Three White Soldiers containing a Bullish FVG.
ThreeWhiteSoldiersWithBearishFVG : Three White Soldiers containing a Bearish FVG.
ThreeBlackCrowsWithBullishFVG : Three Black Crows containing a Bullish FVG.
ThreeBlackCrowsWithBearishFVG : Three Black Crows containing a Bearish FVG.
MorningStar : Bearish -> Small/Doji -> Bullish (Bullish Reversal).
EveningStar : Bullish -> Small/Doji -> Bearish (Bearish Reversal).
BullishAbandonedBaby : Morning Star with gaps between all candles.
BearishAbandonedBaby : Evening Star with gaps between all candles.
EngulfingSandwich : Bearish -> Bullish (Engulfing) -> Bearish (Inside).
BullishFairValueGap : A gap between Candle 1 High and Candle 3 Low.
BearishFairValueGap : A gap between Candle 1 Low and Candle 3 High.
CandleSize
Enum Type for candle size classification.
Usage: CPL.CandleSize.
Values:
Short
Normal
Long
CandleDirection
Enum Type for candle direction classification.
Usage: CPL.CandleDirection.
Values:
Bearish
Neutral
Bullish
Function Reference
Analysis Functions
analyzeCandle(_open, _high, _low, _close, _avgSize, _sizeThresholdPct, _equivTolerance, _bodyTolerance, _positionThreshold)
analyzeCandle - Analyzes a single candle's OHLC data to determine its size, direction, and single-candle pattern.
Parameters:
_open (float) : (float) - Candle open price.
_high (float) : (float) - Candle high price.
_low (float) : (float) - Candle low price.
_close (float) : (float) - Candle close price.
_avgSize (float) : (float) - Baseline size (wick range) to compare against.
_sizeThresholdPct (float) : (float) - % difference from average to be considered Long/Short (e.g., 50.0).
_equivTolerance (float) : (float) - Absolute price diff for Close to equal Open (Doji checks).
_bodyTolerance (float) : (float) - Absolute price diff for "Small Body" checks.
_positionThreshold (int) : (int) - Int (0-100) determining valid wick ratios for Hammers/Shooting Stars (e.g., 85).
Returns: (CandleData) - CandleData object containing CandlePattern, CandleSize, CandleDirection.
analyzeTwoCandlePattern(_candle1, _candle2, _equivTolerance, _positionThreshold)
analyzeTwoCandlePattern - Analyzes two consecutive candles to find pairs like Engulfing, Tweezers, or Inside Bars.
Parameters:
_candle1 (CandleData) : (CandleData) - The first (older) candle data (previous).
_candle2 (CandleData) : (CandleData) - The second (newer) candle data (current).
_equivTolerance (float) : (float) - Price tolerance for matching highs/lows (Tweezers).
_positionThreshold (int) : (int) - Threshold for wick validations.
Returns: (TwoCandleData) - TwoCandleData object containing TwoCandlePattern.
analyzeThreeCandlePattern(_candle1, _candle2, _candle3)
analyzeThreeCandlePattern - Analyzes three consecutive candles to find complex patterns like Morning Stars, Abandoned Babies, or Three White Soldiers.
Parameters:
_candle1 (CandleData) : (CandleData) - The first (oldest) candle data.
_candle2 (CandleData) : (CandleData) - The second (middle) candle data.
_candle3 (CandleData) : (CandleData) - The third (newest) candle data.
Returns: (ThreeCandleData) - ThreeCandleData object containing ThreeCandlePattern.
Naming Utilities
getPatternName(_pattern)
getPatternName - Returns the string name of a candle pattern.
Parameters:
_pattern (CandlePattern) : (CandlePattern) - The candle pattern enum value.
Returns: (string) - Human-readable pattern name (e.g., "Hammer").
getTwoCandlePatternName(_pattern)
getTwoCandlePatternName - Returns the string name of a two-candle pattern.
Parameters:
_pattern (TwoCandlePattern) : (TwoCandlePattern) - The two-candle pattern enum value.
Returns: (string) - Human-readable pattern name (e.g., "Bullish Engulfing").
getThreeCandlePatternName(_pattern)
getThreeCandlePatternName - Returns the string name of a three-candle pattern.
Parameters:
_pattern (ThreeCandlePattern) : (ThreeCandlePattern) - The three-candle pattern enum value.
Returns: (string) - Human-readable pattern name (e.g., "Morning Star").
getSizeName(_size)
getSizeName - Returns the string name of a candle size.
Parameters:
_size (CandleSize) : (CandleSize) - The candle size enum value.
Returns: (string) - Human-readable size name ("Short", "Normal", or "Long").
getDirectionName(_direction)
getDirectionName - Returns the string name of a candle direction.
Parameters:
_direction (CandleDirection) : (CandleDirection) - The candle direction enum value.
Returns: (string) - Human-readable direction name ("Bullish", "Bearish", or "Neutral").
Global Net Liquidity (with offset Trail2Crypto)Click settings and set the offset to 70 days to have the perfect fit.
Day of WeekDay of Week is an indicator that runs in a separate panel and colors the panel background according to the day of the week.
Main Features
Colors the background of the lower panel based on the day of the week
Includes all days, from Monday to Sunday
Customizable colors
Time Offset Correction
TradingView calculates the day of the week using the exchange’s timezone, which can cause visual inconsistencies on certain symbols.
To address this, the indicator includes a configurable time offset that allows the user to synchronize the calculated day with the day displayed on the chart.
By simply adjusting the Time Offset (hours) parameter, the background will align correctly with the visible chart calendar.
just takesi TimeMNO_2Step_Strategy_MOU_KAKU (Publish-Clear)//@version=5
strategy("MNO_2Step_Strategy_MOU_KAKU (Publish-Clear)", overlay=true, pyramiding=0,
max_labels_count=500, max_lines_count=500,
initial_capital=100000,
default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// =========================
// Inputs
// =========================
emaSLen = input.int(5, "EMA Short (5)")
emaMLen = input.int(13, "EMA Mid (13)")
emaLLen = input.int(26, "EMA Long (26)")
macdFast = input.int(12, "MACD Fast")
macdSlow = input.int(26, "MACD Slow")
macdSignal = input.int(9, "MACD Signal")
macdZeroTh = input.float(0.2, "MOU: MACD near-zero threshold", step=0.05)
volLookback = input.int(5, "Volume MA days", minval=1)
volMinRatio = input.float(1.3, "MOU: Volume ratio min", step=0.1)
volStrong = input.float(1.5, "Strong volume ratio (Breakout/KAKU)", step=0.1)
volMaxRatio = input.float(3.0, "Volume ratio max (filter)", step=0.1)
wickBodyMult = input.float(2.0, "Pinbar: lowerWick >= body*x", step=0.1)
pivotLen = input.int(20, "Resistance lookback", minval=5)
pullMinPct = input.float(5.0, "Pullback min (%)", step=0.1)
pullMaxPct = input.float(15.0, "Pullback max (%)", step=0.1)
breakLookbackBars = input.int(5, "Pullback route: valid bars after break", minval=1)
// --- Breakout route (押し目なし初動ブレイク) ---
useBreakoutRoute = input.bool(true, "Enable MOU Breakout Route (no pullback)")
breakConfirmPct = input.float(0.3, "Break confirm: close > R*(1+%)", step=0.1)
bigBodyLookback = input.int(20, "Break candle body MA length", minval=5)
bigBodyMult = input.float(1.2, "Break candle: body >= MA*mult", step=0.1)
requireCloseNearHigh = input.bool(true, "Break candle: close near high")
closeNearHighPct = input.float(25.0, "Close near high threshold (% of range)", step=1.0)
allowMACDAboveZeroInstead = input.bool(true, "Breakout route: allow MACD GC above zero instead")
// 表示
showEMA = input.bool(true, "Plot EMAs")
showMouLabels = input.bool(true, "Show MOU/MOU-B labels")
showKakuLabels = input.bool(true, "Show KAKU labels")
showDebugTbl = input.bool(true, "Show debug table (last bar)")
showStatusLbl = input.bool(true, "Show status label (last bar always)")
locChoice = input.string("Below Bar", "Label location", options= )
lblLoc = locChoice == "Below Bar" ? location.belowbar : location.abovebar
// =========================
// 必ず決済が起きる設定(投稿クリア用)
// =========================
enableTPSL = input.bool(true, "Enable TP/SL")
tpPct = input.float(2.0, "Take Profit (%)", step=0.1, minval=0.1) // ←投稿クリア向けに近め
slPct = input.float(1.0, "Stop Loss (%)", step=0.1, minval=0.1) // ←投稿クリア向けに近め
maxHoldBars = input.int(30, "Max bars in trade (force close)", minval=1)
entryMode = input.string("MOU or KAKU", "Entry trigger", options= )
// ✅ 保険:トレード0件を避ける(投稿クリア用)
// 1回でもクローズトレードができたら自動で沈黙
publishAssist = input.bool(true, "Publish Assist (safety entry if 0 trades)")
// =========================
// EMA
// =========================
emaS = ta.ema(close, emaSLen)
emaM = ta.ema(close, emaMLen)
emaL = ta.ema(close, emaLLen)
plot(showEMA ? emaS : na, color=color.new(color.yellow, 0), title="EMA 5")
plot(showEMA ? emaM : na, color=color.new(color.blue, 0), title="EMA 13")
plot(showEMA ? emaL : na, color=color.new(color.orange, 0), title="EMA 26")
emaUpS = emaS > emaS
emaUpM = emaM > emaM
emaUpL = emaL > emaL
goldenOrder = emaS > emaM and emaM > emaL
above26_2days = close > emaL and close > emaL
baseTrendOK = (emaUpS and emaUpM and emaUpL) and goldenOrder and above26_2days
// =========================
// MACD
// =========================
= ta.macd(close, macdFast, macdSlow, macdSignal)
macdGC = ta.crossover(macdLine, macdSig)
macdUp = macdLine > macdLine
macdNearZero = math.abs(macdLine) <= macdZeroTh
macdGCAboveZero = macdGC and macdLine > 0 and macdSig > 0
macdMouOK = macdGC and macdNearZero and macdUp
macdBreakOK = allowMACDAboveZeroInstead ? (macdMouOK or macdGCAboveZero) : macdMouOK
// =========================
// Volume
// =========================
volMA = ta.sma(volume, volLookback)
volRatio = volMA > 0 ? (volume / volMA) : na
volumeMouOK = volRatio >= volMinRatio and volRatio <= volMaxRatio
volumeStrongOK = volRatio >= volStrong and volRatio <= volMaxRatio
// =========================
// Candle patterns
// =========================
body = math.abs(close - open)
upperWick = high - math.max(open, close)
lowerWick = math.min(open, close) - low
pinbar = (lowerWick >= wickBodyMult * body) and (lowerWick > upperWick) and (close >= open)
bullEngulf = close > open and close < open and close >= open and open <= close
bigBull = close > open and open < emaM and close > emaS and (body > ta.sma(body, 20))
candleOK = pinbar or bullEngulf or bigBull
// =========================
// Resistance / Pullback route
// =========================
res = ta.highest(high, pivotLen)
pullbackPct = res > 0 ? (res - close) / res * 100.0 : na
pullbackOK = pullbackPct >= pullMinPct and pullbackPct <= pullMaxPct
brokeRes = ta.crossover(close, res )
barsSinceBreak = ta.barssince(brokeRes)
afterBreakZone = (barsSinceBreak >= 0) and (barsSinceBreak <= breakLookbackBars)
pullbackRouteOK = afterBreakZone and pullbackOK
// =========================
// Breakout route (押し目なし初動ブレイク)
// =========================
breakConfirm = close > res * (1.0 + breakConfirmPct / 100.0)
bullBreak = close > open
bodyMA = ta.sma(body, bigBodyLookback)
bigBodyOK = bodyMA > 0 ? (body >= bodyMA * bigBodyMult) : false
rng = math.max(high - low, syminfo.mintick)
closeNearHighOK = not requireCloseNearHigh ? true : ((high - close) / rng * 100.0 <= closeNearHighPct)
mou_breakout = useBreakoutRoute and baseTrendOK and breakConfirm and bullBreak and bigBodyOK and closeNearHighOK and volumeStrongOK and macdBreakOK
mou_pullback = baseTrendOK and volumeMouOK and candleOK and macdMouOK and pullbackRouteOK
mou = mou_pullback or mou_breakout
// =========================
// KAKU (Strict): 8条件 + 最終三点
// =========================
cond1 = emaUpS and emaUpM and emaUpL
cond2 = goldenOrder
cond3 = above26_2days
cond4 = macdGCAboveZero
cond5 = volumeMouOK
cond6 = candleOK
cond7 = pullbackOK
cond8 = pullbackRouteOK
all8_strict = cond1 and cond2 and cond3 and cond4 and cond5 and cond6 and cond7 and cond8
final3 = pinbar and macdGCAboveZero and volumeStrongOK
kaku = all8_strict and final3
// =========================
// Entry (strategy)
// =========================
entrySignal = entryMode == "KAKU only" ? kaku : (mou or kaku)
canEnter = strategy.position_size == 0
newEntryKaku = canEnter and kaku and entrySignal
newEntryMouB = canEnter and (not kaku) and mou_breakout and entrySignal
newEntryMou = canEnter and (not kaku) and mou_pullback and entrySignal
// --- Publish Assist(保険エントリー) ---
// 条件が厳しすぎて「トレード0件」だと投稿時に警告が出る。
// closedtradesが0の間だけ、軽いEMAクロスで1回だけ拾う(その後は沈黙)。
assistFast = ta.ema(close, 5)
assistSlow = ta.ema(close, 20)
assistEntry = publishAssist and strategy.closedtrades == 0 and canEnter and ta.crossover(assistFast, assistSlow)
// 実エントリー
if newEntryKaku or newEntryMouB or newEntryMou or assistEntry
strategy.entry("LONG", strategy.long)
// ラベル(視認)
if showMouLabels and newEntryMou
label.new(bar_index, low, "猛(IN)", style=label.style_label_up, color=color.new(color.lime, 0), textcolor=color.black)
if showMouLabels and newEntryMouB
label.new(bar_index, low, "猛B(IN)", style=label.style_label_up, color=color.new(color.lime, 0), textcolor=color.black)
if showKakuLabels and newEntryKaku
label.new(bar_index, low, "確(IN)", style=label.style_label_up, color=color.new(color.yellow, 0), textcolor=color.black)
if assistEntry
label.new(bar_index, low, "ASSIST(IN)", style=label.style_label_up, color=color.new(color.aqua, 0), textcolor=color.black)
// =========================
// Exit (TP/SL + 強制クローズ)
// =========================
inPos = strategy.position_size > 0
tpPx = inPos ? strategy.position_avg_price * (1.0 + tpPct/100.0) : na
slPx = inPos ? strategy.position_avg_price * (1.0 - slPct/100.0) : na
if enableTPSL
strategy.exit("TP/SL", from_entry="LONG", limit=tpPx, stop=slPx)
// 最大保有バーで強制決済(これが「レポート無し」回避の最後の保険)
var int entryBar = na
if strategy.position_size > 0 and strategy.position_size == 0
entryBar := bar_index
if strategy.position_size == 0
entryBar := na
forceClose = inPos and not na(entryBar) and (bar_index - entryBar >= maxHoldBars)
if forceClose
strategy.close("LONG")
// =========================
// 利確/損切/強制クローズのラベル
// =========================
closedThisBar = (strategy.position_size > 0) and (strategy.position_size == 0)
avgPrev = strategy.position_avg_price
tpPrev = avgPrev * (1.0 + tpPct/100.0)
slPrev = avgPrev * (1.0 - slPct/100.0)
hitTP = closedThisBar and high >= tpPrev
hitSL = closedThisBar and low <= slPrev
// 同一足TP/SL両方は厳密に判断できないので、表示は「TP優先」で簡略(投稿ギリギリ版)
if hitTP
label.new(bar_index, high, "利確", style=label.style_label_down, color=color.new(color.lime, 0), textcolor=color.black)
else if hitSL
label.new(bar_index, low, "損切", style=label.style_label_up, color=color.new(color.red, 0), textcolor=color.white)
else if closedThisBar and forceClose
label.new(bar_index, close, "時間決済", style=label.style_label_left, color=color.new(color.gray, 0), textcolor=color.white)
// =========================
// Signals (猛/猛B/確)
// =========================
plotshape(showMouLabels and mou_pullback and not kaku, title="MOU_PULLBACK", style=shape.labelup, text="猛",
color=color.new(color.lime, 0), textcolor=color.black, location=lblLoc, size=size.tiny)
plotshape(showMouLabels and mou_breakout and not kaku, title="MOU_BREAKOUT", style=shape.labelup, text="猛B",
color=color.new(color.lime, 0), textcolor=color.black, location=lblLoc, size=size.tiny)
plotshape(showKakuLabels and kaku, title="KAKU", style=shape.labelup, text="確",
color=color.new(color.yellow, 0), textcolor=color.black, location=lblLoc, size=size.small)
// =========================
// Alerts
// =========================
alertcondition(mou, title="MNO_MOU", message="MNO: MOU triggered")
alertcondition(mou_breakout, title="MNO_MOU_BREAKOUT", message="MNO: MOU Breakout triggered")
alertcondition(mou_pullback, title="MNO_MOU_PULLBACK", message="MNO: MOU Pullback triggered")
alertcondition(kaku, title="MNO_KAKU", message="MNO: KAKU triggered")
alertcondition(assistEntry, title="MNO_ASSIST_ENTRY", message="MNO: ASSIST ENTRY (publish safety)")
// =========================
// Status label(最終足に必ず表示)
// =========================
var label status = na
if showStatusLbl and barstate.islast
label.delete(status)
statusTxt =
"MNO RUNNING " +
"ClosedTrades: " + str.tostring(strategy.closedtrades) + " " +
"BaseTrend: " + (baseTrendOK ? "OK" : "NO") + " " +
"MOU: " + (mou ? "YES" : "no") + " (猛=" + (mou_pullback ? "Y" : "n") + " / 猛B=" + (mou_breakout ? "Y" : "n") + ") " +
"KAKU: " + (kaku ? "YES" : "no") + " " +
"VolRatio: " + (na(volRatio) ? "na" : str.tostring(volRatio, format.mintick)) + " " +
"Pull%: " + (na(pullbackPct) ? "na" : str.tostring(pullbackPct, format.mintick)) + " " +
"Pos: " + (inPos ? "IN" : "OUT")
status := label.new(bar_index, high, statusTxt, style=label.style_label_left, textcolor=color.white, color=color.new(color.black, 0))
// =========================
// Debug table(最終足のみ)
// =========================
var table t = table.new(position.top_right, 2, 14, border_width=1, border_color=color.new(color.white, 60))
fRow(_name, _cond, _r) =>
bg = _cond ? color.new(color.lime, 70) : color.new(color.red, 80)
tx = _cond ? "OK" : "NO"
table.cell(t, 0, _r, _name, text_color=color.white, bgcolor=color.new(color.black, 0))
table.cell(t, 1, _r, tx, text_color=color.white, bgcolor=bg)
if showDebugTbl and barstate.islast
table.cell(t, 0, 0, "MNO Debug", text_color=color.white, bgcolor=color.new(color.black, 0))
table.cell(t, 1, 0, "", text_color=color.white, bgcolor=color.new(color.black, 0))
fRow("BaseTrend", baseTrendOK, 1)
fRow("MOU Pullback", mou_pullback, 2)
fRow("MOU Breakout", mou_breakout, 3)
fRow("Break confirm", breakConfirm, 4)
fRow("Break big body", bigBodyOK, 5)
fRow("Break close high", closeNearHighOK, 6)
fRow("Break vol strong", volumeStrongOK, 7)
fRow("Break MACD", macdBreakOK, 8)
fRow("KAKU all8", all8_strict, 9)
fRow("KAKU final3", final3, 10)
fRow("AssistEntry", assistEntry, 11)
fRow("ClosedTrades>0", strategy.closedtrades > 0, 12)
Session HeatmapIntraday Seasonality
Overview
Analyzes historical patterns by time of day. Identifies when volatility, volume, and open interest changes tend to be highest or lowest.
Features
Multiple Metrics: TR (volatility), Volume, and Open Interest changes
Flexible Grouping: View patterns by weekday or month to spot day-of-week or seasonal effects
Heatmap Visualization: Blue (low) to Red (high) color scale for quick pattern recognition
Percentile Mode: Reduces outlier impact by using 5th-95th percentile range
Timezone Support: Display in UTC alongside your local time
Metrics Explained
TR: Volatility - when markets move most
Volume: Liquidity - when participation is highest
OI Increase: When new positions are opened
OI Decrease: When positions are closed
OI Net: Net open interest change
Usage
Set your timezone and preferred slot size (30min/1H)
Choose a date range (relative or custom)
Select a metric to analyze
Use "Group By" to see weekday or monthly patterns
Switch to Percentile color scale if outliers dominate
Notes
Chart timeframe should be equal to or smaller than Slot Size
OI metrics require Binance Perpetual symbols
DST is not automatically adjusted; consider seasonal shifts for US/EU sessions






















