Select Page

Forex:

  • Currency Trading Market
  • Calculated in pips

Sites or Apps we need to start?

  • Google Sheet (Journaling)
  • Trading View
  • MT5
  • Fx Replay
  • ForexFactory

 

Type of Trading Description Timeframe Key Features
Scalping Quick trades to capture small price changes. Seconds to Minutes High frequency, fast profits, very short holding period.
Intraday Trading Trades opened and closed within the same day. Minutes to Hours (5min to 1 hour) No overnight positions, focuses on daily trends.
Swing Trading Holding trades for days to weeks. Days to Weeks Captures short to medium-term price swings.
Position Trading Long-term trades, focusing on big market moves. Weeks to Months or Years Minimal monitoring; based on fundamentals or long-term trends.

Pairs for Trading Forex:

  • EUR/USD (Euro/US dollar)
  • USD/JPY (US dollar/Japanese yen)
  • GBP/USD (British pound/US dollar)
  • AUD/USD (Australian dollar/US dollar)
  • USD/CHF (US dollar/Swiss franc)
  • USD/CAD (US dollar/Canadian dollar)
  • GBP/JPY (British pound/ Japanese yen)

Pips (Percentage in Points)

Calculation of Pips:

In GPBUSD,
We will take only 4 digits after decimal.
Before price: 1.3269
After Price: 1.3132

Once: 1*(9-2)=7
Tens: 10*(6-3)=3
Hundreds: 100*(2-1)=1

So, Pips= 137

TIME ZONE SESSIONS

Trading Sessions Time (UTC-4, NYC)
Asian Session 6:00 PM - 12:00 AM
Market Protraction 12:00 AM - 2:00 AM
London Killzone 2:00 AM - 5:00 AM
London Launch 5:00 AM - 7:00 AM
New York Killzone 7:00 AM - 10:00 AM
London Close 10:00 AM - 12:00 PM
New York Launch 12:00 PM - 1:00 PM
PM Session 1:00 PM - 3:00 PM
Dead Time 3:00 PM - 6:00 PM

Use Indicator: Mr.Wilson Trading Session (UTC-4 NYC)

Session Time (UTC+5:45, KTM)
Asian Session 3:45 AM - 9:45 AM
Market Protraction 9:45 AM - 11:45 AM
London Killzone 11:45 AM - 2:45 PM
London Launch 2:45 PM - 4:45 PM
New York Killzone 4:45 PM - 7:45 PM
London Close 7:45 PM - 9:45 PM
New York Launch 9:45 PM - 10:45 PM
PM Session 10:45 PM - 12:45 AM (next day)
Dead Time 12:45 AM - 3:45 AM (next day)

High Impact Forex News

Forex Factory: forexfactory.com

SN News & Events Explanation
1 CPI (Consumer Price Index) Measures the average change in prices paid by consumers, indicating inflation.
2 Interest Rate Decision Central banks decide whether to raise, lower, or maintain interest rates, impacting currency value.
3 Inflation Rates The rate at which the general level of prices for goods and services is rising, signaling economic health.
4 Labor Market Data Information about employment, wages, and workforce participation, reflecting economic strength.
5 Employment Changes Tracks changes in the number of employed people, influencing consumer spending and economic growth.
6 Non-Farm Payroll (NFP) Reports Monthly report showing the number of jobs added in the U.S., excluding the farming sector; a key indicator of economic performance.

Interbank Price Delivery Algorithm (IPDA)

Four Characteristics of Price

  1. Expansion (impulsive movement)
  2. Retracement (pullback)
  3. Reversal (shift in direction)
  4. Consolidation (sideways holding)
Price Delivery in Interbank Prie Delivery Algorithm (IPDA)
consolidation

Consolidation

  • Building Orders on both sides of the Market
  • To trap Retailers
  • It will happen If there is no volume and No Liquidity in the Market.

Time for consolidation: Asian Session 18:00-12:AM (Mid- Night)

Not Appliable in AUD, NZD, JPY Currency. (Asian Banks are Running)

Institutional order flow reference points:

  1. Order blocks
  2. Fair value gaps & liquidity voids
  3. Liquidity pools & stop runs
  4. Equilibrium

Objectives of Price

  1. Trading to Liquidity
  2. Trading to imbalance

Price Delivery Arrey

It’s a zone of market price from which the market price changes its characteristics.

