Advertisement IC Markets

The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Discuss 1-minute to 15-minute price action setups, fading intraday momentum, key support/resistance zones, and proven short-term trading methodologies.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

Forex scalping isn’t for the faint of heart. While swing traders wait days for a setup, scalpers thrive in the chaos of 1-minute charts, opening and closing positions in mere seconds or minutes. The goal? Capture tiny price fluctuations—often just 5 to 10 pips—multiple times a day.
But here is the truth most beginners miss: your trading strategy is only as good as the currency pair you choose. When you are taking dozens of trades a session, the wrong environment will drain your account through hidden transaction costs before you even realize what happened.
The Scalper's Holy Trinity
To survive in the micro-timeframes, a currency pair must possess three non-negotiable traits:
Massive Liquidity: You need to enter and exit trades instantly without slippage.
Predictable Volatility: The price actually needs to move enough to generate those small pip profits.
Razor-Thin Spreads: This is the most crucial metric. Because your profit targets are so small, a spread of 2 pips on a 5-pip target means you are giving up 40% of your gains to the broker. You need spreads as close to zero as possible.
The 4 Best Pairs for Scalping
Because of the strict rules above, exotic pairs are completely off the table. Scalpers live and die by the major pairs. Here is where the deepest liquidity and tightest spreads exist:
Eurusd, Usdjpy, Gbpusd, AudUsd

Timing is Everything
Even the best pairs go quiet. The optimal window to scalp these major pairs is during the London and New York session overlap (typically 8:00 AM to 12:00 PM EST). During this four-hour window, liquidity is at its absolute peak, driving spreads down to their minimums and providing the clean, decisive price action that short-term traders rely on.
Remember, scalping is a high-speed game of precision. Master one pair and one specific time window before expanding your radar.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Recommended broker for automated trading & scalping IC Markets
LondonScalper
Posts: 770
Joined: Sat Sep 05, 2026 7:54 am

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by LondonScalper »

PTScalper wrote:your trading strategy is only as good as the currency pair you choose
This is the unglamorous edge that survives contact with live costs.

Pair selection for scalping is mostly a cost and behaviour problem: can you get in and out cleanly during your session, and does the pair mean-revert or trend in the way your playbook expects? EURUSD/GBPUSD in London remain the default for a reason. Minors and exotics can look “pipier” while quietly transferring your edge to the spread.

My weekly hygiene:
  • Rank pairs by all-in cost vs average M-target
  • Demote anything with ugly p95 slip in my hours
  • Keep a short allowed list — curiosity pairs stay on a tiny test sleeve
“Holy trinity” of liquidity / volatility / cost is the right instinct. I’d just measure it from your blotter, not from a blog’s personality ranking. Which pairs are on your demote list this month?
PropScalpDesk
Posts: 364
Joined: Sat Sep 19, 2026 7:50 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PropScalpDesk »

Pair selection is a cost and behaviour filter

Agree that pair choice matters more than most indicator debates. As a full-time scalper I treat the universe as small on purpose — attention is limited and costs compound.

My current working set is narrow: primarily EURUSD, selective GBPUSD, occasional XAUUSD only when spread and news map allow. Crosses get cut fast on Friday afternoon and into thin lunch hours when the chart still looks “clean.”

Selection criteria I write down:
  • Typical spread in my European morning session, not the marketing screenshot.
  • How the pair behaves around my news blackouts.
  • Whether my stop distances still allow sensible R at my account size without fantasy lots.
Adding pairs to cure boredom is how process dies. Boredom is a scheduling problem, not a symbol problem.

I revisit the pair list monthly, not daily. Daily pair shopping is usually boredom. Monthly review with cost and rule-break tags is maintenance. That rhythm keeps the universe small without making it rigid forever.

If you had to drop to one pair for the next month, which survives — and what metric made the cut?
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

