Strategy · Pine Script v6 · On the chart

Symbol Equity RTH + Overnight Gaps AAPL

by pineforge-4pass· code credited to PineForge contributors 2026

This strategy evaluates intraday trading execution for US equities during regular trading hours while handling overnight gaps.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code34
Settings0inputs
LicenceApache-2.0
Last update5 days ago23 Oct 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

34 lines of Pine Script v6 from special-validation/us-equity/symbol-equity-rth-gaps-aapl-01/strategy.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strategy.pine
// This Pine Script® code is licensed under Apache-2.0
// SPDX-License-Identifier: Apache-2.0
// © PineForge contributors 2026
//
// Isolates: US-equity regular-trading-hours (RTH) session gating combined with
// overnight gap handling on a 5m intraday feed. Plain RSI(14) oversold/overbought
// crosses (30/70) drive entries, but every order is gated by session.ismarket so
// only bars inside NYSE/NASDAQ regular hours (09:30–16:00 ET) can trade. This
// exercises the exchange-tz (America/New_York) vs chart-tz day boundary, the RTH
// session filter, and how the engine treats the overnight gap between the prior
// 16:00 close and the next 09:30 open (RSI series continuity across the gap).

//@version=6
strategy("Symbol equity RTH + overnight gaps AAPL", overlay=true,
     initial_capital=1000000, currency=currency.USD,
     commission_type=strategy.commission.percent, commission_value=0,
     slippage=0, default_qty_type=strategy.fixed, default_qty_value=1,
     pyramiding=1, process_orders_on_close=false)

// RSI(14) on close — series spans the overnight gap continuously (no per-day
// reset), so the cross can latch on the first RTH bar after the gap.
rsiVal = ta.rsi(close, 14)

// Only act on bars inside regular trading hours. session.ismarket is backed by
// syminfo.session, injected by the harness via runtime_overrides.session =
// "0930-1600" with timezone America/New_York.
inRth = session.ismarket

// Oversold cross up 30 → long; overbought cross down 70 → flat. Gated by RTH.
if inRth and ta.crossover(rsiVal, 30)
    strategy.entry("Long", strategy.long)

if inRth and ta.crossunder(rsiVal, 70)
    strategy.close("Long")

Overview

Symbol Equity RTH + Overnight Gaps AAPL calculates a 14-period Relative Strength Index (RSI) across price history without daily resets. Trades are gated by the market session filter, entering long positions when RSI crosses above 30 during regular market hours and closing positions when RSI falls below 70 during regular market hours. Plotted directly on the price chart, it lacks hard stop loss or take profit mechanisms.

Details

Published by

pineforge-4pass on GitHub

Code credit

PineForge contributors 2026, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Oscillators & momentum, Sessions & time

Markets

Stocks

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Topics

algorithmic-tradingbacktestingparitypine-scriptpinescriptquantitative-financetest-corpustradingview

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

ARR VWAP Intraday

by hasnocool
106 stars

This strategy plots VWAP on the price chart and trades only between a start hour and an end hour. It enters long when VWAP is rising and RSI is above a threshold, and short when VWAP is falling and RSI is below a threshold. If the reversal option is on, it clo

Strategy v4 Oscillators & momentumVolume Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of ARR VWAP Intraday
53 stars

This strategy enters long or short on the price chart when price is on the correct side of a 200-period EMA, MACD agrees, RSI is not at the opposing extreme, ADX exceeds a threshold, volume beats a 20-bar average, and close breaks the recent high or low. A tim

Strategy v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of BTCUSD 5M Optimized Strategy
43 stars

Donald - AI Futures is a price-chart strategy that estimates inner and outer high-low zones and a smoothed close with rational quadratic kernel regression. It builds bullish and bearish momentum signals, optionally compares volume with a volume-weighted moving

Strategy v5 Oscillators & momentumSMC / ICT / price action Repaints
Updated 2 years ago · None stated GitHub repository of Donald - AI Futures

Turtle MACD Time-Zone Filter

by skywalker0803r
42 stars

This strategy enters long when price closes above the prior Donchian high and short when it closes below the prior Donchian low, only while flat and inside a Taipei-hour window. It exits on a MACD histogram reversal or through an ATR stop and a percentage take

Strategy v5 BreakoutOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Turtle MACD Time-Zone Filter

Morning Scalp

by benso87
24 stars

This strategy tracks an opening session time range to establish directional bias and triggers pullback trades using Stochastic RSI. Once price breaks out of the initial range, it establishes a directional bias and enters when the Stochastic RSI crosses over in

Strategy v5 Sessions & timeBreakout
Updated 4 years ago · MPL-2.0 GitHub repository of Morning Scalp

XAUUSD SMC Bot

by GifariKemal
15 stars

This strategy plots on the XAUUSD price chart and looks for Smart Money Concepts entries on the fifteen-minute timeframe. It scores fair value gaps, order blocks, liquidity sweeps, break of structure, and change of character, plus EMA, RSI, MACD, and higher-ti

Strategy v5 SMC / ICT / price actionOscillators & momentum
Updated 8 months ago · None stated GitHub repository of XAUUSD SMC Bot

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