Types of Price Delivery Arrey:

  • Order Block (OB)
  • Mitigation Block
  • Fair Value Gaps (FVGs)
  • Liquidity Void
  • Liquidity Pool

Order Block

It’s a zone in the price chart from which the market usually takes a reversal from this zone.

image diagram of an Order Block in ICT concept

Types of OB:

  1. Bullish Order Bolck (Red Candle) Generally.
  2. Bearish Order Block (Green Candle) Generally.

Characteristics of OB:

  1. Liquidity Grab.
  2. Impulsive Movement of Price after that candle.
  3. The body must be bigger than Wicks.

Notes: OB is often placed by large financial institutions.

Strong Order Block is those OB from which the price will not cross 50% of that candle, also known as the mean threshold of OB.

Mitigation Block

It occurs when the price returns to a previously manipulated or inefficient zone, often caused by an imbalance or liquidity grab (like stop-hunting).

These blocks can act as support or resistance zones and are often good areas for re-entry or reversal setups. It is a zone where we usually take exit from the market in Breakeven.


Two Types of Mitigation Blocks:

  1. Buy-side Mitigation Block (Swing High)
  2. Sell-side Mitigation Block (Swing Low)

How to Identify Mitigation Blocks?

Usually, it is formed with 3 candles on the swing high and swing low. 
The middle candle must have taken the upper price than the other 2 side candles in the Buy-Side Mitigation Block and vice versa.

Liquidity Pools

Liquidity pools are areas in a trading chart where many buy or sell orders are situated. Also, Stoploss of many traders are available here.

There are 2 types of Liquidity Pools:

  1. Structure Base
    – Equal High/Low
    – Range High/Low
  2. Time Base
    – Asian High/Low
    – Daily High/Low
    – Weekly High/Low

SMART-MONEY REVERSAL (TRADING PLAN) (1)

Trading Time & Time Frame

  1. Trading Time:
    • Winter Season (Nepal Time): 12:45 PM to 10:45 PM
    • Summer Season (Nepal Time): 11:45 AM to 9:45 PM
  2. Time Frames Used:
    • 1 Week (Weekly Chart): For higher timeframe analysis and bias confirmation.
    • 4 Hours (4H Chart): To identify PD Arrays and Premium/Discount levels.
    • 15 Minutes (15M Chart): For lower timeframe market reversal entries and exits.

Trading Process

  1. Higher Timeframe Analysis:
    • Confirm bias using the Weekly Chart in the direction of weekly expansion.
    • Trade on the expansion side of the market once confirmed.
  2. Mid-Level Timeframe Analysis (4H Chart):
    • Identify potential buying/selling zones within premium and discounted PD Arrays in the nearest range formed.
    • To be a potential buy or selling condition, price should be in one of the given levels:
      • Order Block
      • Mitigation
      • Fair Value Gap (FVG)
      • Liquidity Void
      • Liquidity Pools
  3. Lower Timeframe Entry (15M Chart):
    • Wait for price to enter anticipated levels and observe opposing liquidity grabs or order pairing to confirm smart money presence.
    • Key levels for order pairing:
      • Asian High/Low
      • Daily High/Low
      • Weekly High/Low
      • Range High/Low
      • Equal High/Low
  4. Market Structure Shift (MSS):
    • Look for a break of Intermediate Term High (ITH) or Intermediate Term Low (ITL) on the 15M chart.
    • Confirm displacement in price action with FVG or Liquidity Void.
  5. Entry and Exit:
    • Entry: Within the premium or discounted PD Array of the 15M MSS range.
    • Stop Loss: Must cover the high/low of the range.
    • Take Profit: Use a 1:3 Risk to Reward Ratio or target the nearest buy-side or sell-side liquidity.

Risk Management

  1. Counter and Continuation Trades:
    • Risk 0.5% of funded capital.
    • Risk 2-3% of personal account capital.
  2. Continuation Trades Only:
    • Risk 1% of funded capital.
    • Risk 2-3% of personal account capital.

Market Structure Shift(MSS)

First, confirm the running trend in the weekly time frame. Then go to the 4-hour time frame and follow the steps below.

Step 1: Liquidity Grab.

Step 2: Previous Structure Break (ITH/ITL)

Step 3: FVG in that Break.

Step 4: Enter in the middle of FVG. In a 15-minute time-frame.

SL= Swing High/Low of (ITH/ITL).

TP = 3 times of SL.

NOTES:
Trading Time Zone (NYC) 2 to 12
SL pips -> Less than 20
If 2 FVG -> Fib 50% Discount zone

