Strategy · Pine Script v5 · On the chart

Session Wicks

by g-moe· code credited to goodgains

This strategy calculates smoothed Heikin-Ashi candles alongside a moving average of the Relative Strength Index to enter trend reversals.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code99
Settings11inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 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 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

99 lines of Pine Script v5 from Tradingview/session-wicks-v2.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

session-wicks-v2.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
strategy("Session Wicks", overlay = true)

// @keywords: session-wicks, smoothed-heikin-ashi, rsi-filter, strategy-long, strategy-short, rsi-crossover, ha-smoothing, trading-hours, trend-reversal, rsi-exit, long-entry, short-entry, dual-ema-ha, momentum-filter, session-strategy, wick-trading, ha-bull-bear, rsi-ma, strategy-exits, time-filter

//RSI
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="RSI Settings")
maLengthInput = input.int(14, title="MA Length", group="RSI Settings")


ma(source, length, type) =>
    switch type
        "SMA" => ta.sma(source, length)
        "EMA" => ta.ema(source, length)
        "SMMA (RMA)" => ta.rma(source, length)
        "WMA" => ta.wma(source, length)
        "VWMA" => ta.vwma(source, length)


up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)

rsi_long = rsi > rsiMA
rsi_short = rsi < rsiMA


//SMOOTHED HA

ha_smooth1 = input.int(10, title = 'Smoothed HA Length 1', group = 'Smoothed HA Settings')
ha_smooth2 = input.int(10, title = 'Smoothed HA Length 2', group = 'Smoothed HA Settings')

o = ta.ema(open,ha_smooth1)
c = ta.ema(close,ha_smooth1)
h = ta.ema(high,ha_smooth1)
l = ta.ema(low,ha_smooth1)

haclose = (o+h+l+c)/4
var float haopen = 0.00
haopen := na(haopen[1]) ? (o + c)/2 : (haopen[1] + haclose[1]) / 2
hahigh = math.max(h, math.max(haopen,haclose))
halow = math.min(l, math.min(haopen,haclose))

o2 = ta.ema(haopen, ha_smooth2)
c2 = ta.ema(haclose, ha_smooth2)
h2 = ta.ema(hahigh, ha_smooth2)
l2 = ta.ema(halow, ha_smooth2)


smoothedha_bull = c2 > o2
smoothedha_bear = o2 > c2



///////////////////////
/////CREATE SIGNALS////
///////////////////////
strategy_start = input.time(timestamp("01 January 2020 00:00:00 UTC-5"), "Strategy Start Date", group = "Strategy Settings", inline = '1')
use_trading_hours = input.bool(false, title = "Use Trading Hours", tooltip = "This is ignored if the chart timeframe is greater than or equal to the daily timeframe.", group = "Strategy Settings", inline = '2')
trading_time = input.session("0930-1600", title = " ", tooltip = "This uses Eastern Time Zone or U.S. NY Market Hours.", group = "Strategy Settings", inline = '2')
trading_hours_cond = not use_trading_hours or time("",trading_time, "America/New_York")

long_trades = input.bool(true, title = "Long Trades", tooltip = "Do we want to take long trades?" , group = "Strategy Settings", inline = '3')
short_trades = input.bool(true, title = "Short Trades", tooltip = "Do we want to take short trades?" , group = "Strategy Settings", inline = '4')

long_entry = long_trades and trading_hours_cond and rsi_long and smoothedha_bull and (smoothedha_bear[1] or smoothedha_bear[2])
long_exit = long_trades and (ta.crossover(rsi, 70) or smoothedha_bear)

short_entry = short_trades and trading_hours_cond and rsi_short and smoothedha_bear  and (smoothedha_bull[1] or smoothedha_bull[2])
short_exit = short_trades and (ta.crossunder(rsi, 30) or smoothedha_bull) 

past_strategy_start_date = time >= strategy_start ? true : false


//ORDERS
if past_strategy_start_date


    //ENTRIES
    if long_entry
        strategy.entry("LE", direction = strategy.long)   
    else if short_entry
        strategy.entry("SS_E", direction = strategy.short)   
    
    //EXITS
    if long_exit
        strategy.close("LE", comment = "LX")
    else if short_exit
        strategy.close("SS_E", comment = "SS_X")
        
    if not trading_hours_cond
        strategy.close_all(comment = "TX", immediately = true)

Overview

Session Wicks triggers long entries when smoothed Heikin-Ashi turns bullish while RSI trades above its moving average, and short entries on bearish flips below the RSI average. Exits occur when RSI crosses overbought or oversold thresholds, or when the Heikin-Ashi direction reverses. Key inputs configure smoothing lengths, RSI parameters, and an optional intraday session window. It executes on the price chart without a default stop loss.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

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

Markets

Any symbol

Timeframes

M15-H1

Risk Notes

  • The strategy enters trades without a stop loss

Settings

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

SettingTypeDefaultVariable
RSI Lengthint14rsiLengthInput
SourcesourceclosersiSourceInput
MA TypestringSMAmaTypeInput
MA Lengthint14maLengthInput
Smoothed HA Length 1int10ha_smooth1
Smoothed HA Length 2int10ha_smooth2
Strategy Start Datetimetimestamp("01 January 2020 00:00:00 UTC-5")strategy_start
Use Trading Hoursboolfalseuse_trading_hours
session0930-1600trading_time
Long Tradesbooltruelong_trades
Short Tradesbooltrueshort_trades
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
4 stars

This strategy calculates fast and slow exponential moving averages, the Relative Strength Index, and the Average True Range directly on the price chart. It enters long positions when the fast EMA crosses above the slow EMA with RSI above the minimum threshold

Strategy v6 TrendMoving averages
Updated 2 months ago · MIT GitHub repository of NQ Nasdaq Strategy [trugurpala]
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