OPEN-SOURCE SCRIPT

EMA Cross 99

23
//version=6
indicator("EMA Strategie (Indikator mit Entry/TP/SL)", overlay=true, max_lines_count=500, max_labels_count=500)

// === Inputs ===
rrRatio = input.float(3.0, "Risk:Reward (TP/SL)", minval=1.0, step=0.5)
sess = input.session("0700-1900", "Trading Session (lokal)")

// === EMAs ===
ema9 = ta.ema(close, 9)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)

// === Session ===
inSession = not na(time(timeframe.period, sess))

// === Trend + Cross ===
bullTrend = (ema9 > ema200) and (ema50 > ema200)
bearTrend = (ema9 < ema200) and (ema50 < ema200)

crossUp = ta.crossover(ema9, ema50)
crossDown = ta.crossunder(ema9, ema50)

// === Pullback Confirm ===
longTouch = bullTrend and crossUp and (low <= ema9)
longConfirm = longTouch and (close > open) and (close > ema9)

shortTouch = bearTrend and crossDown and (high >= ema9)
shortConfirm = shortTouch and (close < open) and (close < ema9)

// === Entry Signale ===
longEntry = longConfirm and inSession
shortEntry = shortConfirm and inSession

// === SL & TP Berechnung ===
longSL = ema50
longTP = close + (close - longSL) * rrRatio
shortSL = ema50
shortTP = close - (shortSL - close) * rrRatio

// === Long Markierungen ===
if (longEntry)
// Entry
line.new(bar_index, close, bar_index+20, close, color=color.green, style=line.style_dotted, width=2)
label.new(bar_index, close, "Entry", style=label.style_label_left, color=color.green, textcolor=color.white, size=size.tiny)
// TP
line.new(bar_index, longTP, bar_index+20, longTP, color=color.green, style=line.style_solid, width=2)
label.new(bar_index, longTP, "TP", style=label.style_label_left, color=color.green, textcolor=color.white, size=size.tiny)
// SL
line.new(bar_index, longSL, bar_index+20, longSL, color=color.red, style=line.style_solid, width=2)
label.new(bar_index, longSL, "SL", style=label.style_label_left, color=color.red, textcolor=color.white, size=size.tiny)

// === Short Markierungen ===
if (shortEntry)
// Entry
line.new(bar_index, close, bar_index+20, close, color=color.red, style=line.style_dotted, width=2)
label.new(bar_index, close, "Entry", style=label.style_label_left, color=color.red, textcolor=color.white, size=size.tiny)
// TP
line.new(bar_index, shortTP, bar_index+20, shortTP, color=color.red, style=line.style_solid, width=2)
label.new(bar_index, shortTP, "TP", style=label.style_label_left, color=color.red, textcolor=color.white, size=size.tiny)
// SL
line.new(bar_index, shortSL, bar_index+20, shortSL, color=color.green, style=line.style_solid, width=2)
label.new(bar_index, shortSL, "SL", style=label.style_label_left, color=color.green, textcolor=color.white, size=size.tiny)

// === EMAs anzeigen ===
plot(ema9, "EMA 9", color=color.yellow, linewidth=1)
plot(ema50, "EMA 50", color=color.orange, linewidth=1)
plot(ema200, "EMA 200", color=color.blue, linewidth=1)

// === Alerts ===
alertcondition(longEntry, title="Long Entry", message="EMA Strategie: LONG Einstiegssignal")
alertcondition(shortEntry, title="Short Entry", message="EMA Strategie: SHORT Einstiegssignal")

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.