From e4f11d252d803e4c44c59e6b4f640261152cadb6 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Fri, 17 Oct 2025 11:45:29 +0200 Subject: [PATCH] =?UTF-8?q?Flip=20previews:=20plot=20Next=20Bull/Bear=20Fl?= =?UTF-8?q?ip=20thresholds=20with=20optional=20value=20labels;=20uses=20cu?= =?UTF-8?q?rrent=20tsl=20=C2=B1=20buffer*ATR=20and=20activates=20opposite?= =?UTF-8?q?=20to=20current=20trend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bullmania_Money_Line_v4_plus.pine | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Bullmania_Money_Line_v4_plus.pine b/Bullmania_Money_Line_v4_plus.pine index 68f93c2..eb1b331 100644 --- a/Bullmania_Money_Line_v4_plus.pine +++ b/Bullmania_Money_Line_v4_plus.pine @@ -54,6 +54,10 @@ 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") +// Preview of the next flip thresholds +showNextBullFlip = input.bool(true, "Show Next Bull Flip level") +showNextBearFlip = input.bool(false, "Show Next Bear Flip level") +showNextFlipValue = input.bool(true, "Show Next Flip value label") // ============================= // Per-timeframe profiles (optional) @@ -365,6 +369,34 @@ if showFlipLevelValue and not na(flipLevel) 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) +// Next flip preview levels (dynamic thresholds) +nextBullLevel = tsl + aBufferATR * atr // price needed to start bull flip counting +nextBearLevel = tsl - aBufferATR * atr // price needed to start bear flip counting + +nextBullActive = trend == -1 +nextBearActive = trend == 1 + +nbCol = color.new(color.lime, 0) +nsCol = color.new(color.red, 0) + +plot(showNextBullFlip and nextBullActive ? nextBullLevel : na, title="Next Bull Flip Level", color=nbCol, linewidth=2, style=plot.style_linebr, trackprice=true) +plot(showNextBearFlip and nextBearActive ? nextBearLevel : na, title="Next Bear Flip Level", color=nsCol, linewidth=2, style=plot.style_linebr, trackprice=true) + +// Optional live value labels for next flip thresholds +var label nextBullLbl = na +var label nextBearLbl = na +if showNextFlipValue + if showNextBullFlip and nextBullActive and not na(nextBullLevel) + if not na(nextBullLbl) + label.delete(nextBullLbl) + nextBullLbl := label.new(bar_index, nextBullLevel, text="Next Bull Flip: " + str.tostring(nextBullLevel, format.mintick) + (aConfirmBars > 1 ? " (" + str.tostring(aConfirmBars) + " closes)" : ""), + style=label.style_label_left, color=nbCol, textcolor=color.white, yloc=yloc.price, size=size.tiny) + if showNextBearFlip and nextBearActive and not na(nextBearLevel) + if not na(nextBearLbl) + label.delete(nextBearLbl) + nextBearLbl := label.new(bar_index, nextBearLevel, text="Next Bear Flip: " + str.tostring(nextBearLevel, format.mintick) + (aConfirmBars > 1 ? " (" + str.tostring(aConfirmBars) + " closes)" : ""), + style=label.style_label_left, color=nsCol, 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)