Trading Checklist

ICT Buy Setup 01

ICT Buy and Sell Trading Plan (2)

You can use the trading step-up for both buying and selling. Now I am explaining it step by step for buying, you can do it vice-versa for selling.
Follow the steps below:

Step 1: Find a Sideways in the price trading chart.

Step 2: Let the price expand.

Step 3: Find the FVGs in that price expansion. Mark that FVGs.

Step 4: Use Fib Retracement from bottom to top. Then you will see the Discount price which is below 0.5. Now let that price come to that Discounted FVG zone.

Step 5: Now BUY in that FVG zone, then wait for price reversal.

Step 6: If the price reverses from that zone then you can sell at the high of that recent previous higher high.

Step 7: If the price goes down, hold up to the previous sideways lower low.

Watch -> 08:30 AM to 12:00 PM
Execute -> 12:30 AM to 8:30 AM

5-Minute Timeframe Trading Plan (3)

Time Zone: NYC 

  1. Mark Key Trading Hours:
    • Focus on the period from 8:30 AM to 12:00 PM.
  2. Identify the Breakout Zone:
    • Mark the high and low of the range from 12:00 AM to 8:30 AM.
    • Watch for a break of this range after 8:30 AM.
  3. Confirm CHoCH (Change of Character):
    • Look for a CHoCH within the 8:30 AM to 12:00 PM range.
  4. Find Gaps (Fair Value Gaps – FVG):
    • Identify any FVG above or below the CHoCH after a liquidity grab.
  5. Enter the Trade:
    • Place an entry in the FVG zone.
  6. Set Stop Loss (SL):
    • Set the SL at the last candle of the FVG zone.
  7. Define Take Profit (TP):
    • Target 1:2 or 1:3 risk-to-reward ratio for TP.

Simplified Turtle Soup (15 Min or 30 Min)

Step-by-step:

Step 1: Liquidity Sweep
Step 2: Reversal with Displacement
Step 3: OB or CISD Entry
Step 4: SL Swing High or Swing low 
Step 5: TP Opposite Liquidy or 1:2 or 1:3 or 1:5

Simplified Unicorn (1 hr – 5 min) (4 hrs – 15 min)

Step-by-step:

Step 1: Bias Confirmation (HTF) > MSB
Step 2: Liquidity Sweep
Step 3: Reversal with Displacement
Step 4: Entry (LTF) > MSS with Displacement
Step 5: Entry on FVG or OB created by displacement.
Step 6: SL > Nearest Swing Low / High
Step 7: TP Opposite Liquidy or 1:2 or 1:3 or 1:5

Forever Model

Step-by-step:

Step 1: Bias (Order Flow & Imbalance)
Step 2: Bigger time frame draw on liquidity – Liquidity sweep (Sell side or Buy Side)
Step 3: Reversal with displacement
Step 4: SMT for confirmation (Optional)
Step 5: Identify IFvG & CISD
Step 6: Entry at IFvG, CISD or FVG
Step 7: SL at Recent manipulated Swing (High/Low)
Step 8: TP at Opposing Liquidity Pool

Scalping Strategy (4)

Step-by-step:

  1. Higher Time Frame Trend= Up/Down
  2. Lower Time Frame Trend= Sideways
  3. Wait for Breakout Candle to enter = Pin Bar/Engulf
  4. Only take Trade if its breakout is similar to the Higher-time Frame Trend.
  • Risk Reward Ratio = 1:2 Ratio (Minimum)
  • Risk Management = 1% per Trade
  • Money Management = 50% Trade, 50% Backup.

Algo Trading

  1. Go to XAUUSD
  2. Go to 1 hour Time
  3. Find Consolidation Zone (UTC-4 NYC 18:00 to 00:00)
  4. Find Crossover after that.
  5. Entry in the crossover Position.
  6. Choose Lot Size 0.1
  7. Place SL in the lower of that 1 candle before the crossover Candle (Maximum Stoploss $60)
  8. Target is holding until another crossover.

NOTE: Trade up to Nepali Time 10 AM to 8 PM.

Copy this indicator code and paste it into your Pine Editor.

            
             //@version=5
indicator("BUY SELL SIGNAL", overlay=true)

// === Input Parameters ===
// MA and RSI Inputs
fastLength = input.int(10, "Fast MA Length")
slowLength = input.int(20, "Slow MA Length")
rsiLength = input.int(14, "RSI Length")
rsiOverbought = input.float(70, "RSI Overbought Level")
rsiOversold = input.float(30, "RSI Oversold Level")
historyLength = input.int(10, "Number of historical signals to show")

// UT Bot Inputs
aValue = input.float(1, "UT Key Value (Sensitivity)")
atrPeriod = input.int(10, "UT ATR Period")
useHeikinAshi = input.bool(false, "Use Heikin Ashi Candles")

// ATR Trailing Stop Inputs
atrStopPeriod = input.int(5, "ATR Stop Period", minval=1, maxval=500)
hhvPeriod = input.int(10, "HHV Period", minval=1, maxval=500)
atrMultiplier = input.float(2.5, "ATR Multiplier", minval=0.1)
showBarColor = input.bool(false, "Show Bar Colors")

// === Calculation of Indicators ===
// MA and RSI calculations
fastMA = ta.sma(close, fastLength)
slowMA = ta.sma(close, slowLength)
rsi = ta.rsi(close, rsiLength)

// UT Bot calculations
xATR = ta.atr(atrPeriod)
nLoss = aValue * xATR

src = useHeikinAshi ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, barmerge.gaps_off, barmerge.lookahead_off) : close

// UT Bot trailing stop
var float xATRTrailingStop = na
xATRTrailingStop := if (src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0))
    math.max(nz(xATRTrailingStop[1]), src - nLoss)
else
    if (src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0))
        math.min(nz(xATRTrailingStop[1]), src + nLoss)
    else
        if (src > nz(xATRTrailingStop[1], 0))
            src - nLoss
        else
            src + nLoss

// ATR Trailing Stop calculations
atrStop = ta.atr(atrStopPeriod)
prevHigh = ta.highest(high - atrMultiplier * atrStop, hhvPeriod)
cum_1 = ta.cum(1)
highest_1 = ta.highest(high - atrMultiplier * atrStop, hhvPeriod)
iff_1 = close > highest_1 and close > close[1] ? highest_1 : prevHigh
trailingStop = cum_1 < 16 ? close : iff_1

// === Signal Generation ===
// MACD and RSI signals
macdBuyCondition = ta.crossover(fastMA, slowMA) and rsi < rsiOversold
macdSellCondition = ta.crossunder(fastMA, slowMA) and rsi > rsiOverbought

// UT Bot signals
utBotAbove = ta.crossover(ta.ema(src, 1), xATRTrailingStop)
utBotBelow = ta.crossover(xATRTrailingStop, ta.ema(src, 1))
utBotBuy = src > xATRTrailingStop and utBotAbove
utBotSell = src < xATRTrailingStop and utBotBelow

// ATR Trailing Stop signals
atrBuy = ta.crossover(close, trailingStop)
atrSell = ta.crossunder(close, trailingStop)

// Combined signals - requires agreement from all systems
finalBuySignal = macdBuyCondition and utBotBuy and atrBuy
finalSellSignal = macdSellCondition and utBotSell and atrSell

// === Plotting ===
// Plot moving averages
plot(fastMA, color=color.new(color.blue, 0), title="Fast MA")
plot(slowMA, color=color.new(color.red, 0), title="Slow MA")

// Dynamic ATR line color based on price position
atrLineColor = close > trailingStop ? color.green : close < trailingStop ? color.red : color.black
plot(trailingStop, color=atrLineColor, linewidth=3, title="ATR Trailing Stop")

// Arrays for historical signals
var buySignals = array.new_int(0)
var sellSignals = array.new_int(0)

// Manage signal arrays
manageSignalArray(arr, newSignal) =>
    if newSignal
        array.unshift(arr, bar_index)
        if array.size(arr) > historyLength
            array.pop(arr)

manageSignalArray(buySignals, finalBuySignal)
manageSignalArray(sellSignals, finalSellSignal)

// Plot signals
plotHistoricalSignals(arr, txt, col, lblStyle) =>
    if array.size(arr) > 0
        for i = 0 to math.min(array.size(arr) - 1, historyLength - 1)
            signalBarIndex = array.get(arr, i)
            signalPrice = lblStyle == label.style_label_up ? low[signalBarIndex - bar_index] : high[signalBarIndex - bar_index]
            label.new(signalBarIndex, signalPrice, text=txt, color=col, textcolor=color.white, 
                     style=lblStyle, size=size.normal)

// Current signals
if finalBuySignal
    label.new(bar_index, low, text="STRONG BUY", color=color.green, textcolor=color.white, 
              style=label.style_label_up, size=size.large)
    
