Indicator · Pine Script v6 · On the chart

Crypto AMT Session Bias v1

by latifangren

An overlay indicator that tracks the Asia, London and New York sessions in a chosen timezone and draws each session's high, low and opening range.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code240
Settings17inputs
LicenceMIT
Last update5 months ago26 May 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

240 lines of Pine Script v6 from indicator/crypto_amt_session_bias_v1.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

crypto_amt_session_bias_v1.pine
//@version=6
indicator(
     "Crypto AMT Session Bias v1",
     shorttitle = "AMT Session Bias v1",
     overlay = true,
     max_labels_count = 200)

//────────────────────────────────────────────────────────────────────
// Inputs
//────────────────────────────────────────────────────────────────────
groupSessions = "1. Sessions"
showAsiaSession = input.bool(true, "Enable Asia session", group = groupSessions)
asiaSession = input.session("0000-0800", "Asia session", group = groupSessions)
showLondonSession = input.bool(true, "Enable London session", group = groupSessions)
londonSession = input.session("0700-1600", "London session", group = groupSessions)
showNewYorkSession = input.bool(true, "Enable New York session", group = groupSessions)
newYorkSession = input.session("1300-2200", "New York session", group = groupSessions)
sessionTimezone = input.string("Etc/UTC", "Session timezone", options = ["Etc/UTC", "America/New_York", "Europe/London", "Asia/Tokyo", "Asia/Singapore"], group = groupSessions)

groupLogic = "2. Logic"
openingRangeMinutes = input.int(60, "Opening range minutes", minval = 1, maxval = 240, group = groupLogic)
allowSameBarReclaim = input.bool(true, "Allow same-bar reclaim", group = groupLogic)
confirmAlertsOnClose = input.bool(true, "Confirm alerts on bar close", group = groupLogic)

groupDisplay = "3. Display"
showCurrentLevels = input.bool(true, "Show current session levels", group = groupDisplay)
showPreviousLevels = input.bool(true, "Show previous completed levels", group = groupDisplay)
showOpeningRange = input.bool(true, "Show opening range", group = groupDisplay)
showMarkers = input.bool(true, "Show sweep/reclaim markers", group = groupDisplay)
showDashboard = input.bool(true, "Show dashboard", group = groupDisplay)
showBackgroundTint = input.bool(true, "Show background tint", group = groupDisplay)
showBiasBarColor = input.bool(false, "Color bars by session bias", group = groupDisplay)

//────────────────────────────────────────────────────────────────────
// Helpers
//────────────────────────────────────────────────────────────────────
formatPrice(float value) =>
    na(value) ? "na" : str.tostring(value, format.mintick)

formatRange(float highValue, float lowValue) =>
    na(highValue) or na(lowValue) ? "na" : formatPrice(highValue) + " / " + formatPrice(lowValue)

//────────────────────────────────────────────────────────────────────
// Session detection
//────────────────────────────────────────────────────────────────────
bool inAsia = showAsiaSession and not na(time(timeframe.period, asiaSession, sessionTimezone))
bool inLondon = showLondonSession and not na(time(timeframe.period, londonSession, sessionTimezone))
bool inNewYork = showNewYorkSession and not na(time(timeframe.period, newYorkSession, sessionTimezone))

string activeSessionName = inNewYork ? "New York" : inLondon ? "London" : inAsia ? "Asia" : "None"
bool inActiveSession = activeSessionName != "None"

//────────────────────────────────────────────────────────────────────
// Session state
//────────────────────────────────────────────────────────────────────
var string currentSessionName = "None"
var float sessionOpen = na
var float sessionHigh = na
var float sessionLow = na
var float sessionMid = na
var int sessionStartTime = na
var float openingRangeHigh = na
var float openingRangeLow = na
var float openingRangeMid = na

var string previousSessionName = "None"
var float previousSessionOpen = na
var float previousSessionHigh = na
var float previousSessionLow = na
var float previousSessionMid = na

var bool highSweptThisSession = false
var bool lowSweptThisSession = false
var bool highReclaimedThisSession = false
var bool lowReclaimedThisSession = false
var int highSweepBar = na
var int lowSweepBar = na
var int biasState = 0
var string lastEvent = "None"

bool sessionChanged = activeSessionName != currentSessionName
bool startingSession = inActiveSession and sessionChanged
bool endingSession = not inActiveSession and currentSessionName != "None"

if sessionChanged
    if currentSessionName != "None" and not na(sessionHigh) and not na(sessionLow)
        previousSessionName := currentSessionName
        previousSessionOpen := sessionOpen
        previousSessionHigh := sessionHigh
        previousSessionLow := sessionLow
        previousSessionMid := sessionMid

    currentSessionName := activeSessionName
    sessionOpen := inActiveSession ? open : na
    sessionHigh := inActiveSession ? high : na
    sessionLow := inActiveSession ? low : na
    sessionMid := inActiveSession ? (high + low) * 0.5 : na
    sessionStartTime := inActiveSession ? time : na
    openingRangeHigh := inActiveSession ? high : na
    openingRangeLow := inActiveSession ? low : na
    openingRangeMid := inActiveSession ? (high + low) * 0.5 : na
    highSweptThisSession := false
    lowSweptThisSession := false
    highReclaimedThisSession := false
    lowReclaimedThisSession := false
    highSweepBar := na
    lowSweepBar := na
    biasState := 0
    lastEvent := startingSession ? "Session Start" : endingSession ? "Session End" : "None"
else if inActiveSession
    sessionHigh := na(sessionHigh) ? high : math.max(sessionHigh, high)
    sessionLow := na(sessionLow) ? low : math.min(sessionLow, low)
    sessionMid := (sessionHigh + sessionLow) * 0.5

    bool inOpeningRange = not na(sessionStartTime) and time < sessionStartTime + openingRangeMinutes * 60000
    if inOpeningRange
        openingRangeHigh := na(openingRangeHigh) ? high : math.max(openingRangeHigh, high)
        openingRangeLow := na(openingRangeLow) ? low : math.min(openingRangeLow, low)
        openingRangeMid := (openingRangeHigh + openingRangeLow) * 0.5

//────────────────────────────────────────────────────────────────────
// Sweep, reclaim, bias
//────────────────────────────────────────────────────────────────────
bool hasPreviousLevels = not na(previousSessionHigh) and not na(previousSessionLow)
bool alertReady = not confirmAlertsOnClose or barstate.isconfirmed
bool sweepHighEvent = inActiveSession and hasPreviousLevels and not highSweptThisSession and high > previousSessionHigh
bool sweepLowEvent = inActiveSession and hasPreviousLevels and not lowSweptThisSession and low < previousSessionLow

if sweepHighEvent
    highSweptThisSession := true
    highSweepBar := bar_index
    lastEvent := "Sweep High"

if sweepLowEvent
    lowSweptThisSession := true
    lowSweepBar := bar_index
    lastEvent := "Sweep Low"

bool highReclaimReady = highSweptThisSession and not highReclaimedThisSession and not na(previousSessionHigh) and (allowSameBarReclaim or bar_index > highSweepBar)
bool lowReclaimReady = lowSweptThisSession and not lowReclaimedThisSession and not na(previousSessionLow) and (allowSameBarReclaim or bar_index > lowSweepBar)
bool reclaimAfterHighSweep = inActiveSession and highReclaimReady and close < previousSessionHigh
bool reclaimAfterLowSweep = inActiveSession and lowReclaimReady and close > previousSessionLow

bool biasFlip = false
if reclaimAfterHighSweep
    highReclaimedThisSession := true
    biasFlip := biasState != -1
    biasState := -1
    lastEvent := "Bear Reclaim"

if reclaimAfterLowSweep
    lowReclaimedThisSession := true
    biasFlip := biasState != 1
    biasState := 1
    lastEvent := "Bull Reclaim"

string biasText = biasState == 1 ? "BULLISH" : biasState == -1 ? "BEARISH" : "NEUTRAL"
color biasColor = biasState == 1 ? color.new(color.lime, 20) : biasState == -1 ? color.new(color.red, 20) : color.new(color.gray, 35)
bool alertSweepHigh = sweepHighEvent and alertReady
bool alertSweepLow = sweepLowEvent and alertReady
bool alertReclaimAfterSweep = (reclaimAfterHighSweep or reclaimAfterLowSweep) and alertReady
bool alertBiasFlip = biasFlip and alertReady

