Strategy · Pine Script v6 · On the chart

NQ Nasdaq Strategy [trugurpala]

by trugurpala

This strategy calculates fast and slow exponential moving averages, the Relative Strength Index, and the Average True Range directly on the price chart.

View on GitHub

GitHub stars4on the repository
Pine versionv6current
Lines of code64
Settings8inputs
LicenceMIT
Last update2 months ago3 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 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

64 lines of Pine Script v6 from global-markets/02_nq_nasdaq.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

02_nq_nasdaq.pine
//@version=6
// E-mini Nasdaq-100 (NQ) / Micro E-mini (MNQ) Strategy
// github.com/trugurpala/pinescriptv6 — Author: Ugur Pala
//
// TR: Semboller: CME_MINI:NQ1! (tam) / CME_MICRO:MNQ1! (mikro)
// EN: Symbols:  CME_MINI:NQ1! (full) / CME_MICRO:MNQ1! (micro)
//
// Seans / Session: 09:30–16:00 ET
// Tick değeri / Tick value: NQ=$5/tick | MNQ=$0.50/tick
// Not: NQ volatilitesi ES'den ~2x yüksek — ATR çarpanlarını ayarla
// Note: NQ volatility is ~2x ES — adjust ATR multipliers accordingly
strategy("NQ Nasdaq Strategy [trugurpala]",
    overlay           = true,
    initial_capital   = 25000,
    default_qty_type  = strategy.fixed,
    default_qty_value = 1,
    commission_type   = strategy.commission.cash_per_contract,
    commission_value  = 4.0,
    slippage          = 1)

// ── Inputs ───────────────────────────────────────────────────────────────────
int   fastLen    = input.int(9,    "Fast EMA",  minval=1)
int   slowLen    = input.int(21,   "Slow EMA",  minval=1)
int   rsiLen     = input.int(14,   "RSI",       minval=1)
float rsiMin     = input.float(52, "RSI Min Long", minval=45, maxval=70)
float rsiMax     = input.float(48, "RSI Max Short",minval=30, maxval=55)
int   atrLen     = input.int(14,   "ATR",       minval=1)
float slMult     = input.float(2.0, "SL Mult",  step=0.1)
float tpMult     = input.float(3.5, "TP Mult",  step=0.1)

// ── Seans Filtresi ────────────────────────────────────────────────────────────
bool inRTH = not na(time(timeframe.period, "0930-1600", "America/New_York"))
bool rthEnd = inRTH[1] and not inRTH
if rthEnd
    strategy.close_all(comment="RTH End")

// ── Hesaplamalar ──────────────────────────────────────────────────────────────
float fastEma  = ta.ema(close, fastLen)
float slowEma  = ta.ema(close, slowLen)
float rsi      = ta.rsi(close, rsiLen)
float atrVal   = ta.atr(atrLen)

bool bullCross = ta.crossover(fastEma, slowEma) and rsi > rsiMin and inRTH
bool bearCross = ta.crossunder(fastEma, slowEma) and rsi < rsiMax and inRTH

// ── Entries ──────────────────────────────────────────────────────────────────
if bullCross
    strategy.entry("Long", strategy.long)
    strategy.exit("Long Exit", "Long",
        stop  = close - slMult * atrVal,
        limit = close + tpMult * atrVal)

if bearCross
    strategy.entry("Short", strategy.short)
    strategy.exit("Short Exit", "Short",
        stop  = close + slMult * atrVal,
        limit = close - tpMult * atrVal)

// ── Visuals ──────────────────────────────────────────────────────────────────
bgcolor(inRTH ? na : color.new(color.gray, 96))
plot(fastEma, "Fast", fastEma > slowEma ? color.green : color.red,    linewidth=2)
plot(slowEma, "Slow", fastEma > slowEma ? color.lime  : color.orange, linewidth=2)
plotshape(bullCross, "Long",  shape.triangleup,   location.belowbar, color.green)
plotshape(bearCross, "Short", shape.triangledown, location.abovebar, color.red)

Overview

NQ Nasdaq Strategy [trugurpala] enters long positions when the fast EMA crosses above the slow EMA with RSI above the minimum threshold during regular trading hours. Short positions enter on a bearish EMA cross when RSI is below the maximum threshold. Exits execute via ATR-scaled stop loss and take profit limit orders, or close at session end. Inputs configure indicator lengths, RSI filters, and bracket multipliers.

Details

Published by

trugurpala on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Moving averages, Oscillators & momentum, Sessions & time

Markets

Indices

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.

Topics

aialgorithmic-tradingclaude-codecodexcoding-agentsgithub-copilotopen-sourcepine-scriptpine-script-v6technical-analysis

Settings

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

SettingTypeDefaultVariable
Fast EMAint9fastLen
Slow EMAint21slowLen
RSIint14rsiLen
RSI Min Longfloat52rsiMin
RSI Max Shortfloat48rsiMax
ATRint14atrLen
SL Multfloat2.0slMult
TP Multfloat3.5tpMult
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 intraday strategy enters positions based on an alignment of trend, momentum, and oscillator indicators. It triggers long entries when the Commodity Channel Index is above a positive threshold, a fast Relative Strength Index crosses above a slow RSI, price

Strategy v5 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of CCI + EMA with RSI Cross Strategy

Session Wicks

by g-moe
3 stars

This strategy calculates smoothed Heikin-Ashi candles alongside a moving average of the Relative Strength Index to enter trend reversals. It triggers long entries when smoothed Heikin-Ashi turns bullish while RSI trades above its moving average, and short entr

Strategy v5 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Session Wicks
1 stars

This session-based strategy triggers long entries at the start of the New York trading session when trend and momentum conditions align. It calculates a 38-period Exponential Moving Average and a 14-period RSI. A long position is taken at session open if the c

Strategy v6 Sessions & timeTrend
Updated 5 days ago · Apache-2.0 GitHub repository of PineForge — Borough New York Session
1 stars

This intraday trading strategy combines fast, slow, and trend exponential moving averages with MACD, RSI, and ADX filters to generate trade signals during active trading sessions. It enters long positions when the fast EMA crosses above the slow EMA above the

Strategy v6 TrendOscillators & momentum
Updated 5 months ago · None stated GitHub repository of Señales Intradía EMA + MACD v3
330 stars

2 EMA/SMA + RSI Strategy [Alorse] combines three configurable moving averages with a short-period Relative Strength Index filter. It plots fast, slow, and trend moving averages on the price chart. Long entries trigger when the fast moving average is above the

Strategy v4 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of 2 EMA/SMA + RSI Strategy [Alorse]

Acrypto - Weighted Strategy

by AlbertoCuadra
318 stars

This strategy plots on the price chart and opens long or short positions when a weighted score from MACD, Stochastic RSI, RSI, Supertrend and a moving-average crossover exceeds a user-set trigger. Each component has its own weight and candle delay. Entries can

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · Custom licence GitHub repository of Acrypto - Weighted Strategy

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