PTScalper wrote: Sun Jul 26, 2026 10:27 am Forex scalping isn’t for the faint of heart. While swing traders wait days for a setup, scalpers thrive in the chaos of 1-minute charts, opening and closing positions in mere seconds or minutes. The goal? Capture tiny price fluctuations—often just 5 to 10 pips—multiple times a day.
But here is the truth most beginners miss: your trading strategy is only as good as the currency pair you choose. When you are taking dozens of trades a session, the wrong environment will drain your account through hidden transaction costs before you even realize what happened.
The Scalper's Holy Trinity
To survive in the micro-timeframes, a currency pair must possess three non-negotiable traits:
Massive Liquidity: You need to enter and exit trades instantly without slippage.
Predictable Volatility: The price actually needs to move enough to generate those small pip profits.
Razor-Thin Spreads: This is the most crucial metric. Because your profit targets are so small, a spread of 2 pips on a 5-pip target means you are giving up 40% of your gains to the broker. You need spreads as close to zero as possible.
The 4 Best Pairs for Scalping
Because of the strict rules above, exotic pairs are completely off the table. Scalpers live and die by the major pairs. Here is where the deepest liquidity and tightest spreads exist:
Eurusd, Usdjpy, Gbpusd, AudUsd

Timing is Everything
Even the best pairs go quiet. The optimal window to scalp these major pairs is during the London and New York session overlap (typically 8:00 AM to 12:00 PM EST). During this four-hour window, liquidity is at its absolute peak, driving spreads down to their minimums and providing the clean, decisive price action that short-term traders rely on.
Remember, scalping is a high-speed game of precision. Master one pair and one specific time window before expanding your radar.
To make this a fully functional Pine Script, I have wrapped your strict rules—specific time windows and tight pip targets—around a high-speed momentum trigger (a Fast Moving Average crossover).

Here is the Pine Script (v5) designed for the 1-minute chart on the major pairs you listed:

Code: Select all

//@version=5
strategy("London/NY Overlap Scalper", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=2)

// =========================================================================
// 1. STRATEGY INPUTS (Based on your strict scalping rules)
// =========================================================================

// Timing: London & New York session overlap
sessionTime = input.session("0800-1200", title="Trading Session (EST)")
sessionZone = input.string("America/New_York", title="Timezone")

// The Goal: 5 to 10 pips
tpPips = input.float(7.0, title="Take Profit (Pips)", minval=1.0, maxval=15.0, step=0.5)
slPips = input.float(5.0, title="Stop Loss (Pips)", minval=1.0, maxval=15.0, step=0.5)
ticksPerPip = input.int(10, title="Ticks per Pip", tooltip="Keep at 10 for standard 5-digit forex brokers.")

// Technical Trigger (Placeholder for momentum)
fastEmaLen = input.int(9, title="Fast EMA Length")
slowEmaLen = input.int(21, title="Slow EMA Length")

// =========================================================================
// 2. SESSION & ENVIRONMENT LOGIC
// =========================================================================

// Check if current bar is within the 8:00 AM to 12:00 PM EST window
inSession = time(timeframe.period, sessionTime, sessionZone)

// Highlight the chart background during the active session so you can visualize liquidity
bgcolor(inSession ? color.new(color.blue, 90) : na, title="Session Highlight")

// =========================================================================
// 3. ENTRY LOGIC
// =========================================================================

// Calculate Moving Averages
fastEma = ta.ema(close, fastEmaLen)
slowEma = ta.ema(close, slowEmaLen)

// Entry Conditions: Only fire if we are INSIDE the overlap session
longCondition = ta.crossover(fastEma, slowEma) and inSession
shortCondition = ta.crossunder(fastEma, slowEma) and inSession

// Execute Entries
if (longCondition)
    strategy.entry("Long", strategy.long)

if (shortCondition)
    strategy.entry("Short", strategy.short)

// =========================================================================
// 4. TRADE EXITS (Razor-thin targets)
// =========================================================================

// Convert your Pip inputs into Ticks for TradingView's engine
tpTicks = tpPips * ticksPerPip
slTicks = slPips * ticksPerPip

// Execute strict Take Profit and Stop Loss
strategy.exit("Exit Long", from_entry="Long", profit=tpTicks, loss=slTicks)
strategy.exit("Exit Short", from_entry="Short", profit=tpTicks, loss=slTicks)

// Close any open trades immediately when the London/NY session ends
if not inSession and inSession[1]
    strategy.close_all(comment="Session Ended")
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

How to Apply This to Your Chart

Chart Setup: Open TradingView and set your timeframe strictly to 1-minute.

Select the Asset: Load one of the "Holy Trinity" majors mentioned in your text: EURUSD, USDJPY, GBPUSD, or AUDUSD.

Add the Script: Go to the "Pine Editor" tab at the bottom, delete whatever is there, paste the code above, and click "Add to Chart".

How It Enforces Your Strategy

The Timing Rule: The script utilizes the input.session function locked to "0800-1200" EST. It paints a light blue background on your chart during this time and will absolutely not take a trade outside of this window, protecting you from low-liquidity chop.

The "No Holding" Rule: Scalpers shouldn't hold trades into dead sessions. The script includes a failsafe (strategy.close_all) that automatically liquidates any open positions the moment the clock strikes 12:00 PM EST.

The 5-10 Pip Target: TradingView natively calculates profit and loss in "ticks" (points). Standard forex brokers use fractional pips, meaning 1 pip = 10 ticks. The script converts your 5-10 pip input into exact tick measurements so the strategy engine fires exits instantly.

The Entry Mechanism: I used a 9/21 Exponential Moving Average crossover as the entry trigger. Because you are on a 1-minute chart during peak volume, this will capture sudden momentum bursts. If you have a preferred technical trigger (like RSI or Stochastic), you can easily swap it into Section 3 of the code.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

To upgrade this from a beginner’s script to a professional-grade trading engine, we need to address the realities of live market mechanics. Professional scalpers don't just blindly buy when two lines cross. They filter for trend direction, minimum volatility, and employ strict percentage-based risk management.

Here are the "Pro" upgrades integrated into the script below:

Dynamic Position Sizing: Instead of trading a fixed percentage of your account, the script now calculates your exact lot size to risk exactly 1% (or your chosen amount) of your equity based on your Stop Loss distance.

Institutional Trend Filter (200 EMA): The golden rule of scalping: never counter-trend. The script now only takes long trades if the price is above the 200 EMA, and short trades if below it.

Volatility Filter (ATR): You mentioned the price "actually needs to move." The script now measures the Average True Range (ATR). If the market is moving too slowly (less than 3 pips per candle), it blocks entries to prevent you from getting chopped out in dead zones.

Professional Heads-Up Display (HUD): It generates a real-time dashboard on your chart showing session status, current trend, and live volatility.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

The Pro Scalping Engine (Pine Script v5)

Code: Select all

//@version=5
strategy("Pro Scalping Engine: NY/London Overlap", overlay=true, initial_capital=10000, margin_long=100, margin_short=100, calc_on_every_tick=true)

// =========================================================================
// 1. RISK MANAGEMENT & TARGETS
// =========================================================================
riskPerTrade = input.float(1.0, title="Risk Per Trade (%)", group="Risk Management", tooltip="Risks exactly this percentage of account equity per trade.")
tpPips       = input.float(8.0, title="Take Profit (Pips)", group="Risk Management", minval=1.0, step=0.5)
slPips       = input.float(5.0, title="Stop Loss (Pips)", group="Risk Management", minval=1.0, step=0.5)
ticksPerPip  = input.int(10, title="Ticks per Pip", group="Risk Management", tooltip="Standard is 10 for forex pairs.")

// =========================================================================
// 2. TIMING & SESSION
// =========================================================================
sessionTime = input.session("0800-1200", title="Trading Session (EST)", group="Session Settings")
sessionZone = input.string("America/New_York", title="Timezone", group="Session Settings")

// =========================================================================
// 3. PRO FILTERS: TREND & VOLATILITY
// =========================================================================
baselineLen  = input.int(200, title="Baseline Trend EMA", group="Filters", tooltip="Only trade in the direction of this higher-timeframe trend.")
fastEmaLen   = input.int(9, title="Fast EMA", group="Filters")
slowEmaLen   = input.int(21, title="Slow EMA", group="Filters")
minAtrPips   = input.float(2.0, title="Minimum ATR (Pips)", group="Filters", tooltip="Minimum required volatility to allow trades.")

// =========================================================================
// CALCULATIONS & LOGIC
// =========================================================================
// Pip conversions
pipMultiplier = syminfo.mintick * ticksPerPip
tpTicks       = tpPips * ticksPerPip
slTicks       = slPips * ticksPerPip

// Session Logic
inSession = time(timeframe.period, sessionTime, sessionZone)
bgcolor(inSession ? color.new(color.blue, 92) : na, title="Session Active")

// Indicators
fastEma  = ta.ema(close, fastEmaLen)
slowEma  = ta.ema(close, slowEmaLen)
trendEma = ta.ema(close, baselineLen)
atr      = ta.atr(14) / pipMultiplier // Convert ATR to Pips

// Plot the Trend Line
plot(trendEma, color=color.new(color.white, 30), linewidth=2, title="200 EMA Trend")