//────────────────────────────────────────────────────────────────────
// Plots
//────────────────────────────────────────────────────────────────────
color colCurrentHigh = color.rgb(76, 175, 80)
color colCurrentLow = color.rgb(244, 67, 54)
color colCurrentMid = color.rgb(120, 130, 145)
color colCurrentOpen = color.rgb(255, 193, 7)
color colOpeningRange = color.rgb(33, 150, 243)
color colPrevious = color.rgb(156, 39, 176)

plot(showCurrentLevels and inActiveSession ? sessionHigh : na, "Current Session High", color = color.new(colCurrentHigh, 35), linewidth = 1, style = plot.style_linebr)
plot(showCurrentLevels and inActiveSession ? sessionLow : na, "Current Session Low", color = color.new(colCurrentLow, 35), linewidth = 1, style = plot.style_linebr)
plot(showCurrentLevels and inActiveSession ? sessionMid : na, "Current Session Mid", color = color.new(colCurrentMid, 45), linewidth = 1, style = plot.style_linebr)
plot(showCurrentLevels and inActiveSession ? sessionOpen : na, "Current Session Open", color = color.new(colCurrentOpen, 35), linewidth = 1, style = plot.style_linebr)

plot(showOpeningRange and inActiveSession ? openingRangeHigh : na, "Opening Range High", color = color.new(colOpeningRange, 45), linewidth = 1, style = plot.style_linebr)
plot(showOpeningRange and inActiveSession ? openingRangeLow : na, "Opening Range Low", color = color.new(colOpeningRange, 45), linewidth = 1, style = plot.style_linebr)
plot(showOpeningRange and inActiveSession ? openingRangeMid : na, "Opening Range Mid", color = color.new(colOpeningRange, 65), linewidth = 1, style = plot.style_linebr)

plot(showPreviousLevels ? previousSessionHigh : na, "Previous Session High", color = color.new(colPrevious, 35), linewidth = 1, style = plot.style_linebr)
plot(showPreviousLevels ? previousSessionLow : na, "Previous Session Low", color = color.new(colPrevious, 35), linewidth = 1, style = plot.style_linebr)

bgcolor(showBackgroundTint and inActiveSession ? color.new(biasState == 1 ? color.lime : biasState == -1 ? color.red : color.gray, 92) : na)
barcolor(showBiasBarColor and biasState != 0 ? color.new(biasState == 1 ? color.lime : color.red, 25) : na)

//────────────────────────────────────────────────────────────────────
// Markers
//────────────────────────────────────────────────────────────────────
plotshape(showMarkers and sweepHighEvent, "Sweep High", shape.triangledown, location.abovebar, color.new(color.red, 0), text = "Sweep High", textcolor = color.white, size = size.tiny)
plotshape(showMarkers and sweepLowEvent, "Sweep Low", shape.triangleup, location.belowbar, color.new(color.lime, 0), text = "Sweep Low", textcolor = color.black, size = size.tiny)
plotshape(showMarkers and reclaimAfterHighSweep, "Bearish Reclaim", shape.labeldown, location.abovebar, color.new(color.red, 0), text = "Reclaim\nBear Bias", textcolor = color.white, size = size.tiny)
plotshape(showMarkers and reclaimAfterLowSweep, "Bullish Reclaim", shape.labelup, location.belowbar, color.new(color.lime, 0), text = "Reclaim\nBull Bias", textcolor = color.black, size = size.tiny)

//────────────────────────────────────────────────────────────────────
// Alerts
//────────────────────────────────────────────────────────────────────
alertcondition(alertSweepHigh, "AMT Session Bias v1 Sweep High", "AMT Session Bias v1 Sweep High on {{ticker}} {{interval}}")
alertcondition(alertSweepLow, "AMT Session Bias v1 Sweep Low", "AMT Session Bias v1 Sweep Low on {{ticker}} {{interval}}")
alertcondition(alertReclaimAfterSweep, "AMT Session Bias v1 Reclaim After Sweep", "AMT Session Bias v1 Reclaim After Sweep on {{ticker}} {{interval}}")
alertcondition(alertBiasFlip, "AMT Session Bias v1 Bias Flip", "AMT Session Bias v1 Bias Flip on {{ticker}} {{interval}}")

//────────────────────────────────────────────────────────────────────
// Dashboard
//────────────────────────────────────────────────────────────────────
var table dash = table.new(position.top_right, 2, 9, border_width = 1)

