Indicator · Pine Script v6 · On the chart

Breakout Strategie + MA Labels + Stops

by NinjaEde

This indicator detects breakout signals on the price chart when volume exceeds a threshold, a gap appears, or a strong candle forms, combined with an upward MA50 trend.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code101
Settings8inputs
LicenceMIT
Last update10 months ago24 Dec 2025

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

101 lines of Pine Script v6 from breakout-indicator-MA50-MA100-MA150-MA200.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

breakout-indicator-MA50-MA100-MA150-MA200.pine
//@version=6
indicator("Breakout Strategie + MA Labels + Stops", overlay=true)

// === Einstellungen === //
ma10 = ta.sma(close, 10)
ma50 = ta.sma(close, 50)
ma150 = ta.sma(close, 150)
ma200 = ta.sma(close, 200)

// Breakout-Parameter
volMultiplier = input.float(1.5, title="Volumen Multiplikator für Breakout", minval=0.5)
gap_required = input.bool(false, title="Gap erforderlich für Breakout?")
strongCandle_required = input.bool(false, title="Starke Kerze erforderlich für Breakout?")
breakout_candle_mode = input.int(2, title="Breakout Candle Modus (1=Streng, 2=Locker)", options=[1,2])

// Stop-Loss und Take-Profit
use_stoploss = input.bool(true, title="Stop-Loss verwenden?")
stoploss_perc = input.float(3.0, title="Stop-Loss %", minval=0.1)
use_takeprofit = input.bool(true, title="Take-Profit verwenden?")
takeprofit_perc = input.float(6.0, title="Take-Profit %", minval=0.1)

// === Breakout Logik === //

// Volumenbedingungen über 3 Kerzen
avgVol = ta.sma(volume, 20)
volBreak = (volume > avgVol * volMultiplier) or (volume[1] > avgVol * volMultiplier) or (volume[2] > avgVol * volMultiplier)

// Gap Bedingung
gap = open > high[1]

// Starke Kerze
body = math.abs(close - open)
candleSize = high - low
strongCandle = (close > open) and (body > candleSize * 0.5)

// Breakout Candle Modus
var bool candleOK = false
if breakout_candle_mode == 1
    candleOK := (close > open) and (body > candleSize * 0.5)
else
    candleOK := (close > open)

// MA Trend (MA50 aufwärts)
maTrend = ma50 > ma50[1]

// Breakout Condition final
isBreakout = volBreak and (close > ma50) and maTrend and candleOK
if gap_required
    isBreakout := isBreakout and gap
if strongCandle_required
    isBreakout := isBreakout and strongCandle

// === Entry / Exit === //
var bool inPosition = false
var float entryPrice = na
var float stopPrice = na
var float targetPrice = na

if isBreakout and not inPosition
    inPosition := true
    entryPrice := close
    stopPrice := use_stoploss ? close * (1 - stoploss_perc/100) : na
    targetPrice := use_takeprofit ? close * (1 + takeprofit_perc/100) : na
    // Breakout-Label anzeigen
    label.new(bar_index, low, "Breakout", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)

if inPosition
    stopHit = use_stoploss and close <= stopPrice
    targetHit = use_takeprofit and close >= targetPrice
    if stopHit or targetHit
        inPosition := false
        label.new(bar_index, close, "Exit", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
        stopPrice := na
        targetPrice := na
        entryPrice := na

// === Hintergrundfarbe bei aktivem Trade === //
bgcolor(inPosition ? color.new(color.green, 90) : na)

// === Stop-Markierung === //
stopLine = (inPosition and use_stoploss) ? stopPrice : na
plot(stopLine, style=plot.style_cross, color=color.red, linewidth=2, title="Stop-Loss")

// === Moving Averages Plot === //
plot(ma10, color=color.blue, title="MA10")
plot(ma50, color=color.orange, title="MA50")
plot(ma150, color=color.green, title="MA150")
plot(ma200, color=color.red, title="MA200")

// === Labels für Trendwechsel === //
var bool wasAbove10 = close[1] > ma10
var bool wasAbove50 = close[1] > ma50

if (close > ma10 and not wasAbove10)
    label.new(bar_index, high, "Über MA10", style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.small)

if (close > ma50 and not wasAbove50)
    label.new(bar_index, high, "Über MA50", style=label.style_label_up, color=color.teal, textcolor=color.white, size=size.small)

wasAbove10 := close > ma10
wasAbove50 := close > ma50

Overview

Breakout Strategie + MA Labels + Stops plots MA10, MA50, MA150 and MA200 for reference and places entry and exit labels directly on the chart. When a breakout occurs it enters a position and draws a stop-loss line at a configurable percentage below entry price along with a take-profit line above it. Settings control volume multiplier, gap and strong candle requirements, candle mode, stop-loss and take-profit percentages. The indicator draws all graphics on the price chart with no additional panes.

Details

Published by

NinjaEde on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Breakout, Moving averages, Volume

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
Volumen Multiplikator für Breakoutfloat1.5volMultiplier
Gap erforderlich für Breakout?boolfalsegap_required
Starke Kerze erforderlich für Breakout?boolfalsestrongCandle_required
Breakout Candle Modus (1=Streng, 2=Locker)int2breakout_candle_mode
Stop-Loss verwenden?booltrueuse_stoploss
Stop-Loss %float3.0stoploss_perc
Take-Profit verwenden?booltrueuse_takeprofit
Take-Profit %float6.0takeprofit_perc
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

5000x Breakout Scanner

by jmragsdale
8 stars

This indicator marks momentum breakouts on the price chart. A signal appears only when the bar makes a new high over the lookback, volume is at least a chosen multiple of the 20-bar average, the percentage change from the prior close meets a minimum, the close

Indicator v5 BreakoutVolume
Updated 7 weeks ago · None stated GitHub repository of 5000x Breakout Scanner
3 stars

CSW Breakout Signals plots breakout buy and sell labels on the price chart when price breaks support or resistance after a trend change. Each signal can show a numbered confirmation score built from a moving-average cross, momentum, opening-range alignment, re

Indicator v5 BreakoutTrend
Updated 5 months ago · None stated GitHub repository of CSW Breakout Signals
2 stars

This overlay indicator demonstrates TradingView alert configuration. It plots 20- and 50-period simple moving averages and creates alert conditions when price crosses the shorter average or the averages cross each other. It also alerts on RSI crossing 70 or 30

Indicator v6 Moving averagesOscillators & momentum
Updated 2 months ago · MIT GitHub repository of Alert Configuration Examples

HTF / Power Play Levels

by mirkothepirko
2 stars

This indicator detects High Tight Flag (HTF) and Power Play chart patterns on the price chart. It measures pole gain, flag consolidation duration, and depth, while checking for volume dry-up and moving average trend alignment. When a pattern qualifies, it plot

Indicator v6 BreakoutSupport & resistance
Updated 3 months ago · Custom licence GitHub repository of HTF / Power Play Levels

Volume Price Indicator

by fuyuanyuan
1 stars

This indicator plots colored volume bars on the price chart, where green shows price up days and red shows price down days. It also draws an EMA of volume in yellow. The script detects bullish and bearish divergences by comparing price highs/lows to volume hig

Indicator v6 VolumeMoving averages
Updated 1 year ago · None stated GitHub repository of Volume Price Indicator

Calculates an Elastic Volume Weighted Moving Average (EVWMA), incorporating trading volume to dynamically adjust moving average responsiveness over a specified lookback length. It plots directly on the price chart as a single moving average line. Optional colo

Indicator v4 Moving averagesVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Elastic Volume Weighted Moving Average

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers