Indicator · Pine Script v6 · On the chart

Ede – MA + Breakout Strategie (Dynamic MAs)

by NinjaEde

This indicator plots multiple moving averages including SMA10, SMA50, SMA100, SMA200, Ichimoku conversion and lead lines, and 52-week high and low levels on the price chart.

View on GitHub

Repaints

GitHub stars2on the repository
Pine versionv6current
Lines of code156
Settings15inputs
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

156 lines of Pine Script v6 from breakout-exitMA10.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

breakout-exitMA10.pine
//@version=6
indicator("Ede – MA + Breakout Strategie (Dynamic MAs)", overlay=true, max_lines_count=500, max_labels_count=500)

// === Input Options MA & HL ===
msr                   = input.bool(false, "Ma10 (MSR)")
milo                  = input.bool(false, "Ma50 and Ichimoku (MILO)")
m3                    = input.bool(true,  "Ma50, Ma100, Ma200 (3M)")
w52                   = input.bool(false, "Line 52 Week High|Low")
ShowHL                = input.bool(false, "Line High|Low")

// === Input Options Breakout ===
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])

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)

// === Neue Input Options MA-Exit ===
exit_on_ma10          = input.bool(true,  title="Exit bei Unterschreiten MA10 aktivieren")
exit_on_ma50          = input.bool(false, title="Exit bei Unterschreiten MA50 aktivieren")

// === Calculate Moving Averages ===
sma10   = ta.sma(close, 10)
sma50   = ta.sma(close, 50)
sma100  = ta.sma(close, 100)
sma150  = ta.sma(close, 150)
sma200  = ta.sma(close, 200)

// === Precompute MA Crossunder Signals ===
ma10CrossUnder = ta.crossunder(close, sma10)
ma50CrossUnder = ta.crossunder(close, sma50)

// === Plot MAs ===
plot(msr  ? sma10  : na, title="MA10",  color=color.blue,   linewidth=2)
plot(milo or m3 ? sma50  : na, title="MA50",  color=color.orange, linewidth=2)
plot(m3   ? sma100 : na, title="MA100", color=color.green,  linewidth=2)
plot(m3   ? sma200 : na, title="MA200", color=color.red,    linewidth=2)

// === MSR Bar Highlight ===
msrbar = open < close and sma10 >= open and sma10 <= close and msr
barcolor(msrbar ? color.blue : na, show_last=3)

// === Ichimoku (MILO) ===
conversionPeriods     = 9
basePeriods           = 26
laggingSpan2Periods   = 52
displacement          = 26
donchian(len)         => (ta.lowest(len) + ta.highest(len)) / 2
conversionLine        = donchian(conversionPeriods)
baseLine              = donchian(basePeriods)
leadLine1             = (conversionLine + baseLine) / 2
leadLine2             = donchian(laggingSpan2Periods)
p1                    = plot(milo ? leadLine1 : na, offset=displacement, color=color.new(color.green, 0))
p2                    = plot(milo ? leadLine2 : na, offset=displacement, color=color.new(color.red,   0))
fill(p1, p2, color = leadLine1 > leadLine2 ? color.new(color.green, 85) : color.new(color.red, 85))

// === 52-Week High/Low ===
weekly_hh = request.security(syminfo.tickerid, "W", ta.highest(high, 52), lookahead=barmerge.lookahead_on)
weekly_ll = request.security(syminfo.tickerid, "W", ta.lowest(low,  52), lookahead=barmerge.lookahead_on)
plot(w52 ? weekly_hh : na, title="52W High", trackprice=true, color=color.green)
plot(w52 ? weekly_ll : na, title="52W Low",  trackprice=true, color=color.red)

// Dynamisches Management der 52W-Labels
var label highLabel = na
var label lowLabel  = na
if w52 and bar_index % 10 == 0
    if not na(highLabel)
        label.delete(highLabel)
    if not na(lowLabel)
        label.delete(lowLabel)
    highLabel := label.new(bar_index, weekly_hh, "52W High\n" + str.tostring(weekly_hh, format.mintick), style=label.style_label_down, color=color.green, textcolor=color.white, size=size.small)
    lowLabel := label.new(bar_index, weekly_ll,  "52W Low\n"  + str.tostring(weekly_ll,  format.mintick), style=label.style_label_up,   color=color.red,   textcolor=color.white, size=size.small)

// === High & Low (Recent) ===
window1 = 8
window2 = 21
top1 = ta.valuewhen(high >= ta.highest(high, window1), high, 0)
bot1 = ta.valuewhen(low  <= ta.lowest(low,  window1), low,  0)
top2 = ta.valuewhen(high >= ta.highest(high, window2), high, 0)
bot2 = ta.valuewhen(low  <= ta.lowest(low,  window2), low,  0)
plot(ShowHL ? top1 : na, color=color.red)
plot(ShowHL ? bot1 : na, color=color.green)
plot(ShowHL ? top2 : na, color=color.red)
plot(ShowHL ? bot2 : na, color=color.green)

// === Breakout Logik ===
avgVol     = ta.sma(volume, 20)
volBreak   = (volume > avgVol * volMultiplier) or (volume[1] > avgVol * volMultiplier) or (volume[2] > avgVol * volMultiplier)
gap        = open > high[1]
body       = math.abs(close - open)
candleSize = high - low
strongCandle = (close > open) and (body > candleSize * 0.5)
var bool candleOK = false
if breakout_candle_mode == 1
    candleOK := strongCandle
else
    candleOK := (close > open)
maTrend    = sma50 > sma50[1]
isBreakout = volBreak and (close > sma50) 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
// Labels für Breakout und Exit
var label breakoutLabel = na
var label exitLabel     = 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
    label.delete(breakoutLabel)
    breakoutLabel := label.new(bar_index, low, "Breakout", style=label.style_label_up, color=color.rgb(76, 175, 79, 70), textcolor=color.white, size=size.small)

if inPosition
    stopHit   = use_stoploss   and close <= stopPrice
    targetHit = use_takeprofit and close >= targetPrice
    // Neuer MA-Exit unter Verwendung vorab berechneter Werte
    ma10Exit  = exit_on_ma10 and ma10CrossUnder
    ma50Exit  = exit_on_ma50 and ma50CrossUnder
    maExitHit = ma10Exit or ma50Exit
    if stopHit or targetHit or maExitHit
        inPosition := false
        label.delete(exitLabel)
        exitLabel := label.new(bar_index, close, "Exit", style=label.style_label_lower_left, color=color.rgb(255, 82, 82, 70), textcolor=color.white, size=size.small)
        entryPrice  := na
        stopPrice   := na
        targetPrice := na

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

// === Stop-Loss Linie ===
stopLine = (inPosition and use_stoploss) ? stopPrice : na
plot(stopLine, style=plot.style_cross, color=color.rgb(203, 255, 82, 30), linewidth=2, title="Stop-Loss")

// === Trendwechsel-Labels ===
var bool wasAbove10 = close[1] > sma10
var bool wasAbove50 = close[1] > sma50
if close > sma10 and not wasAbove10
    label.new(bar_index, high, "Über MA10", style=label.style_label_up, color=color.rgb(33, 149, 243, 60), textcolor=color.white, size=size.small)
if close > sma50 and not wasAbove50
    label.new(bar_index, high, "Über MA50", style=label.style_label_up, color=color.rgb(0, 137, 123, 60), textcolor=color.white, size=size.small)
wasAbove10 := close > sma10
wasAbove50 := close > sma50

Overview

Ede – MA + Breakout Strategie (Dynamic MAs) detects breakouts using volume multiplier, optional gaps, and strong candle requirements. Signals can be filtered by breakout candle mode. Exit rules trigger when price crosses below SMA10 or SMA50. Main settings toggle which MAs to display and enable breakout filters, volume scaling, and stop loss or take profit levels. It draws all elements directly on the price chart. Notable limits include use of lookahead for 52-week levels.

Details

Published by

NinjaEde on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Breakout, Moving averages, Trend, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

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

SettingTypeDefaultVariable
Ma10 (MSR)boolfalsemsr
Ma50 and Ichimoku (MILO)boolfalsemilo
Ma50, Ma100, Ma200 (3M)booltruem3
Line 52 Week High|Lowboolfalsew52
Line High|LowboolfalseShowHL
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
Show all 15 settings
SettingTypeDefaultVariable
Take-Profit %float6.0takeprofit_perc
Exit bei Unterschreiten MA10 aktivierenbooltrueexit_on_ma10
Exit bei Unterschreiten MA50 aktivierenboolfalseexit_on_ma50
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

5 stars

Calculates short and long Exponential Moving Averages alongside pivot high and low levels to identify breakout signals. The indicator plots a 20 EMA and a 50 EMA on the main price chart. It evaluates trend direction based on EMA crossover alignment, checks for

Indicator v4 Moving averagesTrend
Updated 3 years ago · Apache-2.0 GitHub repository of 20 EMA + 50 EMA + Breakout
3 stars

The Krypton Indicator overlays trend analysis, buy and sell zones, and sentiment tracking directly onto the price chart. It calculates a dual moving average trend filter, renders supply and demand zones, and plots a sentiment line to identify market momentum.

Indicator v5 TrendSupport & resistance Repaints
Updated 5 months ago · None stated GitHub repository of Krypton Indicator
1 stars

US Swing Entry Planner plans swing trading entries on daily price charts using dual entry models: pullback limit buys near the fast EMA and breakout buy-stop orders above pivot highs. It calculates ATR-based stop loss and profit targets along with position siz

Indicator v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of US Swing Entry Planner

Sideway Zones Live

by dearvn
257 stars

Sideway Zones Live is an overlay indicator that estimates inner and outer sideways bands from recent highs and lows with a rational quadratic kernel. It tracks swing pivots over a loopback period and counts bars that remain between the outer high and low. Afte

Indicator v5 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of Sideway Zones Live

Ichimoku Cloud

by harryguiacorn
219 stars

This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts

Indicator v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ichimoku Cloud

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