// =========================================================================
// PROFESSIONAL POSITION SIZING
// =========================================================================
// Calculate exact quantity based on Stop Loss distance and Account Equity
equityRiskAmount = (strategy.equity * (riskPerTrade / 100))
// QTY formula = Risk Amount / (SL in Price * Point Value)
slPriceDistance  = slPips * pipMultiplier
positionSize     = equityRiskAmount / (slPriceDistance * syminfo.pointvalue)

// =========================================================================
// ENTRY & EXIT EXECUTION
// =========================================================================
// Entry Rules: Momentum + Session + Trend Alignment + Volatility Check
validVolatility = atr >= minAtrPips
longTrend       = close > trendEma
shortTrend      = close < trendEma

longCondition  = ta.crossover(fastEma, slowEma) and inSession and longTrend and validVolatility
shortCondition = ta.crossunder(fastEma, slowEma) and inSession and shortTrend and validVolatility

if (longCondition and strategy.position_size == 0)
    strategy.entry("Long", strategy.long, qty=positionSize)

if (shortCondition and strategy.position_size == 0)
    strategy.entry("Short", strategy.short, qty=positionSize)

// Strict Exits
strategy.exit("Exit Long", from_entry="Long", profit=tpTicks, loss=slTicks)
strategy.exit("Exit Short", from_entry="Short", profit=tpTicks, loss=slTicks)

// Close at Session End
if not inSession and inSession[1]
    strategy.close_all(comment="EOD Close")

// =========================================================================
// PRO DASHBOARD (HUD)
// =========================================================================
var table hud = table.new(position.bottom_right, 2, 4, border_width=1, border_color=color.gray, frame_color=color.black, frame_width=2, bgcolor=color.new(color.black, 20))

if barstate.islast
    // Header
    table.cell(hud, 0, 0, "SCALP ENGINE", text_color=color.white, text_halign=text.align_left, bgcolor=color.new(color.blue, 50))
    table.cell(hud, 1, 0, syminfo.ticker, text_color=color.white, text_halign=text.align_right, bgcolor=color.new(color.blue, 50))
    
    // Session Status
    table.cell(hud, 0, 1, "Session Status:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 1, inSession ? "🟢 ACTIVE" : "🔴 CLOSED", text_color=inSession ? color.lime : color.red, text_halign=text.align_right)
    
    // Volatility (ATR)
    table.cell(hud, 0, 2, "Current Volatility (ATR):", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 2, str.tostring(atr, "#.##") + " pips", text_color=validVolatility ? color.lime : color.orange, text_halign=text.align_right)
    
    // Trend Alignment
    trendText = longTrend ? "BULLISH (Longs Only)" : shortTrend ? "BEARISH (Shorts Only)" : "FLAT"
    trendCol  = longTrend ? color.lime : shortTrend ? color.red : color.gray
    table.cell(hud, 0, 3, "200 EMA Trend:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 3, trendText, text_color=trendCol, text_halign=text.align_right)
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

What makes this code "Pro"?

strategy.position_size == 0 check: In the entry conditions, I added a check to ensure it only opens one trade at a time. Amateurs often code scripts that fire multiple entries in the same direction, instantly blowing through their margin requirements.

The Math Engine: The calculation positionSize = equityRiskAmount / (slPriceDistance * syminfo.pointvalue) is the exact math institutional algorithms use to size positions. If your Stop Loss is 5 pips and you risk 1% of a $10,000 account, the script will automatically calculate the exact lot size to ensure you lose exactly $100 if stopped out, scaling dynamically as your account grows.

Calc On Every Tick: The strategy declaration at the top includes calc_on_every_tick=true. By default, Pine Script only evaluates on the close of a candle. In 1-minute scalping, waiting for a candle to close before triggering a Stop Loss will result in massive slippage. This ensures the script evaluates price intra-candle.

The HUD: The table in the bottom right corner of your chart gives you immediate situational awareness. If the session is active but the ATR text is orange (meaning volatility is too low), you know exactly why the script is sitting out and waiting.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

To take this from a "great retail script" to an institutional-grade algorithmic trading system, we have to address the true killers of scalpers: false signals in micro-timeframes, overtrading during drawdowns, and the hidden costs of execution.

Here is the Elite Tier upgrade. I have integrated four advanced quantitative mechanics:

Multi-Timeframe (MTF) Macro Filter: A 1-minute 200 EMA is too noisy. Professional algos use MTF analysis. This script now pulls the 15-minute 200 EMA data down to your 1-minute chart. You are entering on 1-minute momentum, but only when aligned with the 15-minute institutional flow.

Daily Circuit Breakers (Drawdown/Profit Limits): Human psychology breaks after losing streaks. The script now calculates your daily PnL in real-time. If you hit a 3% daily loss limit (or a 5% daily profit goal), the algorithm hard-locks itself and refuses to take another trade until midnight.

Execution Reality (Commissions & Slippage): Beginners backtest without fees and think they are billionaires. I’ve hardcoded realistic Forex commission structures and a 2-tick slippage penalty into the strategy tester. This ensures your backtest results are grounded in reality.

Quant Analytics HUD: The dashboard now acts as a live trading terminal, tracking your real-time Win Rate, today's rolling PnL percentage, and Circuit Breaker statuses.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 3349
Joined: Mon Jul 20, 2026 1:28 pm

Re: The 60-Second Trader: Why Pair Selection is Your Biggest Edge in Forex Scalping

Post by PTScalper »

The Elite Scalping Algorithm (Pine Script v5)

Code: Select all

//@version=5
strategy("Elite Scalper: MTF & Circuit Breakers", overlay=true, initial_capital=10000, margin_long=100, margin_short=100, calc_on_every_tick=true, commission_type=strategy.commission.cash_per_contract, commission_value=3.0, slippage=2)

// =========================================================================
// 1. RISK & ACCOUNT MANAGEMENT
// =========================================================================
riskPerTrade      = input.float(1.0, title="Risk Per Trade (%)", group="Risk Management")
maxDailyLossPct   = input.float(3.0, title="Max Daily Loss (%)", group="Risk Management", tooltip="Halts trading for the day if drawdown hits this level.")
maxDailyProfitPct = input.float(5.0, title="Max Daily Profit (%)", group="Risk Management", tooltip="Halts trading for the day to secure profits.")
tpPips            = input.float(8.0, title="Take Profit (Pips)", group="Trade Execution", minval=1.0, step=0.5)
slPips            = input.float(5.0, title="Stop Loss (Pips)", group="Trade Execution", minval=1.0, step=0.5)
ticksPerPip       = input.int(10, title="Ticks per Pip", group="Trade Execution")

// =========================================================================
// 2. TIMING & SESSION
// =========================================================================
sessionTime = input.session("0800-1200", title="Trading Session (EST)", group="Session Settings")
sessionZone = input.string("America/New_York", title="Timezone", group="Session Settings")

// =========================================================================
// 3. ELITE FILTERS: MTF TREND & VOLATILITY
// =========================================================================
mtfTimeframe = input.timeframe("15", title="Macro Trend Timeframe", group="Institutional Filters")
fastEmaLen   = input.int(9, title="Fast EMA (Micro)", group="Institutional Filters")
slowEmaLen   = input.int(21, title="Slow EMA (Micro)", group="Institutional Filters")
minAtrPips   = input.float(2.0, title="Minimum ATR (Pips)", group="Institutional Filters")

// =========================================================================
// CALCULATIONS & LOGIC
// =========================================================================
pipMultiplier = syminfo.mintick * ticksPerPip
tpTicks       = tpPips * ticksPerPip
slTicks       = slPips * ticksPerPip

// Session Check
inSession = time(timeframe.period, sessionTime, sessionZone)
bgcolor(inSession ? color.new(color.blue, 94) : na, title="Session Active")

// Micro Indicators (1-Minute)
fastEma = ta.ema(close, fastEmaLen)
slowEma = ta.ema(close, slowEmaLen)
atr     = ta.atr(14) / pipMultiplier 

// MACRO Indicator (MTF 15-Minute)
// We use request.security to pull higher timeframe data without repainting
macroTrendEma = request.security(syminfo.tickerid, mtfTimeframe, ta.ema(close, 200), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off)
plot(macroTrendEma, color=color.new(color.orange, 10), linewidth=3, title="Macro 200 EMA (15m)")

// =========================================================================
// CIRCUIT BREAKERS (DAILY PnL TRACKING)
// =========================================================================
var float startOfDayEquity = strategy.initial_capital
var bool circuitBreakerHit = false

// Reset daily equity at the start of a new day
if ta.change(time("D"))
    startOfDayEquity := strategy.equity
    circuitBreakerHit := false // Reset breaker

// Calculate current day's performance
currentDailyPnL_Pct = ((strategy.equity - startOfDayEquity) / startOfDayEquity) * 100

// Check if limits are breached
if (currentDailyPnL_Pct <= -maxDailyLossPct) or (currentDailyPnL_Pct >= maxDailyProfitPct)
    circuitBreakerHit := true

// =========================================================================
// PROFESSIONAL POSITION SIZING
// =========================================================================
equityRiskAmount = (strategy.equity * (riskPerTrade / 100))
slPriceDistance  = slPips * pipMultiplier
// Prevents division by zero error in edge cases
positionSize     = slPriceDistance > 0 ? (equityRiskAmount / (slPriceDistance * syminfo.pointvalue)) : 0

// =========================================================================
// ENTRY & EXIT EXECUTION
// =========================================================================
validVolatility = atr >= minAtrPips
longTrend       = close > macroTrendEma
shortTrend      = close < macroTrendEma

longCondition  = ta.crossover(fastEma, slowEma) and inSession and longTrend and validVolatility
shortCondition = ta.crossunder(fastEma, slowEma) and inSession and shortTrend and validVolatility

// Only trade if session is active AND circuit breakers are NOT hit
canTrade = inSession and not circuitBreakerHit

if (longCondition and strategy.position_size == 0 and canTrade)
    strategy.entry("Long", strategy.long, qty=positionSize)

if (shortCondition and strategy.position_size == 0 and canTrade)
    strategy.entry("Short", strategy.short, qty=positionSize)

strategy.exit("Exit Long", from_entry="Long", profit=tpTicks, loss=slTicks)
strategy.exit("Exit Short", from_entry="Short", profit=tpTicks, loss=slTicks)

// Close all positions when session ends or circuit breaker is hit mid-trade
if (not inSession and inSession[1]) or (circuitBreakerHit and not circuitBreakerHit[1])
    strategy.close_all(comment="Forced Close (Session/Breaker)")

// =========================================================================
// QUANT ANALYTICS DASHBOARD (HUD)
// =========================================================================
var table hud = table.new(position.bottom_right, 2, 6, border_width=1, border_color=color.rgb(36, 36, 36), frame_color=color.black, frame_width=2, bgcolor=color.new(color.black, 10))

if barstate.islast
    // Calculate Win Rate safely
    winRate = strategy.closedtrades > 0 ? (strategy.wintrades / strategy.closedtrades) * 100 : 0
    
    // Header
    table.cell(hud, 0, 0, "ELITE SCALP TERMINAL", text_color=color.white, text_halign=text.align_left, bgcolor=color.new(color.blue, 30))
    table.cell(hud, 1, 0, syminfo.ticker, text_color=color.white, text_halign=text.align_right, bgcolor=color.new(color.blue, 30))
    
    // Breaker Status
    table.cell(hud, 0, 1, "Circuit Breaker:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 1, circuitBreakerHit ? "🔴 HALTED" : "🟢 CLEAR", text_color=circuitBreakerHit ? color.red : color.lime, text_halign=text.align_right)
    
    // Daily PnL
    pnlColor = currentDailyPnL_Pct > 0 ? color.lime : currentDailyPnL_Pct < 0 ? color.red : color.gray
    table.cell(hud, 0, 2, "Today's PnL:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 2, str.tostring(currentDailyPnL_Pct, "#.##") + "%", text_color=pnlColor, text_halign=text.align_right)

    // Win Rate
    table.cell(hud, 0, 3, "Strategy Win Rate:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 3, str.tostring(winRate, "#.#") + "%", text_color=color.white, text_halign=text.align_right)

    // Volatility
    table.cell(hud, 0, 4, "Volatility (ATR):", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 4, str.tostring(atr, "#.##") + " pips", text_color=validVolatility ? color.lime : color.orange, text_halign=text.align_right)
    
    // MTF Trend
    trendText = longTrend ? "BULLISH (15m)" : shortTrend ? "BEARISH (15m)" : "FLAT"
    trendCol  = longTrend ? color.lime : shortTrend ? color.red : color.gray
    table.cell(hud, 0, 5, "Macro Trend:", text_color=color.gray, text_halign=text.align_left)
    table.cell(hud, 1, 5, trendText, text_color=trendCol, text_halign=text.align_right)
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Post Reply