Strategy · Pine Script v4 · On the chart

Setup 9.2 - Larry Willians

by rodrigo-brito

This strategy plots a 9-period exponential moving average and a 20-period simple moving average on the main price chart.

View on GitHub

GitHub stars9on the repository
Pine versionv4older, still runs
Lines of code53
Settings0inputs
LicenceMIT
Last update5 years ago28 Apr 2021

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

53 lines of Pine Script v4 from strategies/setup_9_2.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

setup_9_2.pine
//@version=4
strategy("Setup 9.2 - Larry Willians", overlay=true)

ema8 = ema(close, input(8))
ema9 = ema(close, input(9))
ema13 = sma(close, input(13))
ema54 = sma(close, input(54))
ema200 = sma(close, input(200))
sma20 = sma(close, input(20))

plot(ema9, color=color.red)
plot(sma20)

var INF = 9999999.9
var position = false
var active = false
var buy_price = INF
var stop_price = 0.0

if (ema9[0] < ema9[1] and active)
    buy_price := INF
    stop_price := 0.0
    active := false
    position := false

if (not position and close < low[1] and ema9[0] > ema9[1])
    buy_price := high[0]
    stop_price := low[0]
    active := true

if (position and low < stop_price)
    strategy.close("long", comment="stop")
    buy_price := INF
    stop_price := 0.0
    active := false
    position := false
    
if (position and close < sma20)
    strategy.close("long", comment="sma sell")
    buy_price := INF
    stop_price := 0.0
    active := false
    position := false

if (active and high > buy_price and ema9 > sma20)
    strategy.entry("long", strategy.long)
    stop_price := min(low[0], stop_price)
    position := true
    active := false
else
    if(active)
        buy_price := min(high[0], buy_price)
        stop_price := min(low[0], stop_price)

Overview

Setup 9.2 - Larry Willians executes long entries based on the Larry Williams 9.2 setup when price breaks above a trigger bar high while the 9 EMA is rising above the 20 SMA. Positions exit when price falls below the setup stop level or closes under the 20 SMA. Input settings configure lengths for multiple moving averages. The strategy operates long-only, provides no take-profit targets, and relies on custom bar exits without native order stop losses.

Details

Published by

rodrigo-brito on GitHub

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Trend, Moving averages, Breakout

Markets

Crypto

Timeframes

H4 and above

Risk Notes

  • The strategy enters trades without a stop loss
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

257 stars

This strategy plots running pivot highs as red R circles and pivot lows as blue S circles directly on the price chart. It computes an EMA 3 and a Cto trend line from close prices, then generates long signals on upward EMA-Cto crossovers combined with price pos

Strategy v6 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Best Chart 1m Strategy Candle Bar

12/26-IT Strategy

by hasnocool
106 stars

This strategy executes trades based on crossovers between a 12-period and a 26-period exponential moving average (EMA). Long positions can be filtered by pivot resistance breakouts and RSI boundary ranges. For trade management, it provides two configurable par

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 12/26-IT Strategy

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of 均线突破交易系统
43 stars

This strategy executes trades on short-term cryptocurrency charts using a combination of pivot support and resistance levels and a multi-pole smoothed trend filter. Entries trigger when price crosses the smoothed trend line and confirms above or below a short-

Strategy v5 TrendBreakout Repaints
Updated 2 years ago · None stated GitHub repository of SOL 1m - Strategy Candle Bar

ADA4H Optuna Strategy

by skywalker0803r
42 stars

This strategy trades longs and shorts on the price chart. Long entries require a close above the prior Donchian high, a close above a long-term SMA, and RSI above a threshold, with size set as a percentage of equity. Long exits use a stop at the prior Donchian

Strategy v5 TrendOscillators & momentum
Updated 2 months ago · None stated GitHub repository of ADA4H Optuna Strategy
16 stars

This strategy plots Donchian channels, trailing stops, and profit targets directly on the price chart. It enters breakout trades using a 55-bar Donchian channel and sizes positions according to an ATR-based risk percentage per unit. The system adds units as pr

Strategy v6 TrendBreakout
Updated 11 months ago · None stated GitHub repository of Seykota Alt 10: Profit Targets

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