if finalSellSignal
    label.new(bar_index, high, text="STRONG SELL", color=color.red, textcolor=color.white, 
              style=label.style_label_down, size=size.large)

// Historical signals
plotHistoricalSignals(buySignals, "STRONG BUY", color.green, label.style_label_up)
plotHistoricalSignals(sellSignals, "STRONG SELL", color.red, label.style_label_down)

// Plot Buy/Sell shapes with text
plotshape(finalBuySignal, title="Buy Signal", text="BUY", style=shape.labelup, 
          location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny)
plotshape(finalSellSignal, title="Sell Signal", text="SELL", style=shape.labeldown, 
          location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny)

// Plot UT Bot signals (smaller indicators)
plotshape(utBotBuy, title="UT Buy", text="Buy", style=shape.labelup, location=location.belowbar, 
          color=color.new(color.green, 50), textcolor=color.white, size=size.tiny)
plotshape(utBotSell, title="UT Sell", text="Sell", style=shape.labeldown, location=location.abovebar, 
          color=color.new(color.red, 50), textcolor=color.white, size=size.tiny)

// Bar coloring
barColor = close > trailingStop ? color.new(color.green, 70) : color.new(color.red, 70)
barcolor(showBarColor ? barColor : na)

// Input for EMA length, default set to 200
emaLength = input.int(200, title="EMA Length", minval=1)

// Calculate the EMA
emaValue = ta.ema(close, emaLength)

// Plot the EMA with a thick white line
plot(emaValue, color=color.white, linewidth=2, title="EMA")

// Function to calculate trend based on Moving Average crossovers
getTrend(_timeframe) =>
    shortMa = ta.sma(request.security(syminfo.tickerid, _timeframe, close), 9)
    longMa = ta.sma(request.security(syminfo.tickerid, _timeframe, close), 21)
    trend = shortMa > longMa ? 1 : shortMa < longMa ? -1 : 0
    [trend, shortMa, longMa]

// Get trends and Moving Averages for different timeframes
[trend1m, shortMa1m, longMa1m] = getTrend("1")
[trend5m, shortMa5m, longMa5m] = getTrend("5")
[trend15m, shortMa15m, longMa15m] = getTrend("15")
[trend30m, shortMa30m, longMa30m] = getTrend("30")
[trend1h, shortMa1h, longMa1h] = getTrend("60")
[trend4h, shortMa4h, longMa4h] = getTrend("240")
[trend1d, shortMa1d, longMa1d] = getTrend("D")
[trend1w, shortMa1w, longMa1w] = getTrend("W")

// Function to convert trend to text and color
trendText(trendValue) =>
    trendValue == 1 ? "Bullish" : trendValue == -1 ? "Bearish" : "Neutral"

trendColor(trendValue) =>
    trendValue == 1 ? color.green : trendValue == -1 ? color.red : color.gray

// Create a smaller table for displaying trends
var table t = table.new(position.bottom_right, 2, 8, frame_color=color.black, frame_width=1)

// Populate the table with timeframes and trend text (smaller text size)
table.cell(t, 0, 0, "1 min", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 0, trendText(trend1m), text_color=color.white, bgcolor=trendColor(trend1m), text_size=size.small)

table.cell(t, 0, 1, "5 min", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 1, trendText(trend5m), text_color=color.white, bgcolor=trendColor(trend5m), text_size=size.small)

table.cell(t, 0, 2, "15 min", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 2, trendText(trend15m), text_color=color.white, bgcolor=trendColor(trend15m), text_size=size.small)

table.cell(t, 0, 3, "30 min", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 3, trendText(trend30m), text_color=color.white, bgcolor=trendColor(trend30m), text_size=size.small)

table.cell(t, 0, 4, "1 Hour", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 4, trendText(trend1h), text_color=color.white, bgcolor=trendColor(trend1h), text_size=size.small)

table.cell(t, 0, 5, "4 Hour", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 5, trendText(trend4h), text_color=color.white, bgcolor=trendColor(trend4h), text_size=size.small)

table.cell(t, 0, 6, "Daily", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 6, trendText(trend1d), text_color=color.white, bgcolor=trendColor(trend1d), text_size=size.small)

table.cell(t, 0, 7, "Weekly", text_color=color.white, bgcolor=color.black, text_size=size.small)
table.cell(t, 1, 7, trendText(trend1w), text_color=color.white, bgcolor=trendColor(trend1w), text_size=size.small)

// === Input Parameters for Session Visibility ===
// Main Sessions
g1 = "Main Trading Sessions"
show_asian = input.bool(false, "Show Asian Session", group=g1)
show_pre_london = input.bool(false, "Show Pre-London", group=g1)
show_london = input.bool(false, "Show London Session", group=g1)
show_pre_ny = input.bool(false, "Show Pre-NY", group=g1)
show_ny = input.bool(false, "Show NY Session", group=g1)

// Detailed Sessions
g2 = "Detailed Trading Sessions"
show_market_prot = input.bool(false, "Show Market Protraction", group=g2)
show_london_kz = input.bool(false, "Show London Killzone", group=g2)
show_london_launch = input.bool(false, "Show London Launch", group=g2)
show_ny_kz = input.bool(false, "Show NY Killzone", group=g2)
show_london_close = input.bool(false, "Show London Close", group=g2)
show_ny_launch = input.bool(false, "Show NY Launch", group=g2)
show_pm_session = input.bool(false, "Show PM Session", group=g2)
show_dead_time = input.bool(false, "Show Dead Time", group=g2)

// Volatile Sessions
g3 = "Volatile Sessions"
show_nyc_session = input.bool(false, "Show NYC Session (8:00-17:00)", group=g3)
show_london_full = input.bool(false, "Show London Full Session (3:00-11:00)", group=g3)
show_peak_vol_ny = input.bool(true, "Show Peak Vol. (London & NYC 8:00-12:00)", group=g3)
show_peak_vol_lon = input.bool(true, "Show Peak Vol. London (7:00-9:00)", group=g3)
show_news = input.bool(false, "Show News Release Time", group=g3)

