Strategy · Pine Script v5 · On the chart

Marketman Intraday Profile Strategy v2

by brandonking078-boop

A second strategy version for index futures built on New York session phases, session VWAP, previous day high and low, EMAs, ATR and RSI with thresholds that tighten in low volatility.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code160
Settings0inputs
LicenceMIT
Last update4 months ago20 Jun 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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

160 lines of Pine Script v5 from marketman_intraday_profile_strategy_v2.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

marketman_intraday_profile_strategy_v2.pine
//@version=5
strategy("Marketman Intraday Profile Strategy v2", overlay=true, default_qty_type=strategy.fixed, default_qty_value=1, initial_capital=100000, currency=currency.USD, calc_on_every_tick=true, pyramiding=1)

// --- Compatibility notes -----------------------------------------------------
// Pine Script v5 strategy designed for TradingView execution and webhook alerting.
// This version emphasizes phase-aware session modeling and uses TradeLocker-compatible alerts.
// For Tradovate, map alert JSON fields to your execution adapter.

var string SYMBOL_ROOT = syminfo.root_symbol
bool isES = str.contains(SYMBOL_ROOT, "ES")
bool isNQ = str.contains(SYMBOL_ROOT, "NQ")

float tickSize = isES or isNQ ? 0.25 : syminfo.mintick
float tickValue = isES ? (str.contains(SYMBOL_ROOT, "M") ? 5.0 : 50.0) : isNQ ? (str.contains(SYMBOL_ROOT, "M") ? 0.5 : 20.0) : 1.0

string nySession = "0930-1600"
string lunchSession = "1130-1330"
string pmSession = "1530-1600"

bool inSession = not na(time(timeframe.period, nySession, "America/New_York"))
bool inLunch = not na(time(timeframe.period, lunchSession, "America/New_York"))
bool inPM = not na(time(timeframe.period, pmSession, "America/New_York"))

bool sessionOpen = inSession and not inSession[1]

float pdh = request.security(syminfo.tickerid, "D", high[1], lookahead=barmerge.lookahead_off)
float pdl = request.security(syminfo.tickerid, "D", low[1], lookahead=barmerge.lookahead_off)

float sessionVWAP = ta.vwap
float ema21 = ta.ema(close, 21)
float ema8 = ta.ema(close, 8)
float atr14 = ta.atr(14)
float rsi14 = ta.rsi(close, 14)

bool lowVolatility = atr14 < ta.sma(atr14, 20) * 0.75
int rsiUpper = lowVolatility ? 60 : 70
int rsiLower = lowVolatility ? 40 : 30

var float[] profilePrices = array.new_float()
var float[] profileVolumes = array.new_float()

if sessionOpen
    array.clear(profilePrices)
    array.clear(profileVolumes)

if inSession
    array.push(profilePrices, hlc3)
    array.push(profileVolumes, volume)

f_profile(_prices, _vols, _bins) =>
    float[] bins = array.new_float(_bins, 0.0)
    float priceMin = array.size(_prices) > 0 ? array.min(_prices) : na
    float priceMax = array.size(_prices) > 0 ? array.max(_prices) : na
    if na(priceMin) or na(priceMax) or priceMax == priceMin
        [na, na, na]
    else
        float width = priceMax - priceMin
        float step = width / _bins
        for i = 0 to array.size(_prices) - 1
            float p = array.get(_prices, i)
            float v = array.get(_vols, i)
            int index = int(math.floor((p - priceMin) / step))
            index := math.min(_bins - 1, math.max(0, index))
            array.set(bins, index, array.get(bins, index) + v)
        int pocIndex = 0
        float maxVol = 0.0
        for i = 0 to _bins - 1
            float currentVol = array.get(bins, i)
            if currentVol > maxVol
                maxVol := currentVol
                pocIndex := i
        float totalVol = 0.0
        for i = 0 to _bins - 1
            totalVol += array.get(bins, i)
        float targetVol = totalVol * 0.7
        int lowIndex = pocIndex
        int highIndex = pocIndex
        float running = array.get(bins, pocIndex)
        while running < targetVol and (lowIndex > 0 or highIndex < _bins - 1)
            float leftVol = lowIndex > 0 ? array.get(bins, lowIndex - 1) : -1.0
            float rightVol = highIndex < _bins - 1 ? array.get(bins, highIndex + 1) : -1.0
            if leftVol >= rightVol and lowIndex > 0
                lowIndex -= 1
                running += leftVol
            else if highIndex < _bins - 1
                highIndex += 1
                running += rightVol
            else
                break
        float pocPrice = priceMin + (pocIndex + 0.5) * step
        float vahPrice = priceMin + (highIndex + 1) * step
        float valPrice = priceMin + lowIndex * step
        [pocPrice, vahPrice, valPrice]

float sessionPOC = na
float sessionVAH = na
float sessionVAL = na
if array.size(profilePrices) > 0
    [sessionPOC, sessionVAH, sessionVAL] = f_profile(profilePrices, profileVolumes, 24)

float devSD = ta.stdev(hlc3, 20)
float vwapUpper1 = sessionVWAP + devSD
float vwapUpper2 = sessionVWAP + devSD * 2
float vwapLower1 = sessionVWAP - devSD
float vwapLower2 = sessionVWAP - devSD * 2

float deltaBar = close > open ? volume : close < open ? -volume : 0
var float cumDelta = 0.0
cumDelta := inSession ? nz(cumDelta[1]) + deltaBar : 0.0
bool deltaBullish = cumDelta > nz(cumDelta[1])
bool deltaBearish = cumDelta < nz(cumDelta[1])