if barstate.islast and showDashboard
    string sweepText = highSweptThisSession and lowSweptThisSession ? "HIGH + LOW" : highSweptThisSession ? "HIGH" : lowSweptThisSession ? "LOW" : "NONE"

    table.cell(dash, 0, 0, "AMT Session Bias v1", text_color = color.white, bgcolor = color.new(color.black, 0))
    table.cell(dash, 1, 0, biasText, text_color = color.white, bgcolor = biasColor)

    table.cell(dash, 0, 1, "Active Session", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 1, currentSessionName, text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 2, "Current H / L", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 2, formatRange(sessionHigh, sessionLow), text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 3, "Current Mid / Open", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 3, formatPrice(sessionMid) + " / " + formatPrice(sessionOpen), text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 4, "Opening Range", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 4, formatRange(openingRangeHigh, openingRangeLow), text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 5, "Previous H / L", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 5, formatRange(previousSessionHigh, previousSessionLow), text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 6, "Previous Session", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 6, previousSessionName, text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 7, "Sweep State", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 7, sweepText, text_color = color.white, bgcolor = color.new(color.black, 75))

    table.cell(dash, 0, 8, "Last Event", text_color = color.white, bgcolor = color.new(color.black, 30))
    table.cell(dash, 1, 8, lastEvent, text_color = color.white, bgcolor = color.new(color.black, 75))
else if barstate.islast and not showDashboard
    table.clear(dash, 0, 0, 1, 8)

Overview

Crypto AMT Session Bias v1 marks sweeps of the previous session's high or low and reclaims back inside, derives a bullish or bearish session bias, and shows it on a dashboard with optional background tint and bar coloring. Alerts can be set to fire on bar close. Session times and opening range length are adjustable.

Details

Published by

latifangren on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Sessions & time, Support & resistance, Screeners & dashboards

Markets

Crypto

Timeframes

M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Enable Asia sessionbooltrueshowAsiaSession
Asia sessionsession0000-0800asiaSession
Enable London sessionbooltrueshowLondonSession
London sessionsession0700-1600londonSession
Enable New York sessionbooltrueshowNewYorkSession
New York sessionsession1300-2200newYorkSession
Session timezonestringEtc/UTCsessionTimezone
Opening range minutesint60openingRangeMinutes
Allow same-bar reclaimbooltrueallowSameBarReclaim
Confirm alerts on bar closebooltrueconfirmAlertsOnClose
Show current session levelsbooltrueshowCurrentLevels
Show previous completed levelsbooltrueshowPreviousLevels
Show all 17 settings
SettingTypeDefaultVariable
Show opening rangebooltrueshowOpeningRange
Show sweep/reclaim markersbooltrueshowMarkers
Show dashboardbooltrueshowDashboard
Show background tintbooltrueshowBackgroundTint
Color bars by session biasboolfalseshowBiasBarColor
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

This indicator builds Market Profile Time Price Opportunity (TPO) structures across defined session timeframes directly on the main price chart. It visualizes the Point of Control (POC) and Value Area boundaries using dynamic box drawings. An integrated multi-

Indicator v5 Support & resistanceScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of Market Profile with Screener
257 stars

This indicator overlays an intraday SPX and ES chart with a midnight session range, regular-trading-hours opening levels, and a VWAP projection box. It draws the midnight high, mid, and low, flags edge rejections within an absolute tolerance, and plots optiona

Indicator v6 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of SPX Midnight Box + Snag Logic

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

Session Edge Probabilities

by TraderOracle
61 stars

Session Edge Probabilities tracks eight session-based trading rules using statistical probabilities evaluated on historical chart data. It utilizes a fixed calculation timeframe to evaluate opening ranges, midnight levels, afternoon reversal windows, and price

Indicator v6 Sessions & timeScreeners & dashboards
Updated 10 days ago · None stated GitHub repository of Session Edge Probabilities
56 stars

This indicator marks forex trading sessions and opening ranges on the price chart. It can draw Sydney, Tokyo, Frankfurt, London, and New York session boxes or five- and fifteen-minute opening ranges, plus an optional opening channel and a day-open range. Day r

Indicator v5 Sessions & timeSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Day Trading Booster by DGT

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers