mrtools wrote: Mon Dec 22, 2025 5:56 am Hello, by any chance do you have any more information about this indicator?
Code: Select all
l.style_label_up, yloc=yloc.belowbar)Code: Select all
```pinescript
//@version=5
indicator("Binary Master Mind", shorttitle="Kwiq Signals Indicator (BMM)", overlay=true)
// Hidden parameters (set directly in the code)
n1 = 2
n2 = 4
ob_level1 = 60
ob_level2 = 53
os_level1 = -60
os_level2 = -53
src = ohlc4
bullish_color = color.green
bearish_color = color.red
arrow_size = "Auto"
adx_threshold = input(10, "Filter Threshold") // Kept for potential future use
// Visible input parameters (only X Filter toggle)
use_x_filter = input.bool(true, "X Filter")
// WaveTrend calculation
ap = src
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)
wt1 = tci
wt2 = ta.sma(wt1, 4)
// 3 EMA Filter Calculation (X Filter)
len1 = 20
len2 = 50
len3 = 100
ema1 = ta.ema(close, len1)
ema2 = ta.ema(close, len2)
ema3 = ta.ema(close, len3)
ema_trend_up = ema1 > ema2 and ema2 > ema3
ema_trend_down = ema1 < ema2 and ema2 < ema3
// Calculate signals
up_signal = wt1[2] > wt1[3] and wt1[3] < wt1[4] and wt1[2] < os_level2 and wt1[1] > wt1[2]
down_signal = wt1[2] < wt1[3] and wt1[3] > wt1[4] and wt1[2] > ob_level2 and wt1[1] < wt1[2]
// Apply X Filter if enabled
up_signal := up_signal and (not use_x_filter or ema_trend_up)
down_signal := down_signal and (not use_x_filter or ema_trend_down)
// Pre-alert signals
up_pre_alert = wt1 < wt1[1] and wt1[1] < wt1[2] and wt1 < os_level2 and (not use_x_filter or ema_trend_up)
down_pre_alert = wt1 > wt1[1] and wt1[1] > wt1[2] and wt1 > ob_level2 and (not use_x_filter or ema_trend_down)
// Plot arrows on the current bar
plotarrow(up_signal ? 1 : na, colorup=bullish_color)
plotarrow(down_signal ? -1 : na, colordown=bearish_color)
// Background coloring based on WaveTrend levels
bgcolor(wt1 > ob_level1 ? color.new(color.red, 90) : wt1 < os_level1 ? color.new(color.green, 90) : na)
// Martingale labeling system and win calculation
var int bullish_steps = 0
var int bearish_steps = 0
var bool waiting_for_bullish = false
var bool waiting_for_bearish = false
var int total_signals = 0
var int total_wins = 0
if up_signal
waiting_for_bullish := true
bullish_steps := 0
total_signals := total_signals + 1
if down_signal
waiting_for_bearish := true
bearish_steps := 0
total_signals := total_signals + 1
label_text = ""
if waiting_for_bullish
if close > open // Bullish candle
label_text := bullish_steps == 0 ? "Dwin" : str.tostring(bullish_steps) + "swin"
waiting_for_bullish := false
total_wins := total_wins + 1
else
bullish_steps := math.min(bullish_steps + 1, 5)
if bullish_steps == 5
waiting_for_bullish := false
if waiting_for_bearish
if close < open // Bearish candle
label_text := bearish_steps == 0 ? "Dwin" : str.tostring(bearish_steps) + "swin"
waiting_for_bearish := false
total_wins := total_wins + 1
else
bearish_steps := math.min(bearish_steps + 1, 5)
if bearish_steps == 5
waiting_for_bearish := false
if label_text != ""
label.new(bar_index, waiting_for_bullish ? high : low, text=label_text, color=color.black, textcolor=color.white, style=waiting_for_bullish ? label.style_label_down : label.style_label_up)
// Calculate win rate
win_rate = total_signals > 0 ? (total_wins / total_signals) * 100 : 0
// Create and display the table
var table stats_table = table.new(position.top_right, 3, 2, bgcolor = color.new(color.blue, 70))
table.cell(stats_table, 0, 0, "Total Signals", text_color = color.white)
table.cell(stats_table, 1, 0, "Wins", text_color = color.white)
table.cell(stats_table, 2, 0, "Win Rate", text_color = color.white)
table.cell(stats_table, 0, 1, str.tostring(total_signals), text_color = color.white)
table.cell(stats_table, 1, 1, str.tostring(total_wins), text_color = color.green)
table.cell(stats_table, 2, 1, str.tostring(math.round(win_rate, 2)) + "%", text_color = color.green)
// Conditional plotting logic for X Filter (EMA)
var float ema1_visibility = na
var float ema2_visibility = na
var float ema3_visibility = na
if use_x_filter
ema1_visibility := ema1
ema2_visibility := ema2
ema3_visibility := ema3
plot(ema1_visibility, title="EMA", color=color.green) // Removed period from title
plot(ema2_visibility, title="EMA", color=color.blue) // Removed period from title
plot(ema3_visibility, title="EMA", color=color.red) // Removed period from title
// Pre-alert label
var label pre_alert_label = na
label.delete(pre_alert_label[1])
if up_pre_alert
pre_alert_label := label.new(bar_index, high, text="Up arrow signal\nalert in next candle", color=color.new(color.black, 0), textcolor=color.black, style=label.style_label_down, yloc=yloc.abovebar)
else if down_pre_alert
pre_alert_label := label.new(bar_index, low, text="Down arrow signal\nalert in next candle", color=color.new(color.black, 0), textcolor=color.black, style=label.style_label_up, yloc=yloc.belowbar)
```