getrennte schalter für blaue linie und textbox
This commit is contained in:
@@ -40,8 +40,15 @@ welle_rr = input.source(title="Welle (6) dunkelRot", defval=close, group="Lochst
|
|||||||
src1 = input.source(close, "Day OverBought 1", group="MSI")
|
src1 = input.source(close, "Day OverBought 1", group="MSI")
|
||||||
|
|
||||||
// ========= Darstellung =========
|
// ========= Darstellung =========
|
||||||
label_offset_mult = input.float(1.5, title="Label-Abstand (ATR x)", minval=0.1, step=0.1, group="Darstellung")
|
label_offset_mult = input.float(1.5, title="Label-Abstand (ATR x)", minval=0.1, step=0.1, group="Darstellung")
|
||||||
show_price_labels = input.bool(true, "Preis-Textboxen an Blues-Linien anzeigen (steuert auch die blauen Linien im Chart)", group="Darstellung")
|
show_price_textbox = input.bool(true, "Preis-Textboxen an Blues-Level anzeigen", group="Darstellung")
|
||||||
|
show_blues_lines = input.bool(true, "Blaue Pending-Linien im Chart anzeigen", group="Darstellung")
|
||||||
|
show_ps_wolke = input.bool(true, "Wolke Linie Pink auf Preisskala", group="Darstellung")
|
||||||
|
show_ps_bluel = input.bool(true, "Blues Long-Level auf Preisskala (nur aktiv)", group="Darstellung")
|
||||||
|
show_ps_blues = input.bool(true, "Blues Short-Level auf Preisskala (nur aktiv)", group="Darstellung")
|
||||||
|
col_ps_wolke = input.color(color.new(color.fuchsia, 0), "Farbe: Wolke Pink", group="Darstellung")
|
||||||
|
col_ps_bluel = input.color(color.new(color.blue, 0), "Farbe: Blues Long", group="Darstellung")
|
||||||
|
col_ps_blues = input.color(color.new(color.blue, 0), "Farbe: Blues Short", group="Darstellung")
|
||||||
|
|
||||||
// ========= Helper =========
|
// ========= Helper =========
|
||||||
asBool(src) => nz(src) > 0
|
asBool(src) => nz(src) > 0
|
||||||
@@ -146,6 +153,10 @@ var float short_refLow = na
|
|||||||
var label startLblShort = na
|
var label startLblShort = na
|
||||||
var line shortPendingLine = na
|
var line shortPendingLine = na
|
||||||
|
|
||||||
|
// --- Preis-Textboxen (Labels) ---
|
||||||
|
var label priceLblLong = na
|
||||||
|
var label priceLblShort = na
|
||||||
|
|
||||||
// --- Events (für Alerts) ---
|
// --- Events (für Alerts) ---
|
||||||
var bool ev_long_start = false
|
var bool ev_long_start = false
|
||||||
var bool ev_short_start = false
|
var bool ev_short_start = false
|
||||||
@@ -162,7 +173,7 @@ ev_short_break := false
|
|||||||
|
|
||||||
// --- Start Long ---
|
// --- Start Long ---
|
||||||
if long_start_ok and not long_pending_active
|
if long_start_ok and not long_pending_active
|
||||||
// Gegen-Zone beenden → es darf immer nur 1 Zone aktiv sein
|
// Gegen-Zone beenden → immer nur 1 Zone aktiv
|
||||||
if short_pending_active
|
if short_pending_active
|
||||||
if not na(startLblShort)
|
if not na(startLblShort)
|
||||||
label.delete(startLblShort)
|
label.delete(startLblShort)
|
||||||
@@ -170,6 +181,9 @@ if long_start_ok and not long_pending_active
|
|||||||
if not na(shortPendingLine)
|
if not na(shortPendingLine)
|
||||||
line.delete(shortPendingLine)
|
line.delete(shortPendingLine)
|
||||||
shortPendingLine := na
|
shortPendingLine := na
|
||||||
|
if not na(priceLblShort)
|
||||||
|
label.delete(priceLblShort)
|
||||||
|
priceLblShort := na
|
||||||
short_pending_active := false
|
short_pending_active := false
|
||||||
short_refLow := na
|
short_refLow := na
|
||||||
|
|
||||||
@@ -182,15 +196,15 @@ if long_start_ok and not long_pending_active
|
|||||||
label.delete(startLblLong)
|
label.delete(startLblLong)
|
||||||
startLblLong := label.new(bar_index, high + atr * label_offset_mult, "Ein Hoch kommt noch", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_down, color=color.blue, textcolor=color.white, size=size.small)
|
startLblLong := label.new(bar_index, high + atr * label_offset_mult, "Ein Hoch kommt noch", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_down, color=color.blue, textcolor=color.white, size=size.small)
|
||||||
|
|
||||||
// Linie nur zeichnen, wenn Preis-Textboxen-Toggle an ist
|
// Linie nur, wenn Haken gesetzt
|
||||||
if show_price_labels
|
if show_blues_lines
|
||||||
if not na(longPendingLine)
|
if not na(longPendingLine)
|
||||||
line.delete(longPendingLine)
|
line.delete(longPendingLine)
|
||||||
longPendingLine := line.new(bar_index, long_refHigh, bar_index + 1, long_refHigh, xloc=xloc.bar_index, extend=extend.right, color=color.blue, width=2)
|
longPendingLine := line.new(bar_index, long_refHigh, bar_index + 1, long_refHigh, xloc=xloc.bar_index, extend=extend.right, color=color.blue, width=2)
|
||||||
|
|
||||||
// --- Start Short ---
|
// --- Start Short ---
|
||||||
if short_start_ok and not short_pending_active
|
if short_start_ok and not short_pending_active
|
||||||
// Gegen-Zone beenden → es darf immer nur 1 Zone aktiv sein
|
// Gegen-Zone beenden → immer nur 1 Zone aktiv
|
||||||
if long_pending_active
|
if long_pending_active
|
||||||
if not na(startLblLong)
|
if not na(startLblLong)
|
||||||
label.delete(startLblLong)
|
label.delete(startLblLong)
|
||||||
@@ -198,6 +212,9 @@ if short_start_ok and not short_pending_active
|
|||||||
if not na(longPendingLine)
|
if not na(longPendingLine)
|
||||||
line.delete(longPendingLine)
|
line.delete(longPendingLine)
|
||||||
longPendingLine := na
|
longPendingLine := na
|
||||||
|
if not na(priceLblLong)
|
||||||
|
label.delete(priceLblLong)
|
||||||
|
priceLblLong := na
|
||||||
long_pending_active := false
|
long_pending_active := false
|
||||||
long_refHigh := na
|
long_refHigh := na
|
||||||
|
|
||||||
@@ -210,8 +227,8 @@ if short_start_ok and not short_pending_active
|
|||||||
label.delete(startLblShort)
|
label.delete(startLblShort)
|
||||||
startLblShort := label.new(bar_index, low - atr * label_offset_mult, "Ein Tief kommt noch", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.small)
|
startLblShort := label.new(bar_index, low - atr * label_offset_mult, "Ein Tief kommt noch", xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_up, color=color.blue, textcolor=color.white, size=size.small)
|
||||||
|
|
||||||
// Linie nur zeichnen, wenn Preis-Textboxen-Toggle an ist
|
// Linie nur, wenn Haken gesetzt
|
||||||
if show_price_labels
|
if show_blues_lines
|
||||||
if not na(shortPendingLine)
|
if not na(shortPendingLine)
|
||||||
line.delete(shortPendingLine)
|
line.delete(shortPendingLine)
|
||||||
shortPendingLine := line.new(bar_index, short_refLow, bar_index + 1, short_refLow, xloc=xloc.bar_index, extend=extend.right, color=color.blue, width=2)
|
shortPendingLine := line.new(bar_index, short_refLow, bar_index + 1, short_refLow, xloc=xloc.bar_index, extend=extend.right, color=color.blue, width=2)
|
||||||
@@ -242,6 +259,9 @@ if end_long
|
|||||||
if not na(longPendingLine)
|
if not na(longPendingLine)
|
||||||
line.delete(longPendingLine)
|
line.delete(longPendingLine)
|
||||||
longPendingLine := na
|
longPendingLine := na
|
||||||
|
if not na(priceLblLong)
|
||||||
|
label.delete(priceLblLong)
|
||||||
|
priceLblLong := na
|
||||||
long_pending_active := false
|
long_pending_active := false
|
||||||
long_refHigh := na
|
long_refHigh := na
|
||||||
|
|
||||||
@@ -253,11 +273,14 @@ if end_short
|
|||||||
if not na(shortPendingLine)
|
if not na(shortPendingLine)
|
||||||
line.delete(shortPendingLine)
|
line.delete(shortPendingLine)
|
||||||
shortPendingLine := na
|
shortPendingLine := na
|
||||||
|
if not na(priceLblShort)
|
||||||
|
label.delete(priceLblShort)
|
||||||
|
priceLblShort := na
|
||||||
short_pending_active := false
|
short_pending_active := false
|
||||||
short_refLow := na
|
short_refLow := na
|
||||||
|
|
||||||
// --- Wenn Preis-Textboxen-Toggle AUS: evtl. vorhandene Linien entfernen ---
|
// --- Linien entfernen, wenn Haken aus ---
|
||||||
if not show_price_labels
|
if not show_blues_lines
|
||||||
if not na(longPendingLine)
|
if not na(longPendingLine)
|
||||||
line.delete(longPendingLine)
|
line.delete(longPendingLine)
|
||||||
longPendingLine := na
|
longPendingLine := na
|
||||||
@@ -265,6 +288,38 @@ if not show_price_labels
|
|||||||
line.delete(shortPendingLine)
|
line.delete(shortPendingLine)
|
||||||
shortPendingLine := na
|
shortPendingLine := na
|
||||||
|
|
||||||
|
// --- Preis-Textboxen zeichnen / aktualisieren ---
|
||||||
|
if show_price_textbox and long_pending_active
|
||||||
|
// x-Position: wenn Linie existiert, nimm deren Start; sonst aktuelle Kerze
|
||||||
|
int lx = na(longPendingLine) ? bar_index : line.get_x1(longPendingLine)
|
||||||
|
float ly = long_refHigh
|
||||||
|
string t = str.tostring(ly, format.mintick)
|
||||||
|
if na(priceLblLong)
|
||||||
|
priceLblLong := label.new(lx, ly, t, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_right, textcolor=color.blue, color=color.new(color.white, 100), size=size.normal)
|
||||||
|
else
|
||||||
|
label.set_x(priceLblLong, lx)
|
||||||
|
label.set_y(priceLblLong, ly)
|
||||||
|
label.set_text(priceLblLong, t)
|
||||||
|
else
|
||||||
|
if not na(priceLblLong)
|
||||||
|
label.delete(priceLblLong)
|
||||||
|
priceLblLong := na
|
||||||
|
|
||||||
|
if show_price_textbox and short_pending_active
|
||||||
|
int sx = na(shortPendingLine) ? bar_index : line.get_x1(shortPendingLine)
|
||||||
|
float sy = short_refLow
|
||||||
|
string ts = str.tostring(sy, format.mintick)
|
||||||
|
if na(priceLblShort)
|
||||||
|
priceLblShort := label.new(sx, sy, ts, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_right, textcolor=color.blue, color=color.new(color.white, 100), size=size.normal)
|
||||||
|
else
|
||||||
|
label.set_x(priceLblShort, sx)
|
||||||
|
label.set_y(priceLblShort, sy)
|
||||||
|
label.set_text(priceLblShort, ts)
|
||||||
|
else
|
||||||
|
if not na(priceLblShort)
|
||||||
|
label.delete(priceLblShort)
|
||||||
|
priceLblShort := na
|
||||||
|
|
||||||
// ========= Alerts: Standard =========
|
// ========= Alerts: Standard =========
|
||||||
alertcondition(isPearlLong, title="Pearl Long", message="Pearl Diver erkannt – {{ticker}} {{interval}}")
|
alertcondition(isPearlLong, title="Pearl Long", message="Pearl Diver erkannt – {{ticker}} {{interval}}")
|
||||||
alertcondition(isPearlShort, title="Pearl Short", message="Oyster Farmer erkannt – {{ticker}} {{interval}}")
|
alertcondition(isPearlShort, title="Pearl Short", message="Oyster Farmer erkannt – {{ticker}} {{interval}}")
|
||||||
@@ -360,26 +415,9 @@ cond_since_start = not na(since_start) and not na(since_trigger) and since_trigg
|
|||||||
telgos_2bar_prime_cond = long_pending_active and trigger_now_or_prev and (not require_since_start or cond_since_start)
|
telgos_2bar_prime_cond = long_pending_active and trigger_now_or_prev and (not require_since_start or cond_since_start)
|
||||||
alertcondition(telgos_2bar_prime_cond, title="Telgos 2-Bar-Prime", message="Telgos 2-Bar-Prime – {{ticker}} {{interval}}")
|
alertcondition(telgos_2bar_prime_cond, title="Telgos 2-Bar-Prime", message="Telgos 2-Bar-Prime – {{ticker}} {{interval}}")
|
||||||
|
|
||||||
// ========= Preis-Textboxen an blauen Linien (Toggle) =========
|
|
||||||
// Der frühere Zahlen-Textbox-Block ist deaktiviert (auskommentiert). Zum Reaktivieren '//' entfernen.
|
|
||||||
// var label priceLblLong = na
|
|
||||||
// var label priceLblShort = na
|
|
||||||
// if show_price_labels and long_pending_active and not na(longPendingLine)
|
|
||||||
// ...
|
|
||||||
// if show_price_labels and short_pending_active and not na(shortPendingLine)
|
|
||||||
// ...
|
|
||||||
|
|
||||||
// ========= Preisskala-Labels =========
|
// ========= Preisskala-Labels =========
|
||||||
grpPS = "Preisskala-Labels"
|
|
||||||
show_ps_wolke = input.bool(true, "Wolke Linie Pink auf Preisskala", group=grpPS)
|
|
||||||
show_ps_bluel = input.bool(true, "Blues Long-Level auf Preisskala (nur aktiv)", group=grpPS)
|
|
||||||
show_ps_blues = input.bool(true, "Blues Short-Level auf Preisskala (nur aktiv)", group=grpPS)
|
|
||||||
|
|
||||||
col_ps_wolke = input.color(color.new(color.fuchsia, 0), "Farbe: Wolke Pink", group=grpPS)
|
// Wolke (Pink) – Linie im Pane + Preisskaleneintrag
|
||||||
col_ps_bluel = input.color(color.new(color.blue, 0), "Farbe: Blues Long", group=grpPS)
|
|
||||||
col_ps_blues = input.color(color.new(color.blue, 0), "Farbe: Blues Short", group=grpPS)
|
|
||||||
|
|
||||||
// Wolke (Pink): Linie im Pane + Preisskaleneintrag
|
|
||||||
plot(show_ps_wolke ? wolke_Line_pink : na,
|
plot(show_ps_wolke ? wolke_Line_pink : na,
|
||||||
title = "Wolke Pink",
|
title = "Wolke Pink",
|
||||||
color = col_ps_wolke,
|
color = col_ps_wolke,
|
||||||
@@ -394,8 +432,8 @@ ps_blues_val = show_ps_blues and short_pending_active ? short_refLow : na
|
|||||||
ps_bluel_last = barstate.islast ? ps_bluel_val : na
|
ps_bluel_last = barstate.islast ? ps_bluel_val : na
|
||||||
ps_blues_last = barstate.islast ? ps_blues_val : na
|
ps_blues_last = barstate.islast ? ps_blues_val : na
|
||||||
|
|
||||||
plot(ps_bluel_last, title="Blues Long-Level", color=col_ps_bluel, trackprice=true, display=display.price_scale)
|
plot(ps_bluel_last, title="Blues Long-Level", color=col_ps_bluel, trackprice=true, display=display.price_scale)
|
||||||
plot(ps_blues_last, title="Blues Short-Level", color=col_ps_blues, trackprice=true, display=display.price_scale)
|
plot(ps_blues_last, title="Blues Short-Level", color=col_ps_blues, trackprice=true, display=display.price_scale)
|
||||||
|
|
||||||
// ========= Dezente Labels / Shapes =========
|
// ========= Dezente Labels / Shapes =========
|
||||||
if isPearlLong
|
if isPearlLong
|
||||||
|
Reference in New Issue
Block a user