bool sweepLong = low < sessionVAL and close > sessionVAL and deltaBullish
bool sweepShort = high > sessionVAH and close < sessionVAH and deltaBearish

bool trendLong = close > ema21 and close > sessionVWAP
bool trendShort = close < ema21 and close < sessionVWAP

bool breakoutLong = close > math.max(sessionVAH, pdh)
bool breakoutShort = close < math.min(sessionVAL, pdl)

bool rsiLongOK = rsi14 < rsiUpper
bool rsiShortOK = rsi14 > rsiLower

bool longEntry = inSession and trendLong and (sweepLong or breakoutLong) and rsiLongOK and not inLunch
bool shortEntry = inSession and trendShort and (sweepShort or breakoutShort) and rsiShortOK and not inLunch

float riskPct = 0.01
float riskDollars = strategy.equity * riskPct
float stopBuffer = tickSize * 2
float longStop = math.max(close - atr14 * 1.1, sessionVAL - stopBuffer)
float shortStop = math.min(close + atr14 * 1.1, sessionVAH + stopBuffer)
float longRiskPts = math.max(0.25, close - longStop)
float shortRiskPts = math.max(0.25, shortStop - close)
int longQty = math.max(1, int(math.floor(riskDollars / (longRiskPts * tickValue))))
int shortQty = math.max(1, int(math.floor(riskDollars / (shortRiskPts * tickValue))))

float profitTargetLong = close + longRiskPts * 2.0
float profitTargetShort = close - shortRiskPts * 2.0

if longEntry and strategy.position_size <= 0
    strategy.entry("Long", strategy.long, qty=longQty)
    strategy.exit("LongExit", from_entry="Long", stop=longStop, limit=profitTargetLong)
    alert('{"event":"LongEntry","symbol":"' + syminfo.ticker + '","price":' + str.tostring(close, format.mintick) + ',"stop":' + str.tostring(longStop, format.mintick) + ',"target":' + str.tostring(profitTargetLong, format.mintick) + ',"qty":' + str.tostring(longQty) + '}', alert.freq_once_per_bar_close)

if shortEntry and strategy.position_size >= 0
    strategy.entry("Short", strategy.short, qty=shortQty)
    strategy.exit("ShortExit", from_entry="Short", stop=shortStop, limit=profitTargetShort)
    alert('{"event":"ShortEntry","symbol":"' + syminfo.ticker + '","price":' + str.tostring(close, format.mintick) + ',"stop":' + str.tostring(shortStop, format.mintick) + ',"target":' + str.tostring(profitTargetShort, format.mintick) + ',"qty":' + str.tostring(shortQty) + '}', alert.freq_once_per_bar_close)

plot(sessionVWAP, title="Session VWAP", color=color.blue, linewidth=2)
plot(vwapUpper1, title="VWAP +1σ", color=color.new(color.blue, 80))
plot(vwapLower1, title="VWAP -1σ", color=color.new(color.blue, 80))
plot(sessionPOC, title="Session POC", color=color.orange, linewidth=2)
plot(sessionVAH, title="Session VAH", color=color.green, linewidth=2)
plot(sessionVAL, title="Session VAL", color=color.red, linewidth=2)
plot(pdh, title="Previous Day High", color=color.gray, linewidth=1)
plot(pdl, title="Previous Day Low", color=color.gray, linewidth=1)

bgcolor(inSession ? (inPM ? color.new(color.teal, 90) : inLunch ? color.new(color.yellow, 90) : color.new(color.green, 95)) : na)

Overview

Marketman Intraday Profile Strategy v2 builds a session volume profile from price and volume to find the point of control and value area. It calculates on every tick, so signals can change on the live bar, and it is designed to send alerts to execution bridges.

Details

Published by

brandonking078-boop on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Volume, Sessions & time

Markets

Indices

Timeframes

M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
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

106 stars

This Pine Script strategy identifies potential Buy Today, Sell Tomorrow (BTST) opportunities based on price action and volume patterns. It calculates a 20-period simple moving average of volume and checks for three consecutive bullish candles with higher highs

Strategy v4 TrendVolume
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Higher High Price & Vol
39 stars

This intraday strategy implements Mark Fisher's Opening Range Breakout (ORB) methodology tailored for index futures like ES and NQ. It calculates session opening ranges, volume z-scores, and VWAP bands to plot support, resistance, and confirmation levels on th

Strategy v6 BreakoutSessions & time Repaints
Updated 5 days ago · MIT GitHub repository of Futures Intraday Pro (ES/NQ) Strategy
23 stars

This strategy evaluates breakout and trend opportunities on the price chart using a weighted composite score of volume, trend, and candlestick structure. It tracks volume spikes, fast and slow EMAs, higher-timeframe EMA trend alignment, opening ranges, and ses

Strategy v6 TrendVolume Repaints
Updated 3 weeks ago · Custom licence GitHub repository of TradingAlpha Point-Clip Strategy

ICT ORB Strategy

by alboogycOdR
6 stars

This strategy backtests opening-range breakouts on the price chart for New York, London, Asia, or a custom session. Simple mode follows the opening-range direction when relative volume is high enough. ICT mode can require a fair value gap, displacement, and an

Strategy v5 BreakoutSMC / ICT / price action Repaints
Updated 7 months ago · None stated GitHub repository of ICT ORB Strategy
4 stars

This strategy draws on the price chart and identifies mean-reversion opportunities around daily volume-weighted average price (VWAP) bands. It enters long positions when the price crosses above the lower band while the Relative Strength Index indicates oversol

Strategy v6 Mean reversionSessions & time
Updated 2 months ago · MIT GitHub repository of NQ VWAP Reversion [trugurpala]

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers