v4+: add persistent Flip Level line with optional auto-coloring and price tracking

This commit is contained in:
mindesbunister
2025-10-17 11:31:25 +02:00
parent 9563f4d44f
commit 977f53dc75

View File

@@ -1,5 +1,5 @@
//@version=6 //@version=6
indicator("Bullmania Money Line v4+ (optional filters)", overlay=true) indicator("Bullmania Money Line v4+ multi time frame profiles (optional filters)", overlay=true)
// ============================= // =============================
// Base inputs (match v4 defaults) // Base inputs (match v4 defaults)
@@ -49,6 +49,10 @@ showCircles = input.bool(true, "Show flip circles (v4 style)")
showFill = input.bool(true, "Shade price-to-line area") showFill = input.bool(true, "Shade price-to-line area")
gateCircles = input.bool(false, "Gate flip circles with filters") gateCircles = input.bool(false, "Gate flip circles with filters")
showGatedMarkers = input.bool(true, "Show gated markers (triangles)") showGatedMarkers = input.bool(true, "Show gated markers (triangles)")
// Flip level line (persistent) visuals
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")
// ============================= // =============================
// Per-timeframe profiles (optional) // Per-timeframe profiles (optional)
@@ -345,6 +349,12 @@ signalsOk = adxOk and mtfOk and inSession and cooldownOk and trendMAOk and chopO
upTrend = trend == 1 ? supertrend : na upTrend = trend == 1 ? supertrend : na
downTrend = trend == -1 ? supertrend : na downTrend = trend == -1 ? supertrend : na
// Persistent Flip Level (holds value from last flip until next)
var float flipLevel = na
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)
plot(upTrend, "Up Trend", color=color.new(color.green, 0), style=plot.style_linebr, linewidth=2) 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) plot(downTrend, "Down Trend", color=color.new(color.red, 0), style=plot.style_linebr, linewidth=2)