Flip Level: add live value label at current bar; keeps value fixed to last flip
This commit is contained in:
@@ -53,6 +53,7 @@ showGatedMarkers = input.bool(true, "Show gated markers (triangles)")
|
||||
showFlipLevelLine = input.bool(true, "Show Flip Level line")
|
||||
flipLineAutoColor = input.bool(true, "Flip line color by trend")
|
||||
flipLineCustomCol = input.color(color.new(color.silver, 0), "Flip line custom color")
|
||||
showFlipLevelValue = input.bool(true, "Show Flip Level value label")
|
||||
|
||||
// =============================
|
||||
// Per-timeframe profiles (optional)
|
||||
@@ -355,6 +356,15 @@ flipLevel := (flipUp or flipDn) ? supertrend : nz(flipLevel[1])
|
||||
flipLineColor = flipLineAutoColor ? (trend == 1 ? color.new(color.green, 0) : color.new(color.red, 0)) : flipLineCustomCol
|
||||
plot(showFlipLevelLine ? flipLevel : na, title="Flip Level", color=flipLineColor, linewidth=2, trackprice=true)
|
||||
|
||||
// Optional always-visible value label at current bar
|
||||
var label flipValLbl = na
|
||||
if showFlipLevelValue and not na(flipLevel)
|
||||
if not na(flipValLbl)
|
||||
label.delete(flipValLbl)
|
||||
flipLblCol = flipLineAutoColor ? (trend == 1 ? color.new(color.green, 0) : color.new(color.red, 0)) : flipLineCustomCol
|
||||
flipValLbl := label.new(bar_index, flipLevel, text="Flip Level: " + str.tostring(flipLevel, format.mintick),
|
||||
style=label.style_label_left, color=flipLblCol, textcolor=color.white, yloc=yloc.price, size=size.tiny)
|
||||
|
||||
plot(upTrend, "Up Trend", color=color.new(color.green, 0), style=plot.style_linebr, linewidth=2)
|
||||
plot(downTrend, "Down Trend", color=color.new(color.red, 0), style=plot.style_linebr, linewidth=2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user