Indicator · Pine Script v5 · On the chart

GrimmPaint 2.0 Alerts

by GreyssonEnterprises· code credited to allanster

An indicator that marks gap-style candles where the low is above the high from two bars earlier (bullish) or the high is below the low from two bars earlier (bearish).

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code148
Settings3inputs
LicenceMIT
Last update3 months ago1 Aug 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

148 lines of Pine Script v5 from strategies/silver/documentation/paint2.0.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

paint2.0.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © allanster

//@version=5
indicator(title = "GrimmPaint 2.0 Alerts", shorttitle = "Paint2.0", overlay = true)

BullLabel = "Bullish Paint"
BearLabel = "Bearish Paint"

BullPaint = low > high[2] and low > high[2] 
BearPaint = high < low[2] and high < low[2]

// Time filter
time_1_session = input.session("0700-0900", "Time 1", group="Time Windows")
time_2_session = input.session("1000-1200", "Time 2", group="Time Windows")
time_3_session = input.session("", "Time 3", group="Time Windows")

is_time_1 = time(timeframe.period, time_1_session, "America/Los_Angeles")
is_time_2 = time(timeframe.period, time_2_session, "America/Los_Angeles")
is_time_3 = time(timeframe.period, time_3_session, "America/Los_Angeles")

inTimeWindow = (not na(is_time_1) or not na(is_time_2) or not na(is_time_3)) and dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday

// Daily close time at 1pm Pacific
closeTime = time(timeframe.period, "1300-1301", "America/Los_Angeles")
shouldClose = not na(closeTime) and dayofweek != dayofweek.saturday and dayofweek != dayofweek.sunday

// Track paint levels and stop levels
var float bullPaintHigh = na
var float bullPaintLow = na
var float bullStopLevel = na
var bool bullPaintActive = false
var bool bullPositionOpen = false

var float bearPaintLow = na  
var float bearPaintHigh = na
var float bearStopLevel = na
var bool bearPaintActive = false
var bool bearPositionOpen = false

// Detect new paint signals and store levels
if BullPaint and not bullPaintActive
    bullPaintHigh := high
    bullPaintLow := low
    bullStopLevel := low[3]  // Low from 2 bars before the paint candle
    bullPaintActive := true

if BearPaint and not bearPaintActive
    bearPaintLow := low
    bearPaintHigh := high  
    bearStopLevel := high[3]  // High from 2 bars before the paint candle
    bearPaintActive := true

// Re-entry conditions
bullReEntry = bullPaintActive and close > bullPaintLow and close < bullPaintHigh and low <= bullPaintLow
bearReEntry = bearPaintActive and close < bearPaintHigh and close > bearPaintLow and high >= bearPaintHigh

// Calculate take profit levels (4.6x risk)
bullTPLevel = bullPaintLow + (bullPaintLow - bullStopLevel) * 4.6
bearTPLevel = bearPaintHigh - (bearStopLevel - bearPaintHigh) * 4.6

// Entry conditions
longCondition = bullReEntry and inTimeWindow and not bullPositionOpen and not bearPositionOpen
shortCondition = bearReEntry and inTimeWindow and not bearPositionOpen and not bullPositionOpen

// Track position openings
var bool longEntryTriggered = false
var bool shortEntryTriggered = false

if longCondition and not longEntryTriggered
    longEntryTriggered := true
    bullPositionOpen := true
    bullPaintActive := false

if shortCondition and not shortEntryTriggered
    shortEntryTriggered := true
    bearPositionOpen := true
    bearPaintActive := false

// Check for position exits
var bool longExitTriggered = false
var bool shortExitTriggered = false

// Long position exits
if bullPositionOpen
    longStopHit = low <= bullStopLevel
    longTargetHit = high >= bullTPLevel
    longDailyClose = shouldClose
    
    if (longStopHit or longTargetHit or longDailyClose) and not longExitTriggered
        longExitTriggered := true
        bullPositionOpen := false

// Short position exits  
if bearPositionOpen
    shortStopHit = high >= bearStopLevel
    shortTargetHit = low <= bearTPLevel
    shortDailyClose = shouldClose
    
    if (shortStopHit or shortTargetHit or shortDailyClose) and not shortExitTriggered
        shortExitTriggered := true
        bearPositionOpen := false

// Reset triggers for next bar
if longEntryTriggered[1]
    longEntryTriggered := false
if shortEntryTriggered[1] 
    shortEntryTriggered := false
if longExitTriggered[1]
    longExitTriggered := false
if shortExitTriggered[1]
    shortExitTriggered := false

// Reset paint active status when far from levels
if bullPaintActive and (high > bullPaintHigh * 1.1 or low < bullStopLevel)
    bullPaintActive := false
    
if bearPaintActive and (low < bearPaintLow * 0.9 or high > bearStopLevel)  
    bearPaintActive := false

// Visual indicators
barcolor(BullPaint ? color.green : BearPaint ? color.red : na, offset=-1)

// Plot position indicators
plotshape(longEntryTriggered, title="Long Entry", style=shape.triangleup, location=location.belowbar, color=color.lime, size=size.normal, text="LONG")
plotshape(shortEntryTriggered, title="Short Entry", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.normal, text="SHORT")

// Plot levels for visualization
plot(bullPaintActive ? bullPaintHigh : na, color=color.green, style=plot.style_line, title="Bull Paint High")
plot(bullPaintActive ? bullPaintLow : na, color=color.green, style=plot.style_line, title="Bull Paint Low") 
plot(bullPositionOpen ? bullStopLevel : na, color=color.red, style=plot.style_line, title="Bull Stop")
plot(bullPositionOpen ? bullTPLevel : na, color=color.blue, style=plot.style_line, title="Bull TP")

plot(bearPaintActive ? bearPaintLow : na, color=color.red, style=plot.style_line, title="Bear Paint Low")
plot(bearPaintActive ? bearPaintHigh : na, color=color.red, style=plot.style_line, title="Bear Paint High")
plot(bearPositionOpen ? bearStopLevel : na, color=color.red, style=plot.style_line, title="Bear Stop") 
plot(bearPositionOpen ? bearTPLevel : na, color=color.blue, style=plot.style_line, title="Bear TP")

// Entry Alerts
alertcondition(longEntryTriggered, title='Long Entry Alert', message='{{ticker}} - LONG Entry at {{close}}')
alertcondition(shortEntryTriggered, title='Short Entry Alert', message='{{ticker}} - SHORT Entry at {{close}}')

// Exit Alerts
alertcondition(longExitTriggered, title='Long Exit Alert', message='{{ticker}} - LONG Exit at {{close}}')
alertcondition(shortExitTriggered, title='Short Exit Alert', message='{{ticker}} - SHORT Exit at {{close}}')

// Daily Close Alert
alertcondition(shouldClose, title='Daily Close Alert', message='{{ticker}} - Daily Close 1pm PT at {{close}}')

Overview

GrimmPaint 2.0 Alerts then tracks re-entry into that candle's range during up to three user-set time windows on weekdays, and derives a stop level from an earlier bar and a take profit at 4.6 times the risk. A daily close time is also tracked. It draws on the price chart.

Details

Published by

GreyssonEnterprises on GitHub

Code credit

allanster, as written in the script's header

Draws

On the price chart

Markets

Any symbol

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
Time 1session0700-0900time_1_session
Time 2session1000-1200time_2_session
Time 3sessiontime_3_session
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 plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds

Indicator v6 TrendSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Auto Trade Futures ES

Golden Bullet Strategy

by TradersPost
228 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
219 stars

This indicator plots reference levels for previous daily high and low prices directly on the price chart. It requests daily timeframe data using the security function and plots the offset values as continuous lines, displaying resistance in red and support in

Indicator v4 Support & resistanceSessions & time
Updated 5 years ago · None stated GitHub repository of 昨日高低點標示

Moon Dev GEX Arrows

by moondevonyt
92 stars

This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow

Indicator v5 Support & resistanceSessions & time
Updated 2 months ago · Custom licence GitHub repository of Moon Dev GEX Arrows

Key Levels

by cryptorife
75 stars

This indicator plots reference levels and session markers directly on the price chart. It calculates and draws lines for the daily open, weekly open, monthly open, previous day OHLC, and previous week extremes, along with a selectable day-of-week range and ini

Indicator v4 Support & resistanceSessions & time Repaints
Updated 3 years ago · GPL-3.0 GitHub repository of Key Levels

More Sessions & time scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers