Strategy · Pine Script v5 · On the chart

Impulse-Orders

by DaniilOkrug· code credited to GoldRat

The Impulse-Orders strategy detects impulse up and down movements on the price chart by checking for specific candle patterns relative to Fibonacci retracement levels.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code68
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 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

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

[Order] Impulse-Orders.txt
// © GoldRat
//@version=5
strategy("[Order] Impulse-Orders", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=1, pyramiding=100)

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
        message = '"type":"long", "minPrice":"' + str.tostring(StartUp) + '","maxPrice":"' + str.tostring(high[1]) + '"'
        
        strategy.entry('Long Impulse', strategy.long, alert_message=message)
        Signal := 1
        Up := false
    if Dn and (StartDn - EndDn) >= StartDn * Percent / 100.0
        
        message = '"type":"short", "minPrice":"' + str.tostring(low[1]) + '","maxPrice":"' + str.tostring(StartDn) + '"'
        strategy.entry('Short Impulse', strategy.short, alert_message=message)
        Signal := -1
        Dn := false

plotarrow(Signal, maxheight=20)

Overview

Impulse-Orders tracks impulse starts and ends, confirming when the move reaches a user-defined percentage of the starting price. Upon fulfillment, it enters long or short positions with alert messages detailing the order type, min, and max prices. The strategy uses dynamic Fibonacci calculations and signals entries on the chart via plot arrows. It supports high pyramiding and percent equity sizing without a default stop loss.

Details

Published by

DaniilOkrug on GitHub

Code credit

GoldRat, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns, Support & resistance, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy can add several entries in the same direction
  • 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
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

This strategy plots dual moving average clouds and a long-term trend filter directly on the price chart alongside Heikin Ashi data. It triggers long and short entry signals using moving average alignments and pivot trendline levels, with optional filtering via

Strategy v5 TrendMoving averages
Updated 5 months ago · None stated GitHub repository of Heikin Ashi with Pivot Trendlines Strategy

This trend-following strategy executes a classic Donchian channel breakout system designed to cross-validate backtest results against external framework benchmarks. It triggers a long entry when the closing price breaks above the highest high of the prior entr

Strategy v6 BreakoutTrend
Updated today · AGPL-3.0 GitHub repository of Forven S01509 - Simple Donchian 20/10 Breakout

Omar Edited WF

by Alorse
330 stars

Omar Edited WF is a trading strategy overlay built around Williams Fractals and multiple Exponential Moving Averages. It detects high and low fractal pivot points over configurable lookback periods alongside three adjustable EMA trendlines. Long entries are ma

Strategy v5 TrendMoving averages
Updated 2 months ago · None stated GitHub repository of Omar Edited WF
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy
257 stars

This strategy calculates dynamic support and resistance levels using pivot highs and lows alongside a custom smoothed trend filter and a 3-period EMA. It identifies entry opportunities when price breaks out relative to the trend filter and short-term EMA cross

Strategy v5 TrendSupport & resistance Repaints
Updated 6 weeks ago · None stated GitHub repository of 30s - ES 1m Strategy Candle Bar

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