yuchenseo 15min intervalsHourly Candle Behaviour Indicator
- 0-15min look for continuation
- 15-30min look for reversal
- 30-45min look for reversal
Candlestick analysis
Relative Volume Strategy📈 Relative Volume Strategy by GabrielAmadeusLau
This Pine Script strategy combines volume-based momentum analysis with price action filtering, breakout detection, and dynamic stop-loss/take-profit logic, allowing for highly adaptable long and short entries. It is particularly suited for traders looking to identify reversals or continuation setups based on relative volume spikes and candle behavior.
🧠 Core Concept
At its core, this strategy uses a Relative Volume %R oscillator, comparing the current volume to its historical range using a Williams %R-like calculation. The oscillator is paired with dual moving average filters (Fast & Slow) to identify when volume is expanding or contracting.
Entries are further refined using a configurable price action filter based on the structure of bullish or bearish candles:
Simple: Basic up/down bar
Filtered: Range-based strength confirmation
Aggressive: Momentum-based breakout
Inside: Reversal bar patterns
Combinations of the above can be toggled for both long and short entries.
⚙️ Configurable Features
Trade Direction Control: Choose between Long Only, Short Only, or Both.
Directional Bar Modes: Set different conditions for long and short bar types (Simple, Filtered, Aggressive, Inside).
Breakout Filter: Optional filter to exclude trades near 5-bar highs/lows to avoid poor R/R trades.
Stop Loss & Take Profit System:
ATR-based dynamic SL/TP.
Configurable multipliers for both SL and TP.
Timed Exit: Optional bar-based exit after a fixed number of candles.
Custom Volume MA Smoothing: Choose from various smoothing algorithms (SMA, EMA, JMA, T3, Super Smoother, etc.) for both fast and slow volume trends.
Relative Volume Threshold: Minimum %R level for trade filtering.
📊 Technical Indicators Used
Relative Volume %R: A modified version of Williams %R, calculated on volume.
Dual Volume MAs: Fast and Slow MAs for volume trends using user-selected smoothing.
ATR: Average True Range for dynamic SL/TP calculation.
Breakout High/Low: 5-bar breakout thresholds to avoid late entries.
🚀 Trade Logic
Long Entry:
Volume > Fast MA > Slow MA
Relative Volume %R > Threshold
Price passes long directional filter
Optional: below recent breakout high
Short Entry:
Volume < Fast MA < Slow MA
Relative Volume %R < 100 - Threshold
Price passes short directional filter
Optional: above recent breakout low
Exits:
After N bars (configurable)
ATR-based Stop Loss / Take Profit if enabled
📈 Visualization
Orange Columns: Relative Volume %R
Green Line: Fast Volume MA
Red Line: Slow Volume MA
💡 Use Case
Ideal for:
Reversal traders catching capitulation or accumulation spikes
Momentum traders looking for volume-confirmed trends
Quantitative strategy developers wanting modular MA and price action filter logic
Intraday scalpers or swing traders using relative volume dynamics
Created by: GabrielAmadeusLau
License: Mozilla Public License 2.0
🔗 mozilla.org
BOS INDICATOR )This indicator is used to mark out breaks of structures to the upside and the downside. It's used to easily determine which direction the market is breaking structure towards.
Hybrid candles by Marian BWill plot normal candles with the Heikin-Ashi colors.
You must bring the visiual order to front.
ABCD Pattern FinderThis is a basic version: more robust implementations use zigzag structures and advanced filtering.
You may want to filter by Fibonacci ratios like 61.8%, 78.6%, or 127.2% depending on your preferred ABCD variation.
Post-Market Session AnalyzerThis script visually analyzes U.S. post-market trading hours (4:00 PM to 8:00 PM EST) by:
a) Highlighting post-market session background
b) Coloring candles based on price direction
c) Marking the final post-market candle with a trend label
Great for:
1) Traders who monitor after-hours price movement
2) Spotting late-day reversals or sentiment shifts
3) Understanding extended trading activity
Bullish & Bearish Wick MarkerMarks bullish and bearish engulfing candles
Bullish engulfing candle:
when the low is lower than the previous candle low and the body close is higher than the previous candle body
Bearish engulfing cande:
when the high is higher than the previous candle high and the body close is lower than the previous candle body
SMMA Cross Strategy stopsuzThey were formed by the intersections of 2 SMMA moving averages. You can adjust the parameter and make profit.
Candles by Day, Time, Month + StatsThis Pine Script allows you to filter and display candles based on:
📅 Specific days of the week
🕒 Custom intraday time ranges (e.g., 9:15 to 10:30)
📆 Selected months
📊 Shows stats for each filtered block:
🔼 Range (High – Low)
📏 Average candle body size
⚙️ Key Features:
✅ Filter by day, time, and month
🎛 Toggle to show/hide the stats label
🟩 Candles are drawn only for selected conditions
📍 Stats label is positioned above session high (adjustable)
⚠️ Important Setup Instructions:
✅ 1. Use it on a blank chart
To avoid overlaying with default candles:
Open the chart of your preferred symbol
Click on the chart type (top toolbar: "Candles", "Bars", etc.)
Select "Blank" from the dropdown (this will hide all native candles)
Apply this indicator
This ensures only the filtered candles from the script are visible.
Adjust for your local timezone
This script uses a hardcoded timezone: "Asia/Kolkata"
If you are in a different timezone, change it to your own (e.g. "America/New_York", "Europe/London", etc.) in all instances of:
time(timeframe.period, "Asia/Kolkata")
timestamp("Asia/Kolkata", ...)
Use Cases:
Opening range behavior on specific weekdays/months
Detecting market anomalies during exact windows
Building visual logs of preferred trade hours
TVI-3 Z-Score: MA + VWAP + BB Composite🔧 Overview:
It combines:
Z-score of price relative to the 200-period simple moving average (MA)
Z-score of price relative to the 200-period VWAP (volume-weighted average price)
Z-score of Bollinger Band width
The result is an average of these three Z-scores, plotted as a composite indicator for identifying overvalued and undervalued conditions.
Momentum SNR VIP [3 TP + Max 50 Pip SL]//@version=6
indicator("Momentum SNR VIP ", overlay=true)
// === Settings ===
pip = input.float(0.0001, "Pip Size", step=0.0001)
sl_pip = 50 * pip
tp1_pip = 40 * pip
tp2_pip = 70 * pip
tp3_pip = 100 * pip
lookback = input.int(20, "Lookback for S/R", minval=5)
// === SNR ===
pivotHigh = ta.pivothigh(high, lookback, lookback)
pivotLow = ta.pivotlow(low, lookback, lookback)
supportZone = not na(pivotLow)
resistanceZone = not na(pivotHigh)
plotshape(supportZone, title="Support", location=location.belowbar, color=color.blue, style=shape.triangleup, size=size.tiny)
plotshape(resistanceZone, title="Resistance", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny)
// === Price Action ===
bullishEngulfing = close < open and close > open and close > open and open <= close
bearishEngulfing = close > open and close < open and close < open and open >= close
bullishPinBar = close < open and (low - math.min(open, close)) > 1.5 * math.abs(close - open)
bearishPinBar = close > open and (high - math.max(open, close)) > 1.5 * math.abs(close - open)
buySignal = supportZone and (bullishEngulfing or bullishPinBar)
sellSignal = resistanceZone and (bearishEngulfing or bearishPinBar)
// === SL & TP ===
rawBuySL = low - 10 * pip
buySL = math.max(close - sl_pip, rawBuySL)
buyTP1 = close + tp1_pip
buyTP2 = close + tp2_pip
buyTP3 = close + tp3_pip
rawSellSL = high + 10 * pip
sellSL = math.min(close + sl_pip, rawSellSL)
sellTP1 = close - tp1_pip
sellTP2 = close - tp2_pip
sellTP3 = close - tp3_pip
// === Plot Buy/Sell Signal
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// === Plot SL & TP lines
plot(buySignal ? buySL : na, title="Buy SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP1 : na, title="Buy TP1", color=color.green, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP2 : na, title="Buy TP2", color=color.green, style=plot.style_linebr, linewidth=1)
plot(buySignal ? buyTP3 : na, title="Buy TP3", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellSL : na, title="Sell SL", color=color.red, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP1 : na, title="Sell TP1", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP2 : na, title="Sell TP2", color=color.green, style=plot.style_linebr, linewidth=1)
plot(sellSignal ? sellTP3 : na, title="Sell TP3", color=color.green, style=plot.style_linebr, linewidth=1)
// === Labels
if buySignal
label.new(x=bar_index, y=buySL, text="SL : " + str.tostring(buySL, "#.0000"), style=label.style_label_down, color=color.red, textcolor=color.white)
label.new(x=bar_index, y=buyTP1, text="TP1 : " + str.tostring(buyTP1, "#.0000"), style=label.style_label_up, color=color.green, textcolor=color.white)
label.new(x=bar_index, y=buyTP2, text="TP2 : " + str.tostring(buyTP2, "#.0000"), style=label.style_label_up, color=color.green, textcolor=color.white)
label.new(x=bar_index, y=buyTP3, text="TP3 : " + str.tostring(buyTP3, "#.0000"), style=label.style_label_up, color=color.green, textcolor=color.white)
if sellSignal
label.new(x=bar_index, y=sellSL, text="SL : " + str.tostring(sellSL, "#.0000"), style=label.style_label_up, color=color.red, textcolor=color.white)
label.new(x=bar_index, y=sellTP1, text="TP1 : " + str.tostring(sellTP1, "#.0000"), style=label.style_label_down, color=color.green, textcolor=color.white)
label.new(x=bar_index, y=sellTP2, text="TP2 : " + str.tostring(sellTP2, "#.0000"), style=label.style_label_down, color=color.green, textcolor=color.white)
label.new(x=bar_index, y=sellTP3, text="TP3 : " + str.tostring(sellTP3, "#.0000"), style=label.style_label_down, color=color.green, textcolor=color.white)
// === Alerts
alertcondition(buySignal, title="Buy Alert", message="🟢 BUY at Support Zone + Price Action")
alertcondition(sellSignal, title="Sell Alert", message="🟡 SELL at Resistance Zone + Price Action")
CME Crude Oil 15-Min Multi-Unified Entry Zones (Dot Signals)//@version=6
indicator("CME Crude Oil 15-Min Multi-Unified Entry Zones (Dot Signals)", overlay=true)
// --- Input Parameters ---
emaLength = input.int(11, title="EMA Length", minval=1)
// Ichimoku Cloud Inputs (Adjusted for higher sensitivity)
conversionLineLength = input.int(7, title="Ichimoku Conversion Line Length (Sensitive)", minval=1)
baseLineLength = input.int(20, title="Ichimoku Base Line Length (Sensitive)", minval=1)
laggingSpanLength = input.int(40, title="Ichimoku Lagging Span Length (Sensitive)", minval=1)
displacement = input.int(26, title="Ichimoku Displacement", minval=1)
// MACD Inputs (Adjusted for higher sensitivity)
fastLength = input.int(9, title="MACD Fast Length (Sensitive)", minval=1)
slowLength = input.int(21, title="MACD Slow Length (Sensitive)", minval=1)
signalLength = input.int(6, title="MACD Signal Length (Sensitive)", minval=1)
// RSI Inputs
rsiLength = input.int(8, title="RSI Length", minval=1)
rsiOverbought = input.int(70, title="RSI Overbought Level", minval=50, maxval=90)
rsiOversold = input.int(30, title="RSI Oversold Level", minval=10, maxval=50)
// ADX Inputs
adxLength = input.int(14, title="ADX Length", minval=1)
adxTrendStrengthThreshold = input.int(20, title="ADX Trend Strength Threshold", minval=10, maxval=50)
// Weak Entry Threshold (50 ticks for Crude Oil, where 1 tick = $0.01)
// 50 ticks = $0.50
weakEntryTickThreshold = input.float(0.50, title="Weak Entry Threshold (in $)", minval=0.01)
// --- Indicator Calculations ---
// 1. EMA 11
ema11 = ta.ema(close, emaLength)
// 2. Ichimoku Cloud
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))
tenkanSen = donchian(conversionLineLength)
kijunSen = donchian(baseLineLength)
senkouSpanA = math.avg(tenkanSen, kijunSen)
senkouSpanB = donchian(laggingSpanLength)
// Shifted for plotting (future projection)
senkouSpanA_plot = senkouSpanA
senkouSpanB_plot = senkouSpanB
// Chikou Span (lagging span, plotted 26 periods back)
chikouSpan = close
// 3. MACD
= ta.macd(close, fastLength, slowLength, signalLength)
// 4. RSI
rsi = ta.rsi(close, rsiLength)
// 5. ADX
= ta.dmi(adxLength, adxLength)
// --- Price Volume Pattern Logic ---
// Simplified volume confirmation:
isVolumeIncreasing = volume > volume
isVolumeDecreasing = volume < volume
isPriceUp = close > close
isPriceDown = close < close
bullishVolumeConfirmation = (isPriceUp and isVolumeIncreasing) or (isPriceDown and isVolumeDecreasing)
bearishVolumeConfirmation = (isPriceDown and isVolumeIncreasing) or (isPriceUp and isVolumeDecreasing)
// --- Daily Pivot Point Calculation (Critical Support/Resistance) ---
// Request daily High, Low, Close for pivot calculation
= request.security(syminfo.tickerid, "D", [high , low , close ])
// Classic Pivot Point Formula
dailyPP = (dailyHigh + dailyLow + dailyClose) / 3
dailyR1 = (2 * dailyPP) - dailyLow
dailyS1 = (2 * dailyPP) - dailyHigh
dailyR2 = dailyPP + (dailyHigh - dailyLow)
dailyS2 = dailyPP - (dailyHigh - dailyLow)
// --- Crosses and States for Unified Entry 1 (EMA & MACD) ---
// Moved ta.cross() calls outside of conditional blocks for consistent calculation.
emaGoldenCrossCondition = ta.cross(close, ema11)
emaDeathCrossCondition = ta.cross(ema11, close)
macdGoldenCrossCondition = ta.cross(macdLine, signalLine)
macdDeathCrossCondition = ta.cross(signalLine, macdLine)
emaIsBullish = close > ema11
emaIsBearish = close < ema11
macdIsBullishStrong = macdLine > signalLine and macdLine > 0
macdIsBearishStrong = macdLine < signalLine and macdLine < 0
// --- Unified Entry 1 Logic (EMA & MACD) ---
unifiedLongEntry1 = false
unifiedShortEntry1 = false
if (emaGoldenCrossCondition and macdIsBullishStrong )
unifiedLongEntry1 := true
else if (macdGoldenCrossCondition and emaIsBullish )
unifiedLongEntry1 := true
if (emaDeathCrossCondition and macdIsBearishStrong )
unifiedShortEntry1 := true
else if (macdDeathCrossCondition and emaIsBearish )
unifiedShortEntry1 := true
// --- Unified Entry 2 Logic (Ichimoku & EMA/Volume) ---
unifiedLongEntry2 = false
unifiedShortEntry2 = false
ichimokuCloudBullish = close > senkouSpanA_plot and close > senkouSpanB_plot and
senkouSpanA_plot > senkouSpanB_plot and
tenkanSen > kijunSen and
chikouSpan > close
ichimokuCloudBearish = close < senkouSpanA_plot and close < senkouSpanB_plot and
senkouSpanB_plot > senkouSpanA_plot and
tenkanSen < kijunSen and
chikouSpan < close
// Moved ta.cross() calls outside of conditional blocks for consistent calculation.
ichimokuBullishTriggerCondition = ta.cross(tenkanSen, kijunSen)
ichimokuBearishTriggerCondition = ta.cross(kijunSen, tenkanSen)
priceCrossAboveSenkouA = ta.cross(close, senkouSpanA_plot)
priceCrossBelowSenkouA = ta.cross(senkouSpanA_plot, close)
if (ichimokuBullishTriggerCondition or (priceCrossAboveSenkouA and close > senkouSpanB_plot)) and
emaIsBullish and
bullishVolumeConfirmation
unifiedLongEntry2 := true
if (ichimokuBearishTriggerCondition or (priceCrossBelowSenkouA and close < senkouSpanB_plot)) and
emaIsBearish and
bearishVolumeConfirmation
unifiedShortEntry2 := true
// --- Weak Entry Logic ---
weakLongEntry = false
weakShortEntry = false
// Function to check for weak long entry
// Checks if the distance to the nearest resistance (R1 or R2) is less than the threshold
f_isWeakLongEntry(currentPrice) =>
bool isWeak = false
// Check R1 if it's above current price and within threshold
if dailyR1 > currentPrice and (dailyR1 - currentPrice < weakEntryTickThreshold)
isWeak := true
// Check R2 if it's above current price and within threshold (only if not already weak by R1)
else if dailyR2 > currentPrice and (dailyR2 - currentPrice < weakEntryTickThreshold)
isWeak := true
isWeak
// Function to check for weak short entry
// Checks if the distance to the nearest support (S1 or S2) is less than the threshold
f_isWeakShortEntry(currentPrice) =>
bool isWeak = false
// Check S1 if it's below current price and within threshold
if dailyS1 < currentPrice and (currentPrice - dailyS1 < weakEntryTickThreshold)
isWeak := true
// Check S2 if it's below current price and within threshold (only if not already weak by S1)
else if dailyS2 < currentPrice and (currentPrice - dailyS2 < weakEntryTickThreshold)
isWeak := true
isWeak
// Apply weak entry check to Unified Entry 1
if unifiedLongEntry1 and f_isWeakLongEntry(close)
weakLongEntry := true
if unifiedShortEntry1 and f_isWeakShortEntry(close)
weakShortEntry := true
// Apply weak entry check to Unified Entry 2
if unifiedLongEntry2 and f_isWeakLongEntry(close)
weakLongEntry := true
if unifiedShortEntry2 and f_isWeakShortEntry(close)
weakShortEntry := true
// --- Enhanced Entry Conditions with RSI and ADX ---
// Removed candlestick pattern requirement.
// Only consider an entry if RSI is not overbought/oversold AND ADX indicates trend strength.
// Enhanced Long Entry Condition
enhancedLongEntry = (unifiedLongEntry1 or unifiedLongEntry2) and
(rsi < rsiOverbought) and // RSI not overbought
(adx > adxTrendStrengthThreshold) // ADX shows trend strength
// Enhanced Short Entry Condition
enhancedShortEntry = (unifiedShortEntry1 or unifiedShortEntry2) and
(rsi > rsiOversold) and // RSI not oversold
(adx > adxTrendStrengthThreshold) // ADX shows trend strength
// --- Define colors as variables for clarity and to potentially resolve parsing issues ---
// Changed named color constants to hexadecimal values
var color strongBuyDotColor = #FFD700 // Gold
var color weakBuyDotColor = #008000 // Green
var color strongSellDotColor = #FFFFFF // White
var color weakSellDotColor = #FF0000 // Red
// --- Plotting Entry Dots on Candlesticks ---
// Define conditions for plotting only on the *first* occurrence of a signal
isNewStrongBuy = enhancedLongEntry and not weakLongEntry and not (enhancedLongEntry and not weakLongEntry )
isNewWeakBuy = enhancedLongEntry and weakLongEntry and not (enhancedLongEntry and weakLongEntry )
isNewStrongSell = enhancedShortEntry and not weakShortEntry and not (enhancedShortEntry and not weakShortEntry )
isNewWeakSell = enhancedShortEntry and weakShortEntry and not (enhancedShortEntry and weakShortEntry )
// Helper functions to check candlestick type
isCurrentCandleBullish = close > open
isCurrentCandleBearish = close < open
// Strong Buy: Gold dot (only on bullish candles)
plotshape(isNewStrongBuy and isCurrentCandleBullish ? close : na, title="Strong B", location=location.absolute, color=strongBuyDotColor, style=shape.circle, size=size.tiny)
// Weak Buy: Solid Green dot (no candlestick filter for weak buys)
// Changed text to "" and style to shape.triangleup for symbol only
plotshape(isNewWeakBuy ? close : na, title="Weak B", location=location.absolute, color=weakBuyDotColor, style=shape.triangleup, size=size.tiny)
// Strong Sell: White dot (only on bearish candles)
plotshape(isNewStrongSell and isCurrentCandleBearish ? close : na, title="Strong S", location=location.absolute, color=strongSellDotColor, style=shape.circle, size=size.tiny)
// Weak Sell: Red dot (no candlestick filter for weak sells)
// Changed text to "" and style to shape.triangledown for symbol only
plotshape(isNewWeakSell ? close : na, title="Weak S", location=location.absolute, color=weakSellDotColor, style=shape.triangledown, size=size.tiny)
// --- Plotting Indicators (Optional, for visual confirmation) ---
// All indicator plots have been removed as requested.
// plot(ema11, title="EMA 11", color=emaColor)
// plot(tenkanSen, title="Tenkan-Sen", color=tenkanColor)
// plot(kijunSen, title="Kijun-Sen", color=kijunColor)
// plot(senkouSpanA_plot, title="Senkou Span A", color=senkouAColor, offset=displacement)
// plot(senkouSpanB_plot, title="Senkou Span B", color=senkouBColor, offset=displacement)
// fill(plot(senkouSpanA_plot, offset=displacement), plot(senkouSpanB_plot, offset=displacement), color=cloudFillBullishColor, title="Cloud Fill Bullish")
// fill(plot(senkouSpanA_plot, offset=displacement), plot(senkouSpanB_plot, offset=displacement), color=cloudFillBearishColor, title="Cloud Fill Bearish")
// plot(chikouSpan, title="Chikou Span", color=chikouColor, offset=-displacement)
// plot(macdLine, title="MACD Line", color=macdLineColor, display=display.pane)
// plot(signalLine, title="Signal Line", color=signalLineColor, display=display.pane)
// plot(hist, title="Histogram", color=hist >= 0 ? histGreenColor : histRedColor, style=plot.style_columns, display=display.pane)
// plot(rsi, title="RSI", color=rsiPlotColor, display=display.pane)
// hline(rsiOverbought, "RSI Overbought", color=rsiHlineRedColor, linestyle=hline.style_dashed, display=display.all)
// hline(rsiOversold, "RSI Oversold", color=rsiHlineGreenColor, linestyle=hline.style_dashed, display=display.all)
// plot(adx, title="ADX", color=adxPlotColor, display=display.pane)
// hline(adxTrendStrengthThreshold, "ADX Threshold", color=adxHlineColor, linestyle=hline.style_dashed, display=display.all)
// plot(diPlus, title="+DI", color=diPlusColor, display=display.pane)
// plot(diMinus, title="-DI", color=diMinusColor, display=display.pane)
// plot(dailyPP, title="Daily PP", color=dailyPPColor, style=plot.style_line, linewidth=1)
// plot(dailyR1, title="Daily R1", color=dailyRColor, style=plot.style_line, linewidth=1)
// plot(dailyR2, title="Daily R2", color=dailyRColor, style=plot.style_line, linewidth=1)
// plot(dailyS1, title="Daily S1", color=dailySColor, style=plot.style_line, linewidth=1)
// plot(dailyS2, title="Daily S2", color=dailySColor, style=plot.style_line, linewidth=1)
// --- Alerts (Optional) ---
alertcondition(enhancedLongEntry and not weakLongEntry, title="Strong Buy Alert", message="CME Crude Oil: Strong Buy Entry!")
alertcondition(enhancedLongEntry and weakLongEntry, title="Weak Buy Alert", message="CME Crude Oil: Weak Buy Entry Detected!")
alertcondition(enhancedShortEntry and not weakShortEntry, title="Strong Sell Alert", message="CME Crude Oil: Strong Sell Entry!")
alertcondition(enhancedShortEntry and weakShortEntry, title="Weak Sell Alert", message="CME Crude Oil: Weak Sell Entry Detected!")
MACD Ignored Candle SignalsGBI AND RBI WITH MACD CONFIRMATION
Gives buy and sell signals based on a simple candlestick pattern that co-aligns with the macd momentum. earliest signals based on the trend are usually the best entries
Polynomial Regression + RSI Explosive Zones// Sonic R
EMA_len = input.int(89, title="EMA Signal Length")
HiLoLen = input.int(34, title="PAC EMA Length")
// Polynomial Regression
regression_length = input.int(10, title="Regression Length")
fractal_size = input.int(2, title="Fractal Size")
// Color inputs for regression
colorMid = input.color(color.red, title="Mid Line Color")
colorMax = input.color(color.orange, title="Max Line Color")
colorMin = input.color(color.green, title="Min Line Color")
colorUpper = input.color(color.blue, title="Upper Line Color")
colorLower = input.color(color.purple, title="Lower Line Color")
// === SONIC R ===
// PAC lines
pacC = ta.ema(close, HiLoLen)
pacL = ta.ema(low, HiLoLen)
pacH = ta.ema(high, HiLoLen)
plot(pacL, title="PAC Low EMA", color=color.new(color.blue, 50))
plot(pacH, title="PAC High EMA", color=color.new(color.blue, 50))
plot(pacC, title="PAC Close EMA", color=color.new(color.blue, 0), linewidth=2)
fill(plot(pacL), plot(pacH), color=color.aqua, transp=90, title="Fill PAC")
// EMA lines
ema610 = ta.ema(close, 610)
ema200 = ta.ema(close, 200)
emaSignal = ta.ema(close, EMA_len)
plot(ema610, title="EMA 610", color=color.white)
plot(ema200, title="EMA 200", color=color.fuchsia)
plot(emaSignal, title="EMA Signal", color=color.orange, linewidth=2)
Entry Signal: Price X% Lower Than OpenEntry signal printed when current price is below a certain threshold compared to open
Avg High/Low Lines with TP & SL아래 코드는 TradingView Pine Script v6으로 작성된 스크립트로, 주어진 캔들 수 동안의 평균 고가와 저가를 계산해서 그 위에 수평선을 그리며, 해당 수평선 돌파 시 진입 가격을 기록하고, 손절가(SL)와 목표가(TP)를 자동으로 계산하여 표시하는 전략입니다. 알림(alert) 기능도 포함되어 있습니다.
코드 주요 기능 요약
length 기간 동안 평균 고가, 저가를 단순 이동평균(SMA)으로 계산
평균 고가선, 저가선 수평선을 일정 바 개수만큼 좌우 연장하여 차트에 표시
평균 고가 돌파 시 매수 진입, 평균 저가 돌파 시 매도 진입 처리
진입 가격 저장 및 상태 관리 (inLong, inShort 플래그)
손절가(SL): 롱이면 평균 저가, 숏이면 평균 고가
목표가(TP): 진입가에서 손절 거리의 1.5배만큼 설정
진입가 기준으로 TP, SL 라인과 라벨 표시
상단 돌파 후 종가 마감 시 매수 알림, 하단 돌파 후 종가 마감 시 매도 알림
Sure! Here’s the English explanation of your TradingView Pine Script v6 code:
Summary of Key Features
Calculates the simple moving average (SMA) of the high and low prices over a user-defined number of candles (length).
Draws horizontal lines for the average high and average low, extending them a specified number of bars to the left and right on the chart.
Detects breakouts above the average high to trigger a long entry, and breakouts below the average low to trigger a short entry.
Records the entry price and manages trade states using flags (inLong, inShort).
Sets the stop loss (SL) at the average low for long positions, and at the average high for short positions.
Calculates the take profit (TP) level based on the entry price plus 1.5 times the stop loss distance.
Draws lines and labels for the TP and SL levels starting from the entry bar, extended to the right.
Sends alerts when the price closes above the average high after a breakout (long signal), or closes below the average low after a breakout (short signal).
-onestar-
Khalid's Custom ForecastThe indicator printed on the chart is as expected beads on the information for last 5 years , this indicator could be linked to others to give future price actions