Strategy · Pine Script v6 · On the chart

Ivan Scherman Pattern - TP/SL

by Ahmed-GoCode· code credited to Ahmed - Quant-Edge Indicators

This strategy identifies long entry opportunities based on short-term price pullbacks below a major trend filter.

View on GitHub

GitHub stars53on the repository
Pine versionv6current
Lines of code30
Settings2inputs
LicenceMPL-2.0
Last update2 months ago17 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

30 lines of Pine Script v6 from Quant-Edge-Indicators/Trend & Breakout/Ivan Strategy.pinescript, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

Ivan Strategy.pinescript
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ahmed - Quant-Edge Indicators
//@version=6
strategy("Ivan Scherman Pattern - TP/SL", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// Moving Averages
maLong = ta.sma(close, 200)
maShort = ta.sma(close, 5)

// Step 1: Three consecutive lower closes under 200 SMA
cond1 = close[3] > close[2] and close[2] > close[1] and close[3] < maLong[3] and close[2] < maLong[2] and close[1] < maLong[1]

// Step 2: Current close above 5 SMA
cond2 = close > maShort

// Entry Condition
entryCondition = cond1 and cond2

// Execute Entry
if (entryCondition)
    strategy.entry("IvanBuy", strategy.long)

// Traditional Exit Parameters
takeProfitPoints = input.float(10.0, title="Take Profit (points)")
stopLossPoints = input.float(5.0, title="Stop Loss (points)")
strategy.exit("Exit", from_entry="IvanBuy", profit=takeProfitPoints, loss=stopLossPoints)

// Plot Moving Averages
plot(maLong, color=color.orange, title="200 SMA")
plot(maShort, color=color.green, title="5 SMA")

Overview

Ivan Scherman Pattern - TP/SL enters long when three consecutive lower closes occur below the 200-period simple moving average, followed by the current bar closing back above the 5-period simple moving average. Trades are exited using fixed-point take profit and stop loss target settings. The strategy plots both the 200 SMA and 5 SMA directly on the price chart.

Details

Published by

Ahmed-GoCode on GitHub

Code credit

Ahmed - Quant-Edge Indicators, as written in the script's header

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Moving averages, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

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

fair-value-gapfibonaccimarket-structurepine-scriptrsi-strategysmart-money-conceptstechnical-analysistradingviewalgorithmic-tradingcrypto-trading

Settings

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

SettingTypeDefaultVariable
Take Profit (points)float10.0takeProfitPoints
Stop Loss (points)float5.0stopLossPoints
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

This mean-reversion strategy plots Bollinger Bands and a long-term moving average directly on the price chart. It enters trades when price candles penetrate the outer Bollinger Bands beyond a user-defined body percentage, anticipating a price reversal. Entries

Strategy v5 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner PRO [Alorse]

8 Day Run

by hasnocool
106 stars

Inspired by Linda Raschke's strategy for T-note futures, this script identifies extended trends where price remains on one side of a 5-period SMA for more than eight consecutive bars. It enters long on the first pullback below the SMA following an eight-bar bu

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 8 Day Run

Bollinger Bands Strategy

by cklose2000
105 stars

This strategy generates buy and sell signals based on Bollinger Band crossovers combined with a simple moving average trend filter. It enters a long position when price crosses above the lower band while trading above the SMA filter line, and enters a short po

Strategy v5 Volatility & bandsMoving averages
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Strategy
13 stars

This strategy evaluates market trend direction using a Noro TrendRibbon and creates a price corridor based on recent moving-average extremes, plotting directly on the price chart. It executes long entries when price dips below the corridor during an upward tre

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Noro TrendRibbon G004

VWAP Bounce - Eterna

by EternaHybridExchange
9 stars

This strategy overlays volume-weighted average price deviation bands and an exponential moving average trend filter directly on the price chart. It enters long positions during an uptrend when price recovers above the lower band, and enters short positions in

Strategy v5 Mean reversionTrend
Updated 7 months ago · MIT GitHub repository of VWAP Bounce - Eterna
7 stars

This long-only strategy identifies pullback opportunities within a broader trend. It enters a long position when the closing price trades above a long-term exponential moving average while falling below a short-term exponential moving average. Once in a trade,

Strategy v5 TrendMoving averages
Updated 1 year ago · MPL-2.0 GitHub repository of Pullback Strategy for Stocks

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