Full Day Midpoint Line with Dynamic StdDev Bands (ETH & RTH)A Pine Script indicator designed to plot a midpoint line based on the high and low prices of a user-defined trading session (typically Extended Trading Hours, ETH) and to add dynamic standard deviation (StdDev) bands around this midpoint.
Session Midpoint Line:
The midpoint is calculated as the average of the session's highest high and lowest low during the defined ETH period (e.g., 4:00 AM to 8:00 PM).
This line represents a central tendency or "fair value" for the session, similar to a pivot point or volume-weighted average price (VWAP) anchor.
Interpretation:
Prices above the midpoint suggest bullish sentiment, while prices below indicate bearish sentiment.
The midpoint can act as a dynamic support/resistance level, where price may revert to or react at this level during the session.
Dynamic StdDev Bands:
The bands are calculated by adding/subtracting a multiple of the standard deviation of the midpoint values (tracked in an array) from the midpoint.
The standard deviation is dynamically computed based on the historical midpoint values within the session, making the bands adaptive to volatility.
Interpretation:
The upper and lower bands represent potential overbought (upper) and oversold (lower) zones.
Prices approaching or crossing the bands may indicate stretched conditions, potentially signaling reversals or breakouts.
Trend Identification:
Use the midpoint as a reference for the session’s trend. Persistent price action above the midpoint suggests bullishness, while below indicates bearishness.
Combine with other indicators (e.g., moving averages, RSI) to confirm trend direction.
Support/Resistance Trading:
Treat the midpoint as a dynamic pivot point. Price rejections or consolidations near the midpoint can be entry points for mean-reversion trades.
The StdDev bands can act as secondary support/resistance levels. For example, price reaching the upper band may signal a potential short entry if accompanied by reversal signals.
Breakout/Breakdown Strategies:
A strong move beyond the upper or lower band may indicate a breakout (bullish above upper, bearish below lower). Confirm with volume or momentum indicators to avoid false breakouts.
The dynamic nature of the bands makes them useful for identifying significant price extensions.
Volatility Assessment:
Wider bands indicate higher volatility, suggesting larger price swings and potentially riskier trades.
Narrow bands suggest consolidation, which may precede a breakout. Traders can prepare for volatility expansions in such scenarios.
The "Full Day Midpoint Line with Dynamic StdDev Bands" is a versatile and visually intuitive indicator well-suited for day traders focusing on session-specific price action. Its dynamic midpoint and volatility-adjusted bands provide valuable insights into support, resistance, and potential reversals or breakouts.
Göstergeler ve stratejiler
Trend Signale: EMA Crossovers & Exit Signale✅ Explanation of the Changes:
Uptrend:
Detected when EMA8 crosses above EMA20 (Condition: crossover_up).
Downtrend:
Detected when EMA8 crosses below EMA20 (Condition: crossunder_down).
Exit Signals:
Exit Uptrend: When the close falls below EMA20 (Condition: exit_uptrend).
Exit Downtrend: When the close rises above EMA20 (Condition: exit_downtrend).
Alerts:
Uptrend Alert: When EMA8 > EMA20.
Downtrend Alert: When EMA8 < EMA20.
Exit Uptrend Alert: When the close falls below EMA20.
Exit Downtrend Alert: When the close rises above EMA20.
✅ Alert Settings:
For the Uptrend:
Select the condition EMA Crossover Up and set the alert to “Once per bar.”
Message: “📈 Uptrend detected: EMA8 crosses above EMA20”
For the Downtrend:
Select the condition EMA Crossover Down and set the alert to “Once per bar.”
Message: “📉 Downtrend detected: EMA8 crosses below EMA20”
For the Exit Signal in an Uptrend:
Select the condition Exit Uptrend and set the alert to “Once per bar.”
Message: “⚠️ Exit Uptrend: Close below EMA20”
For the Exit Signal in a Downtrend:
Select the condition Exit Downtrend and set the alert to “Once per bar.”
Message: “⚠️ Exit Downtrend: Close above EMA20”
✅ Chart Visualization:
Uptrend: A green arrow “↑” below the candle.
Downtrend: A red arrow “↓” above the candle.
Exit Uptrend: An orange arrow “↓” above the candle.
Exit Downtrend: A purple arrow “↑” below the candle
Wick Spike 50% Detector (15m & 1h)This script identifies candles with significant upper or lower wicks (spikes) based on a percentage of the total candle range. It helps spot potential reversals, exhaustion moves, or liquidity grabs — especially useful in volatile markets.
📍 Key Features:
15-Minute Timeframe:
Red Triangle Above: Candle range ≥ 0.35% and upper wick ≥ 50% of the range.
Green Triangle Below: Candle range ≥ 0.30% and lower wick ≥ 50% of the range.
1-Hour Timeframe:
Red Circle Above: Candle range ≥ 0.50% and upper wick ≥ 50%.
Green Circle Below: Candle range ≥ 0.50% and lower wick ≥ 50%.
📢 Alerts:
Alerts trigger when the 50% spike condition is met — within the last 60 seconds before candle close — ensuring timely notifications.
🎯 Designed to assist traders in identifying spike-driven opportunities and refining entry/exit strategies.
Tradecademy CandlesThe script highlights high-volume candles .
Upward candles with significantly increased volume = green
Upward candles with moderately increased volume = blue
Downward candles with significantly increased volume = red
Downward candles with moderately increased volume = pink
MTF StochRSI SignalsThe idea is to have a lower timeframe Stochastic RSI and a higher timeframe Stochastic RSI for big picture analysis.
An alert pops whenever the lower timeframe stochastic RSI aligns with an existing higher timeframe.
The general theme is to trade in the direction of the longer trend.
🚀 KRAL / KING ROKET - Stoch RSI & CCI ComboHello. I am publishing a strategy that captures an uptrend with cci and stoch rsi indicators. You can parametrically optimize the stoch rsi lower band value, cci lower band value and cci based ma lower band values according to the product you are following.
Mimas buy and sellBollinger Bands: Calculated using a simple moving average (basis) and standard deviation (dev).
EMAs: Two exponential moving averages (EMA 5 and EMA 20) are plotted to identify short-term and long-term trends.
Price Action Patterns: The script detects higher highs and higher lows for bullish conditions, and lower highs and lower lows for bearish conditions.
Trend Strength: An exponential moving average of the price change is used to gauge the strength of the trend.
Trade Signals: Buy and sell signals are plotted on the chart when specific conditions are met, combining price action patterns, trend strength, Bollinger Bands, and EMA crossovers.
Take-Profit Levels: Dynamic take-profit levels are calculated based on recent swing highs and lows, adjusted by a user-defined multiplier. These levels are displayed on the chart using plot to draw horizontal lines.
Heikin Ashi Color with Regular CandlesUses HA candle colors for normal candles. Can be used to identify the trend keeping the structure of normal candles.
For this to work default colors for candles body, wick must be set a transparent.
Quadruple EMA (QEMA)The Quadruple Exponential Moving Average (QEMA) is an advanced technical indicator that extends the concept of lag reduction beyond TEMA (Triple Exponential Moving Average) to a fourth order. By applying a sophisticated four-stage EMA cascade with optimized coefficient distribution, QEMA provides the ultimate evolution in EMA-based lag reduction techniques.
Unlike traditional compund moving averages like DEMA and TEMA, QEMA implements a progressive smoothing system that strategically distributes alphas across four EMA stages and combines them with balanced coefficients (4, -6, 4, -1). This approach creates an indicator that responds extremely quickly to price changes while still maintaining sufficient smoothness to be useful for trading decisions. QEMA is particularly valuable for traders who need the absolute minimum lag possible in trend identification.
▶️ **Core Concepts**
Fourth-order processing: Extends the EMA cascade to four stages for maximum possible lag reduction while maintaining a useful signal
Progressive alpha system: Uses mathematically derived ratio-based alpha progression to balance responsiveness across all four EMA stages
Optimized coefficients: Employs calculated weights (4, -6, 4, -1) to effectively eliminate lag while preserving compound signal stability
Numerical stability control: Implements initialization and alpha distribution to ensure consistent results from the first calculation bar
QEMA achieves its exceptional lag reduction by combining four progressive EMAs with mathematically optimized coefficients. The formula is designed to maximize responsiveness while minimizing the overshoot problems that typically occur with aggressive lag reduction techniques. The implementation uses a ratio-based alpha progression that ensures each EMA stage contributes appropriately to the final result.
▶️ **Common Settings and Parameters**
Period: Default: 15| Base smoothing period | When to Adjust: Decrease for extremely fast signals, increase for more stable output
Alpha: Default: auto | Direct control of base smoothing factor | When to Adjust: Manual setting allows precise tuning beyond standard period settings
Source: Default: Close | Data point used for calculation | When to Adjust: Change to HL2 or HLC3 for more balanced price representation
Pro Tip: Professional traders often use QEMA with longer periods than other moving averages (e.g., QEMA(20) instead of EMA(10)) since its extreme lag reduction provides earlier signals even with longer periods.
▶️ **Calculation and Mathematical Foundation**
Simplified explanation:
QEMA works by calculating four EMAs in sequence, with each EMA taking the previous one as input. It then combines these EMAs using balancing weights (4, -6, 4, -1) to create a moving average with extremely minimal lag and high level of smoothness. The alpha factors for each EMA are progressively adjusted using a mathematical ratio to ensure balanced responsiveness across all stages.
Technical formula:
QEMA = 4 × EMA₁ - 6 × EMA₂ + 4 × EMA₃ - EMA₄
Where:
EMA₁ = EMA(source, α₁)
EMA₂ = EMA(EMA₁, α₂)
EMA₃ = EMA(EMA₂, α₃)
EMA₄ = EMA(EMA₃, α₄)
α₁ = 2/(period + 1) is the base smoothing factor
r = (1/α₁)^(1/3) is the derived ratio
α₂ = α₁ × r, α₃ = α₂ × r, α₄ = α₃ × r are the progressive alphas
Mathematical Rationale for the Alpha Cascade:
The QEMA indicator employs a specific geometric progression for its smoothing factors (alphas) across the four EMA stages. This design is intentional and aims to optimize the filter's performance. The ratio between alphas is **r = (1/α₁)^(1/3)** - derived from the cube root of the reciprocal of the base alpha.
For typical smoothing (α₁ < 1), this results in a sequence of increasing alpha values (α₁ < α₂ < α₃ < α₄), meaning that subsequent EMAs in the cascade are progressively faster (less smoothed). This specific progression, when combined with the QEMA coefficients (4, -6, 4, -1), is chosen for the following reasons:
1. Optimized Frequency Response:
Using the same alpha for all EMA stages (as in a naive multi-EMA approach) can lead to an uneven frequency response, potentially causing over-shooting of certain frequencies or creating undesirable resonance. The geometric progression of alphas in QEMA helps to create a more balanced and controlled filter response across a wider range of movement frequencies. Each stage's contribution to the overall filtering characteristic is more harmonized.
2. Minimized Phase Lag:
A key goal of QEMA is extreme lag reduction. The specific alpha cascade, particularly the relationship defined by **r**, is designed to minimize the cumulative phase lag introduced by the four smoothing stages, while still providing effective noise reduction. Faster subsequent EMAs contribute to this reduced lag.
🔍 Technical Note: The ratio-based alpha progression is crucial for balanced response. The ratio r is calculated as the cube root of 1/α₁, ensuring that the combined effect of all four EMAs creates a mathematically optimal response curve. All EMAs are initialized with the first source value rather than using progressive initialization, eliminating warm-up artifacts and providing consistent results from the first bar.
▶️ **Interpretation Details**
QEMA provides several key insights for traders:
When price crosses above QEMA, it signals the beginning of an uptrend with minimal delay
When price crosses below QEMA, it signals the beginning of a downtrend with minimal delay
The slope of QEMA provides immediate insight into trend direction and momentum
QEMA responds to price reversals significantly faster than other moving averages
Multiple QEMA lines with different periods can identify immediate support/resistance levels
QEMA is particularly valuable in fast-moving markets and for short-term trading strategies where speed of signal generation is critical. It excels at capturing the very beginning of trends and identifying reversals earlier than any other EMA-derived indicator. This makes it especially useful for breakout trading and scalping strategies where getting in early is essential.
▶️ **Limitations and Considerations**
Market conditions: Can generate excessive signals in choppy, sideways markets due to its extreme responsiveness
Overshooting: The aggressive lag reduction can create some overshooting during sharp reversals
Calculation complexity: Requires four separate EMA calculations plus coefficient application, making it computationally more intensive
Parameter sensitivity: Small changes in the base alpha or period can significantly alter behavior
Complementary tools: Should be used with momentum indicators or volatility filters to confirm signals and reduce false positives
▶️ **References**
Mulloy, P. (1994). "Smoothing Data with Less Lag," Technical Analysis of Stocks & Commodities .
Ehlers, J. (2001). Rocket Science for Traders . John Wiley & Sons.
Enhanced Triple Supertrend Strategy with Full Confirmationsall three super trend must be green trade buy or sell will under 3 additional confirmations including a candle stick pattern recognition that will continue trade executiion only if there is a breakout buy or sell engulfing candle its going to be tight but it will be right
多組帶狀背景布林通道The multi-Bollinger Bands indicator multi-Bollinger Bands indicator designed for advanced technical analysis. This indicator features six independent Bollinger Bands sets, each with customizable length and standard deviation, allowing traders to analyze price volatility across multiple timeframes simultaneously. Users can also toggle the display of the middle bands for better insight into price trends.
A unique feature of this tool is the ability to highlight the areas between upper and lower bands across paired Bollinger sets with distinct colored background bands, making it easier to identify critical volatility zones at a glance. The indicator uses three color groups for improved visual clarity and quick differentiation.
With its high level of customization and clear visual cues, this indicator supports a wide range of trading strategies and market conditions, helping traders enhance risk management and make more informed decisions.
SMC ICT – Simplified Daily Trend & Reversal AnalyzerThis Pine Script provides a simplified approach to analyzing daily trends and potential reversals using concepts inspired by Smart Money Concepts (SMC) and ICT (Inner Circle Trader).
What It Does:
• Detects daily uptrend and downtrend conditions by comparing the current daily high/low to the previous day’s values.
• Highlights potential bullish or bearish reversal zones when price behavior suggests a shift in sentiment.
• Automatically draws dashed lines for the previous day's high and low.
• Labels these high/low levels for quick visual reference.
How to Use:
Apply this indicator to any timeframe chart. Use the plotted trend markers to assess daily direction and potential reversal signals. The dashed lines (previous high/low) can be used as reference points for liquidity zones or break/retest entries.
User Interface:
The indicator displays labels and shapes in English. This script is intended for educational and trading workflow enhancement purposes.
Note:
This is an open-source tool designed for clarity and basic SMC/ICT application. It is best used in combination with other confluences like FVGs, order blocks, and liquidity sweeps.
Recent Session High Low Marker - SimpleDescription:
This Pine Script marks the high and low points of the most recent trading sessions: Asian, London, and New York.
Asian Session: From 19:00 to 21:00 New York time (UTC-4).
London Session: From 02:00 to 05:00 New York time (UTC-4).
New York Session: From 07:00 to 10:00 New York time (UTC-4).
For each session, the script draws two lines:
One for the high of the session.
One for the low of the session.
The lines are drawn horizontally across the chart, making them easy to spot. Each session is marked by two lines with specific colors:
Orange for the Asian session.
Blue for the London session.
Purple for the New York session.
The lines are dynamically updated during the active session, and they will reset when the next session begins. The width of the lines is set to 2 to ensure they are visible without being too thick.
Credits:
Script created by Jdv.
Momentum (80) + ATR (14)his indicator combines two essential technical analysis tools in a single panel for enhanced market insight:
🔹 Momentum (80 periods): Measures the difference between the current price and the price 80 bars ago. Displayed as a semi-transparent filled area, it helps to visually identify shifts in price momentum over a longer timeframe.
🔸 ATR (Average True Range, 14 periods): Shown as a fine orange line, the ATR represents average market volatility over 14 periods, highlighting phases of calm or increased price fluctuations.
By viewing both momentum and volatility simultaneously, traders can better assess trend strength and market conditions, improving decision-making across assets such as stocks, forex, and cryptocurrencies.
✅ Suitable for all asset types
✅ Complements other indicators like RSI, MACD, and Bollinger Bands
✅ Categorized under Momentum & Volatility indicators
VWAP + Candle-Rating SELL (close, robust)This multi‐timeframe setup first scans the 15-minute chart for strong bearish candles (body position in the bottom 40% of their range, i.e. rating 4 or 5) that close below the session VWAP. When it finds the first such “setup” of a trading period, it pins the low of that 15-minute candle as a trigger level and draws a persistent red line there. On the 5-minute chart, the strategy then waits for a similarly strong bearish candle (rating 4 or 5) to close below that marked low—at which point it emits a one‐time SELL signal. The trigger level remains in place (and additional sell signals are locked out) until the market “rescues” the price: a 15-minute bullish candle (rating 1 or 2) closing back above VWAP clears the old setup and allows the next valid bearish 15-minute candle to form a new trigger. This design ensures you only trade the most significant breakdowns after a clear bearish bias and avoids repeated signals until a genuine bullish reversal resets the system.
E9 Trade Size toolTrading lot size calculator that allows you to accurately calculate lot sizes based on Account value, Risk and Partial Entries.
Account size - Input your Account value
% Risk - Enter amount of risk per trade setup (In %)
% First partial - Calculation based on Scaling entries
Aswell as Display settings to be customised.
Chandelier Exit test dhafhncxm frae;ocrnw;pvr/wfu iwincrcfb.owur;p alfunprcrnqnr32o ;an pwn8r hfsdhglehf
Vertical Line at Current CandleCreates a vertical dotted line to follow the current candle making a cross at the current time and price
Triple Exponential Moving Average (TEMA)The Triple Exponential Moving Average (TEMA) is an advanced technical indicator designed to significantly reduce the lag inherent in traditional moving averages while maintaining signal quality. Developed by Patrick Mulloy in 1994 as an extension of his DEMA concept, TEMA employs a sophisticated triple-stage calculation process to provide exceptionally responsive market signals.
TEMA's mathematical approach goes beyond standard smoothing techniques by using a triple-cascade architecture with optimized coefficients. This makes it particularly valuable for traders who need earlier identification of trend changes without sacrificing reliability. Since its introduction, TEMA has become a key component in many algorithmic trading systems and professional trading platforms.
▶️ **Core Concepts**
Triple-stage lag reduction: TEMA uses a three-level EMA calculation with optimized coefficients (3, -3, 1) to dramatically minimize the delay in signal generation
Enhanced responsiveness: Provides significantly faster reaction to price changes than standard EMA or even DEMA, while maintaining reasonable smoothness
Strategic signal processing: Employs mathematical techniques to extract the underlying trend while filtering random price fluctuations
Timeframe effectiveness: Performs well across multiple timeframes, though particularly valued in short to medium-term trading
TEMA achieves its enhanced responsiveness through an innovative triple-cascade architecture that strategically combines three levels of exponential moving averages. This approach effectively removes the lag component inherent in EMA calculations while preserving the essential smoothing benefits.
▶️ **Common Settings and Parameters**
Length: Default: 12 | Controls sensitivity/smoothness | When to Adjust: Increase in choppy markets, decrease in strongly trending markets
Source: Default: Close | Data point used for calculation | When to Adjust: Change to HL2/HLC3 for more balanced price representation
Corrected: Default: false | Adjusts internal EMA smoothing factors for potentially faster response | When to Adjust: Set to true for a modified TEMA that may react quicker to price changes. false uses standard TEMA calculation
Visualization: Default: Line | Display format on charts | When to Adjust: Use filled cloud to see divergence from price more clearly
Pro Tip: For optimal trade signals, many professional traders use two TEMAs (e.g., 8 and 21 periods) and look for crossovers, which often provide earlier signals than traditional moving average pairs.
▶️ **Calculation and Mathematical Foundation**
Simplified explanation:
TEMA calculates three levels of EMAs, then combines them using a special formula that amplifies recent price action while reducing lag. This triple-processing approach effectively eliminates much of the delay found in traditional moving averages.
Technical formula:
TEMA = 3 × EMA₁ - 3 × EMA₂ + EMA₃
Where:
EMA₁ = EMA(source, α₁)
EMA₂ = EMA(EMA₁, α₂)
EMA₃ = EMA(EMA₂, α₃)
The smoothing factors (α₁, α₂, α₃) are determined as follows:
Let α_base = 2/(length + 1)
α₁ = α_base
If corrected is false:
α₂ = α_base
α₃ = α_base
If corrected is true:
Let r = (1/α_base)^(1/3)
α₂ = α_base * r
α₃ = α_base * r * r = α_base * r²
The corrected = true option implements a variation that uses progressively smaller alpha values for the subsequent EMA calculations. This approach aims to optimize the filter's frequency response and phase lag.
Alpha Calculation for corrected = true:
α₁ (alpha_base) = 2/(length + 1)
r = (1/α₁)^(1/3) (cube root relationship)
α₂ = α₁ * r = α₁^(2/3)
α₃ = α₂ * r = α₁^(1/3)
Mathematical Rationale for Corrected Alphas:
1. Frequency Response Balance:
The standard TEMA (where α₁ = α₂ = α₃) can lead to an uneven frequency response, potentially over-smoothing high frequencies or creating resonance artifacts. The geometric progression of alphas (α₁ > α₁^(2/3) > α₁^(1/3)) in the corrected version aims to create a more balanced filter cascade. Each stage contributes more proportionally to the overall frequency response.
2. Phase Lag Optimization:
The cube root relationship between the alphas is designed to minimize cumulative phase lag while maintaining smoothing effectiveness. Each subsequent EMA stage has a progressively smaller impact on phase distortion.
3. Mathematical Stability:
The geometric progression (α₁, α₁^(2/3), α₁^(1/3)) can enhance numerical stability due to constant ratios between consecutive alphas. This helps prevent the accumulation of rounding errors and maintains consistent convergence properties.
Practical Impact of corrected = true:
This modification aims to achieve:
Potentially better lag reduction for a similar level of smoothing
A more uniform frequency response across different market cycles
Reduced overshoot or undershoot in trending conditions
Improved signal-to-noise ratio preservation
Essentially, the cube root relationship in the corrected TEMA attempts to optimize the trade-off between responsiveness and smoothness that can be a challenge with uniform alpha values.
🔍 Technical Note: Advanced implementations apply compensation techniques to all three EMA stages, ensuring TEMA values are valid from the first bar without requiring a warm-up period. This compensation corrects initialization bias and prevents calculation errors from compounding through the cascade.
▶️ **Interpretation Details**
TEMA excels at identifying trend changes significantly earlier than traditional moving averages, making it valuable for both entry and exit signals:
When price crosses above TEMA, it often signals the beginning of an uptrend
When price crosses below TEMA, it often signals the beginning of a downtrend
The slope of TEMA provides insight into trend strength and momentum
TEMA crossovers with price tend to occur earlier than with standard EMAs
When multiple-period TEMAs cross each other, they confirm significant trend shifts
TEMA works exceptionally well as a dynamic support/resistance level in trending markets
For optimal results, traders often use TEMA in combination with momentum indicators or volume analysis to confirm signals and reduce false positives.
▶️ **Limitations and Considerations**
Market conditions: The high responsiveness can generate false signals during highly choppy, sideways markets
Overshooting: More aggressive lag reduction leads to more pronounced overshooting during sharp reversals
Parameter sensitivity: Changes in length have more dramatic effects than in simpler moving averages
Calculation complexity: Triple cascaded EMAs make behavior less predictable and more resource-intensive
Complementary tools: Should be used with confirmation tools like RSI, MACD or volume indicators
▶️ **References**
Mulloy, P. (1994). "Smoothing Data with Less Lag," Technical Analysis of Stocks & Commodities .
Mulloy, P. (1995). "Comparing Digital Filters," Technical Analysis of Stocks & Commodities .
BowtieThe bowtie is merely a plot of the 10 period SMA, the 20 period, EMA and the 30 period EMA. When the shorter SMA crosses above both of the longer EMA's it is considered a bullish indicator. When the shorter SMA crosses below both of the longer EMA's, it is consider a bearish indicator. As with all such indicators, this lags actual price action.
The name comes from the crossover that resembles the shape of a bowtie.
Línea Vertical y Apertura 00:00 VeranoThis TradingView Pine Script plots vertical lines at specific key times throughout the trading day based on the New York timezone (Eastern Time), which aligns with Colombian time during Daylight Saving Time (UTC-4). It also highlights the opening price of the 00:00 candle and shades a specific time range on the chart.
Key Features:
Timezone Configuration:
Uses "America/New_York" to define the trading session times.
Opening Price at 00:00:
Captures and stores the opening price of the candle at exactly 00:00.
Optionally stores the bar index (although it's not used visually here).
Vertical Lines at Key Times:
Draws vertical dashed lines at these specific times each day:
00:00
07:30
08:30
09:45
10:00
10:15
10:30
10:45
11:00
13:30
16:30
These lines extend above and below the chart range, from the highest to the lowest price over the last 500 bars.
Background Highlight:
Shades the time interval between 11:00 and 13:30 with a semi-transparent gray background, but only for the current day.
My script//@version=5
strategy("15-Min EMA + RSI Pullback Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
emaShort = input.int(9, title="EMA Short")
emaLong = input.int(21, title="EMA Long")
rsiPeriod = input.int(14, title="RSI Period")
rsiBuyThresh = input.int(40, title="RSI Buy Threshold")
rsiSellThresh = input.int(60, title="RSI Sell Threshold")
sl_pct = input.float(1.0, title="Stop Loss %", minval=0.1)
tp_pct = input.float(2.0, title="Take Profit %", minval=0.1)
// === CALCULATIONS ===
emaFast = ta.ema(close, emaShort)
emaSlow = ta.ema(close, emaLong)
rsi = ta.rsi(close, rsiPeriod)
// === CONDITIONS ===
// Long setup
bullTrend = emaFast > emaSlow
pullbackLong = close > emaSlow and close < emaFast
rsiLongCond = rsi > rsiBuyThresh
bullSignal = bullTrend and pullbackLong and rsiLongCond
// Short setup
bearTrend = emaFast < emaSlow
pullbackShort = close < emaSlow and close > emaFast
rsiShortCond = rsi < rsiSellThresh
bearSignal = bearTrend and pullbackShort and rsiShortCond
// === ENTRIES ===
if bullSignal
strategy.entry("Long", strategy.long)
strategy.exit("TP/SL Long", from_entry="Long", stop=close * (1 - sl_pct / 100), limit=close * (1 + tp_pct / 100))
if bearSignal
strategy.entry("Short", strategy.short)
strategy.exit("TP/SL Short", from_entry="Short", stop=close * (1 + sl_pct / 100), limit=close * (1 - tp_pct / 100))
// === PLOT INDICATORS ===
plot(emaFast, color=color.orange, title="EMA 9")
plot(emaSlow, color=color.blue, title="EMA 21")