// === Color Settings ===
g4 = "Color Settings"
asian_color = input.color(color.new(#FFD700, 90), "Asian Session", group=g4)
pre_london_color = input.color(color.new(#87CEEB, 90), "Pre-London", group=g4)
london_color = input.color(color.new(#4169E1, 90), "London Session", group=g4)
pre_ny_color = input.color(color.new(#98FB98, 90), "Pre-NY", group=g4)
ny_color = input.color(color.new(#FF6B6B, 90), "NY Session", group=g4)
market_prot_color = input.color(color.new(#DDA0DD, 90), "Market Protraction", group=g4)
london_kz_color = input.color(color.new(#FF4500, 90), "London Killzone", group=g4)
london_launch_color = input.color(color.new(#32CD32, 90), "London Launch", group=g4)
ny_kz_color = input.color(color.new(#FF1493, 90), "NY Killzone", group=g4)
london_close_color = input.color(color.new(#4682B4, 90), "London Close", group=g4)
ny_launch_color = input.color(color.new(#9370DB, 90), "NY Launch", group=g4)
pm_session_color = input.color(color.new(#20B2AA, 90), "PM Session", group=g4)
dead_time_color = input.color(color.new(#808080, 90), "Dead Time", group=g4)
nyc_session_color = input.color(color.new(#FF8C00, 90), "NYC Session", group=g4)
london_full_color = input.color(color.new(#4682B4, 90), "London Full Session", group=g4)
peak_vol_ny_color = input.color(color.new(#FF0000, 90), "Peak Vol. NYC", group=g4)
peak_vol_lon_color = input.color(color.new(#FF4500, 90), "Peak Vol. London", group=g4)
news_color = input.color(color.new(#FFD700, 90), "News Release", group=g4)

// === Helper Functions ===
is_session_now(session_start_hour, session_start_min, session_end_hour, session_end_min) =>
    current_hour = hour(time, "America/New_York")  // Using New York timezone explicitly
    current_minute = minute(time)
    current_time = current_hour * 60 + current_minute
    session_start = session_start_hour * 60 + session_start_min
    session_end = session_end_hour * 60 + session_end_min
    
    result = false
    if session_end < session_start  // Session crosses midnight
        result := current_time >= session_start or current_time < session_end
    else
        result := current_time >= session_start and current_time < session_end
    result

// Function to format time string with improved error handling
format_time(hour, minute) =>
    hour_str = str.tostring(math.min(math.max(hour, 0), 23))  // Ensure hour is between 0-23
    minute_str = str.tostring(math.min(math.max(minute, 0), 59))  // Ensure minute is between 0-59
    
    // Add leading zeros
    hour_str := hour < 10 ? "0" + hour_str : hour_str
    minute_str := minute < 10 ? "0" + minute_str : minute_str
    
    hour_str + ":" + minute_str

// Improved session name function with priority handling
get_session_name() =>
    var string session_name = "NO ACTIVE SESSION"
    
    // Order sessions by priority
    if is_session_now(7, 0, 16, 45) and show_ny
        session_name := "NEW YORK " + format_time(7, 0) + "-" + format_time(16, 45) + " ET"
    else if is_session_now(2, 0, 5, 0) and show_london
        session_name := "LONDON " + format_time(2, 0) + "-" + format_time(5, 0) + " ET"
    else if is_session_now(18, 0, 0, 0) and show_asian
        session_name := "ASIA " + format_time(18, 0) + "-" + format_time(0, 0) + " ET"
    else if is_session_now(0, 0, 2, 0) and show_pre_london
        session_name := "PRE-LON " + format_time(0, 0) + "-" + format_time(2, 0) + " ET"
    else if is_session_now(5, 0, 7, 0) and show_pre_ny
        session_name := "PRE-NY " + format_time(5, 0) + "-" + format_time(7, 0) + " ET"
    
    // Additional sessions
    if is_session_now(8, 0, 12, 0) and show_peak_vol_ny
        session_name := "PEAK VOL. " + format_time(8, 0) + "-" + format_time(12, 0) + " ET"
    else if is_session_now(7, 0, 9, 0) and show_peak_vol_lon
        session_name := "PEAK VOL. LON " + format_time(7, 0) + "-" + format_time(9, 0) + " ET"
    
    session_name

// === Session Checks and Drawing ===
var color transparent = color.new(color.white, 100)
bgcolor_final = transparent

// Priority-based session coloring
if show_peak_vol_ny and is_session_now(8, 0, 12, 0)
    bgcolor_final := peak_vol_ny_color
else if show_peak_vol_lon and is_session_now(7, 0, 9, 0)
    bgcolor_final := peak_vol_lon_color
else if show_ny and is_session_now(7, 0, 16, 45)
    bgcolor_final := ny_color
else if show_london and is_session_now(2, 0, 5, 0)
    bgcolor_final := london_color
else if show_asian and is_session_now(18, 0, 0, 0)
    bgcolor_final := asian_color
else if show_pre_london and is_session_now(0, 0, 2, 0)
    bgcolor_final := pre_london_color
else if show_pre_ny and is_session_now(5, 0, 7, 0)
    bgcolor_final := pre_ny_color

// Additional sessions with lower priority
if show_news and is_session_now(8, 30, 10, 0)
    bgcolor_final := news_color
if show_dead_time and is_session_now(15, 0, 18, 0)
    bgcolor_final := dead_time_color

bgcolor(bgcolor_final)

// Display current session name with improved visibility
var table sessionInfo = table.new(position.top_right, 1, 1, bgcolor=color.new(color.black, 60))
table.cell(sessionInfo, 0, 0, get_session_name(), text_color=color.white, text_size=size.normal)

// Inputs
length   = input.int(10, 'Swing Lookback', minval = 3)
showBull = input.int(3, 'Show Last Bullish OB', minval = 0)
showBear = input.int(3, 'Show Last Bearish OB', minval = 0)
useBody  = input(false, 'Use Candle Body')

// Style Inputs
bullCss      = input.color(color.new(#2157f3, 80), 'Bullish OB', inline = 'bullcss')
bullBreakCss = input.color(color.new(#ff1100, 80), 'Bullish Break', inline = 'bullcss')
bearCss      = input.color(color.new(#ff5d00, 80), 'Bearish OB', inline = 'bearcss')
bearBreakCss = input.color(color.new(#0cb51a, 80), 'Bearish Break', inline = 'bearcss')

// User Defined Types
type ob
    float top
    float btm
    int   loc
    bool  breaker
    int   break_loc

type swing
    float y
    int   x
    bool  crossed

// Functions
method notransp(color css) => 
    color.rgb(color.r(css), color.g(css), color.b(css))

method display(ob id, color css, color break_css) =>
    if id.breaker
        box.new(id.loc, id.top, id.break_loc, id.btm, css.notransp(), 
             bgcolor = css, 
             xloc = xloc.bar_time)

        box.new(id.break_loc, id.top, time + 1000000, id.btm, na, 
             bgcolor = break_css,
             extend = extend.right,
             xloc = xloc.bar_time)
        
        line.new(id.loc, id.top, id.break_loc, id.top, 
             xloc = xloc.bar_time,
             color = css.notransp())
        line.new(id.loc, id.btm, id.break_loc, id.btm, 
             xloc = xloc.bar_time,
             color = css.notransp())
        line.new(id.break_loc, id.top, time + 1000000, id.top, 
             xloc = xloc.bar_time,
             extend = extend.right,
             color = break_css.notransp(),
             style = line.style_dashed)
        line.new(id.break_loc, id.btm, time + 1000000, id.btm, 
             xloc = xloc.bar_time,
             extend = extend.right,
             color = break_css.notransp(),
             style = line.style_dashed)
    else
        box.new(id.loc, id.top, time + 1000000, id.btm, na,
             bgcolor = css,
             extend = extend.right,
             xloc = xloc.bar_time)
        
        line.new(id.loc, id.top, time + 1000000, id.top,
             xloc = xloc.bar_time,
             extend = extend.right,
             color = css.notransp())
        line.new(id.loc, id.btm, time + 1000000, id.btm,
             xloc = xloc.bar_time,
             extend = extend.right,
             color = css.notransp())

swings(int len) =>
    var os = 0
    var swing top = swing.new(na, na, false)
    var swing btm = swing.new(na, na, false)
    
    upper = ta.highest(high, len)
    lower = ta.lowest(low, len)

    os := high[len] > upper ? 0 : low[len] < lower ? 1 : os

    if os == 0 and os[1] != 0
        top := swing.new(high[len], bar_index[len], false)
    
    if os == 1 and os[1] != 1
        btm := swing.new(low[len], bar_index[len], false)

    [top, btm]

// Initialize Arrays
var array bullish_ob = array.new()
var array bearish_ob = array.new()

// Main Variables
n = bar_index
max = useBody ? math.max(close, open) : high
min = useBody ? math.min(close, open) : low

// Get Swings
[top, btm] = swings(length)

// Detect Bullish Order Blocks
if close > top.y and not top.crossed
    top.crossed := true

    minima = max[1]
    maxima = min[1]
    loc = time[1]

    for i = 1 to (n - top.x)-1
        minima := math.min(min[i], minima)
        maxima := minima == min[i] ? max[i] : maxima
        loc := minima == min[i] ? time[i] : loc

    bullish_ob.unshift(ob.new(maxima, minima, loc, false, na))

// Process Bullish Order Blocks
if array.size(bullish_ob) > 0
    for i = array.size(bullish_ob)-1 to 0
        element = array.get(bullish_ob, i)
    
        if not element.breaker 
            if math.min(close, open) < element.btm
                element.breaker := true
                element.break_loc := time
        else
            if close > element.top
                array.remove(bullish_ob, i)

// Detect Bearish Order Blocks
if close < btm.y and not btm.crossed
    btm.crossed := true

    minima = min[1]
    maxima = max[1]
    loc = time[1]

    for i = 1 to (n - btm.x)-1
        maxima := math.max(max[i], maxima)
        minima := maxima == max[i] ? min[i] : minima
        loc := maxima == max[i] ? time[i] : loc

    bearish_ob.unshift(ob.new(maxima, minima, loc, false, na))

// Process Bearish Order Blocks
if array.size(bearish_ob) > 0
    for i = array.size(bearish_ob)-1 to 0
        element = array.get(bearish_ob, i)

        if not element.breaker 
            if math.max(close, open) > element.top
                element.breaker := true
                element.break_loc := time
        else
            if close < element.btm
                array.remove(bearish_ob, i)

// Display Order Blocks
if barstate.islast
    // Clear previous drawings
    box.all.clear()
    line.all.clear()

    // Display Bullish Blocks
    if showBull > 0
        for i = 0 to math.min(showBull-1, array.size(bullish_ob)-1)
            get_ob = array.get(bullish_ob, i)
            get_ob.display(bullCss, bullBreakCss)

    // Display Bearish Blocks
    if showBear > 0
        for i = 0 to math.min(showBear-1, array.size(bearish_ob)-1)
            get_ob = array.get(bearish_ob, i)
            get_ob.display(bearCss, bearBreakCss)
            
        

Algo Scalping

  1. 1 minute timeframe.
  2. Entry after Line crossover
  3. Lot size: 0.5
  4. SL: $80
  5. Target: 1:6 from below recent low.
  6. Now change the SL to Swing High/Low
  7. Book Profit or SL if Line Crossover.