YTPBTC1HATRSSADXTitle:
High-Precision Breakout ATR Trailing Strategy with ADX Filtering for BTC 1H
Description:
YTPBTC1HATRSSADX is a precision-engineered 1-hour BTC breakout strategy utilizing adaptive ATR-based stop systems and optional ADX filtering to enhance trade quality and dynamic risk management. The system enters positions upon confirmed breakouts above/below N-period highs/lows, while aligning with trend conditions determined by a long-term RMA filter.
Key features:
✅ Adaptive ATR stop management with dual-phase logic: initial stop placement followed by dynamic trailing after reaching profit thresholds.
✅ Optional ADX filtering to confirm directional strength before entry, reducing false signals during choppy markets.
✅ Dynamic pullback-based take-profit system, locking in profits during high volatility conditions without sacrificing upside potential.
✅ Clear on-chart visualization of entry levels, ATR stops, breakout levels, and trend background color for intuitive monitoring.
✅ Fully parameterized for ATR period, multiplier, breakout period, RMA trend period, ADX threshold, and pullback settings to adjust according to market conditions.
This strategy is designed for traders seeking robust trend-following breakout entries while systematically managing risk with ATR and maximizing profit potential through trailing and pullback exit logic. Ideal for BTC perpetual futures and margin trading environments requiring disciplined execution.
Test on BTCUSDTPERP 1H to explore its consistency across different volatility regimes, and adjust parameters to align with your risk appetite and capital allocation strategies.
Indicators and strategies
MACD HTF Crossover SignalsHigher time frame MACD, I like it
/
/
/
/
Trading view wants me to elaborate so in my opinion indicators on higher time frames work better on smaller time frames. Good
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
Custom Daily Session Zones by KoenigseggCustom Daily Session Zones
🟣 Description
This indicator displays customizable trading session time zones as background highlights on your chart, on any timeframe you choose. The inline info tooltip provides the precise start and end times of the three largest market sessions—the US, the EU, and ASIA—for quick reference. It provides flexible control over session times for different days of the week, making it ideal for traders who need to visualize specific market hours or trading sessions.
🟣 Key Features
- Flexible Session Configuration: Set a common session time for all days or customize individual sessions for each day of the week
- Per-Day Control: Enable or disable sessions for specific days (Monday through Sunday)
- Color Customization: Choose unique colors for each day's session zones
- UTC Timezone Standard: All session times are defined in UTC to ensure consistency across charts
- Clean Visual Display: Non-intrusive background highlighting that doesn't interfere with price action
🟣 How to Use
- Common Session Mode: Use the default mode to apply the same session time across all enabled days
- Manual Per-Day Mode: Enable "Manual per-day sessions" to set different session times for each day
- Day Selection: Toggle individual days on/off based on your trading schedule
- Color Coding: Customize colors for each day to easily distinguish between different sessions
🟣 Technical Details
- Uses Pine Script v6 for optimal performance
- Implements proper session time detection using TradingView's built-in time functions
- Operates in UTC timezone for all session calculations
- Lightweight code that doesn't impact chart performance
🟣 Use Cases
- Highlight specific trading sessions (London, New York, Tokyo, etc.)
- Mark important market hours for your trading strategy
- Visualize different session overlaps
- Create custom trading time windows
- Track market activity during specific hours
🟣 Compatibility
- Works on all timeframes
- Compatible with all asset classes (Forex, Stocks, Crypto, Futures, etc.)
- Supports all TradingView chart types
- Responsive design that adapts to different screen sizes
🟣 Image Descriptions
- First Image (main image): Shows multiple New York Stock Exchange sessions from 1:30 p.m. to 8:00 p.m. (UTC), on the 15-minute timeframe, with each day’s zone colored differently to demonstrate the indicator’s customizable color settings.
- Second Image: A zoomed‑in fractal chart view of the same New York session on the 15-minute timeframe, illustrating how the background session zone appears even at higher detail levels.
Third Image: A close‑up of the New York session (1:30 p.m. to 8:00 p.m.) on the 3-minute timeframe, reaffirming the consistency of zone highlighting across different zoom levels.
🟣 Future Updates (v2)
In the next release, you’ll be able to define multiple session blocks per day—displaying two distinct colored zones within the same trading day. This will help you visualize when one market session ends and another begins without losing chart clarity.
🟣 Conclusion
This indicator is perfect for traders who need precise control over Market Session visualization and want to maintain a clean, professional chart appearance.
🟣 Disclaimer
This script is provided for educational and illustrative purposes only. It is not financial or trading advice, nor a recommendation to buy or sell any asset. Always conduct your own research and consult a professional before making any trading decisions.
GX Credit Spread SignalThe GX Credit Spread Signal is an advanced indicator designed for traders who trade options strategies on the SPX index, especially using vertical credit spreads. It combines traditional technical analysis with volatility and option pricing concepts to provide relevant signals and projections on the chart.
Main features:
Trend analysis: Uses opening gap, position relative to VWAP and simple moving average (SMA 50) to indicate bullish or bearish bias right after the first 15-minute candle.
Safe range projection: Calculates a range based on the ATR (Average True Range) multiplied by a safety factor, suggesting potential strikes for credit spreads.
Quantitative estimates:
Calculates the estimated delta of options via the Black-Scholes formula approximation.
Estimated probability of expiring out of the money (OTM).
Chart visualizations: Displays projected ATR lines, previous day's levels (high, low, close) and an informative panel with strikes, delta, OTM probability, ATR and VWAP data.
Configurable alerts: Notifications for detected bullish or bearish bias, helping the trader to identify opportunities quickly.
This indicator is ideal for those who day trade with SPX options, facilitating decision-making by combining technical analysis, volatility and option probabilities in one place.
Daily 10-ATR & %ATR (Top Right)Better version to be able to see ATR and the percentage it has moved at a glance, no charting just the numbers
ATR Label (Top Right)Final version easier to run daily ATR first, then move to lower time frames, only purpose is to see the ATR quick
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.
Normalized 180-Day RP Change (Z-Score)180 day RP change with less alpha decay, good for picking tops on 1d tf
Day and DateA simple indicator that show day and date at the start of each day. This is usefull in case you are downloading charts or get confused when studying past charts for expiry and non expiry day actions.
Previous 10 Weekly Highs/LowsNewer vweionnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Previous 10 Weekly Highs/LowscilcvieowhvioewfvhgweiofgheaoifgascvgaucgfvUfgiocfgacfbaofcgaeo8gfhhfioqlkea
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")
Time Zone (with weekends)//@version=5
indicator("Time Zone (with weekends)", overlay=true)
// Задаём сессию — например, с 01:00 до 13:00 UTC
sessionTime = input.session("0100-1300", "Временной промежуток")
zoneColor = input.color(color.new(color.blue, 85), "Цвет зоны")
// Проверка, попадает ли текущий бар во временной промежуток
inTimeZone = time(timeframe.period, sessionTime)
// Закрашиваем фон
bgcolor(inTimeZone ? zoneColor : na)
BTC 现货与期货溢价指数█ Overview / 核心理念
This indicator measures the price difference between the Spot and Futures markets to reveal the true driver of market momentum.
本指标通过衡量现货与期货市场的价格差异,旨在揭示市场动能的真实驱动力。
It helps you answer a key question: Is the current trend driven by solid institutional spot buying or by speculative sentiment in the futures market?
它帮助您回答一个关键问题:当前趋势是由坚实的机构现货买盘驱动,还是由期货市场的投机情绪主导?
█ Core Logic & Calculation / 核心计算逻辑
The core logic is simple yet powerful: Premium = Spot Price - Futures Price.
其核心逻辑简单而强大:溢价 = 现货价格 - 期货价格。
Positive Value (Green Bars): "Spot Premium"
正值 (绿色柱): “现货溢价”
This means the spot price is higher than the futures price. It's a strong bullish signal, suggesting significant spot buying pressure, likely from institutions.
这意味着现货价格高于期货价格。这是一个强烈的看涨信号,通常意味着存在巨大的现货买盘压力,可能来自机构。
Negative Value (Red Bars): "Futures Premium"
负值 (红色柱): “期货溢价”
This means the futures price is higher than the spot price. It indicates that bullish sentiment is more concentrated in the futures market, or that there is selling pressure in the spot market.
这意味着期货价格高于现货价格。这表明看涨情绪更多地集中在期货市场,或现货市场存在抛售压力。
█ How to Read the Chart / 如何解读图表
Premium Histogram / 溢价柱状图
The height of the bars represents the magnitude of the price difference. Taller bars indicate a greater divergence between the two markets and more extreme sentiment.
柱体的高度代表了价格差异的大小。柱体越高,意味着两个市场之间的分歧越大,情绪越极端。
Zero Line / 零轴
This is the watershed between spot-led and futures-led dominance.
这是现货主导与期货主导的分水岭。
Info Panel / 信息面板
A real-time display in the top-right corner shows the current Spot Price, Futures Price, and the precise Premium value.
位于右上角的信息面板,实时显示当前的现货价格、期货价格以及精确的溢价数值。
█ Trading Strategies & Advanced Interpretation / 交易策略与高级解读
The essence of this indicator lies in analyzing the synergy and divergence between price action and premium changes to identify the dominant market force.
本指标的精髓在于结合价格行为与溢价变化,判断出当前主导市场是现货还是期货,从而进行同步或背离分析。
█ Alert System / 警报系统
The indicator includes two built-in alerts based on Bollinger Bands to catch extreme sentiment.
本指标包含两个基于布林带的内置警报,用以捕捉极端情绪。
Spot Premium Too High (Cross Up):
现货溢价过高 (向上突破):
Triggers when the green premium bar breaks above the upper Bollinger Band. It signals that spot buying has become excessively "euphoric" and may be due for a short-term cooldown.
当绿色溢价柱向上突破布林带上轨时触发。这标志着现货买盘已进入极度的“狂热”状态,短期内可能面临回调。
Futures Premium Too High / Spot Selling Pressure (Cross Down):
期货溢价过高 / 现货抛压 (向下突破):
Triggers when the premium bar breaks below the lower Bollinger Band (deeply negative). It signals intense spot selling pressure or panic, confirming strong bearish sentiment.
当溢价柱向下突破布林带下轨(负值极大)时触发。这标志着强烈的现货抛压或市场恐慌,是看跌情绪强烈的确认信号。
█ Disclaimer / 免责声明
This tool is based on the theory that the spot market has a dominant influence on major trends. Its effectiveness depends on this condition holding true.
本工具的理论基础是“现货市场对主要趋势具有主导影响力”。其有效性取决于该条件的成立。
This indicator is for educational and research purposes only. It does not constitute financial advice. Please use it in conjunction with your own trading system and risk management.
本指标仅用于教育和研究目的,不构成任何财务建议。请结合您自己的交易系统和风险管理进行使用。
Author ID:We1h0.eth
Author X:https://x.com/we1h0
H BollingerBollinger Bands are a widely used technical analysis indicator that helps spot relative price highs and lows. The tool comprises three lines: a central band representing the 20-period simple moving average (SMA), and upper and lower bands usually placed two standard deviations above and below the SMA. These bands adjust with market volatility, offering insights into price fluctuations and trading conditions.
How this indicator works
Bollinger Bands helps traders assess price volatility and potential price reversals. They consist of three bands: the middle band, the upper band, and the lower band. Here's how Bollinger Bands work:
Middle band: This is typically a simple moving average (SMA) of the asset's price over a specified period. The most common period used is 20 days.
Upper band: This is calculated by adding a specified number of standard deviations to the middle band. The standard deviation measures the asset's price volatility. Commonly, two standard deviations are added to the middle band.
Lower band: Similar to the upper band, it is calculated by subtracting a specified number of standard deviations from the middle band.
What do Bollinger Bands tell you?
Bollinger bands primarily indicate the level of market volatility and trading opportunities. Narrow bands indicate low market volatility, while wide bands suggest high market volatility. Bollinger bands indicators can be used by traders to assess potential buy or sell signals. For instance, a sell signal may be interpreted or generated if the asset’s price moves closer or crosses the upper band, as it may indicate that the asset is overbought. Alternatively, a buy signal may be interpreted or generated if the price moves closer to the lower band, as it may signify that the asset is oversold.
However, traders should be cautious when using Bollinger Bands as standalone indicators when making trading decisions. Experienced traders refrain from confirming signals based on one indicator. Instead, they generally combine various technical indicators and fundamental analysis methods to make informed trading decisions. Basing trading decisions on only one indicator can result in misinterpretation of signals and heavy losses.
Bollinger Bands assist in identifying whether prices are relatively high or low. They are applied as a pair—upper and lower bands—alongside a moving average. However, these bands are not designed to be used in isolation. Instead, they should be used to validate signals generated by other technical indicators.
Calculation of Bollinger Band
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!")