Indicator · Pine Script v5 · On the chart

Impulse

by DaniilOkrug· code credited to GoldRat

Impulse marks the start of a two-candle bullish or bearish push on the price chart when the second candle stays beyond a Fibonacci fraction of the first candle's range.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code62
Settings2inputs
LicenceMIT
Last update4 years ago15 Dec 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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

62 lines of Pine Script v5 from [Order] Impulse.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

[Order] Impulse.txt
// © GoldRat
//@version=5
indicator("[Order] Impulse", overlay=true)

Fibo = input.float(0.5, "Fibo", minval=0.0, maxval=1.0, step=0.01)
Percent = input.float(2.0, "Percent", minval=0.0, maxval=100.0, step=0.01)

var bool Up = false
var bool Dn = false
var float StartUp = 0
var float EndUp = 0
var float StartDn = 0
var float EndDn = 0
int Signal = 0

// Crossed 50% fibo
if Up and low[1] <= StartUp + (EndUp - StartUp) * Fibo
    Up := false
if Dn and high[1] >= StartDn - (StartDn - EndDn) * Fibo
    Dn := false

// Impulse start
impulseUp_startCondition = not Up and close[1] > open[1] and close[2] > open[2] and low[1] > low[2] + ((high[2] - low[2]) * Fibo)

if impulseUp_startCondition
    // Up
    StartUp := low[2]
    EndUp := high[1] > high[2] ? high[1] : high[2]
    Up := true

plotshape(impulseUp_startCondition, style=shape.circle, color=color.green,  offset=-2)

impulseDown_startCondition = not Dn and close[1] < open[1] and close[2] < open[2] and high[1] < high[2] - ((high[2] - low[2]) * Fibo)

if impulseDown_startCondition
    // Down
    StartDn := high[2]
    EndDn := low[1] < low[2] ? low[1] : low[2]
    Dn := true

plotshape(impulseDown_startCondition, style=shape.circle, color=color.red, location=location.belowbar, offset=-2)

// Impulse end    
if Up and high[1] > EndUp    
    // Up
    EndUp := high[1]
if Dn and low[1] < EndDn    
    // Down
    EndDn := low[1]

// Signal
if barstate.isnew and Signal != 0
    Signal := 0
if Signal == 0 
    if Up and (EndUp - StartUp) >= StartUp * Percent / 100.0
        Signal := 1
        Up := false
    if Dn and (StartDn - EndDn) >= StartDn * Percent / 100.0
        Signal := -1
        Dn := false

plotarrow(Signal, maxheight=20)

Overview

Impulse tracks each move's high and low, cancels the setup if price crosses back through the chosen Fibonacci level, and draws an up or down arrow once the impulse covers the Percent threshold of the start price. Fibo sets that fraction and Percent sets the minimum size. There are no trade entries or exits.

Details

Published by

DaniilOkrug on GitHub

Code credit

GoldRat, as written in the script's header

Draws

On the price chart

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.

Settings

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

SettingTypeDefaultVariable
Fibofloat0.5Fibo
Percentfloat2.0Percent
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

[RS]MTF Candle Sticks

by ricardosantos79
261 stars

This indicator overlays up to five higher-timeframe candlestick groups on the price chart. For each enabled timeframe it requests open, high, low, and close and can show up to five candles, offset by a spacing setting. The main inputs set the candle count, the

Indicator v4 Candlestick patternsSupport & resistance Repaints
Updated 4 years ago · None stated GitHub repository of [RS]MTF Candle Sticks

Candlestick Patterns

by harryguiacorn
220 stars

This indicator plots optional candlestick pattern signals on the price chart. It detects engulfing bars, inside bars, HOLP and LOHP, kicker patterns, body-mass extremes, higher highs and lower lows, ATR warnings, and four-bar fractals. Optional pivot marks use

Indicator v5 Candlestick patternsVolatility & bands
Updated 1 year ago · None stated GitHub repository of Candlestick Patterns

Strat Assistant

by rickyzcarroll
90 stars

The Strat Assistant indicator identifies candlestick patterns from the STRAT methodology on the price chart. It detects inside bars, 2-candle directional bars, 3-candle outside bars, and sequences like 212 and 222 for continuations and reversals. Shapes such a

Indicator v4 Candlestick patternsSupport & resistance
Updated 5 years ago · None stated GitHub repository of Strat Assistant
56 stars

This overlay indicator highlights candles with a body smaller than 50% of their total range by coloring them white on the price chart. Simultaneously, it calculates and plots horizontal lines for open prices across multiple higher timeframes, such as daily, we

Indicator v6 Support & resistanceCandlestick patterns Repaints
Updated 2 months ago · None stated GitHub repository of Daily Weekly Monthly Yearly Opens

This Pine Script indicator identifies liquidity sweeps and confirms signals using a close-back candle pattern directly on the price chart. It tracks recent swing highs and lows over a customizable lookback period. A bullish signal forms when a prior bar sweeps

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Liquidity Sweep + Close-Back Confirmation

8020 System Indicator

by TamaraKGreen
46 stars

This overlay indicator draws 80/20 price levels and optional 40-point zone bands on the price chart. It marks repairs, cross sections, and forks with optional letter labels, and can highlight confluence when those marks sit near a level. Separate options shade

Indicator v6 Support & resistanceCandlestick patterns
Updated 8 weeks ago · None stated GitHub repository of 8020 System Indicator

More Candlestick patterns scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers