// v2024_B-1_2lines // 28/04.2023 //@version=4 //=++==============================================================++= study("Contrast Oscillator", overlay=false) src = input(close, title="Source") dis = input(false, type = input.bool, title="Contr?") dish = input(false, type = input.bool, title="Histogram?") _coeff = input(defval=0.0, title="Coefficient", type=input.float) var float alpha = atan(_coeff) / 3.14159265 + 0.5 //=++==============================================================++= x = 0.0 y = 0.0 z = 0.0 if bar_index > 0 x := (1.0 - alpha)*src + alpha*x[1] y := -alpha*x + x[1] + alpha*y[1] z := -alpha*y + y[1] + alpha*z[1] t = 2*x - 0.5*y - 0.5*z c = -x + y + z //=++==============================================================++= plot(dish? t-c:na, title="OsMA Histogram", color=(t>=c)?color.aqua:color.yellow, linewidth=3, transp = 40, style=plot.style_histogram) plot(t-c, title="OsMA Line", color=(t>=c)?color.blue:color.red, linewidth=1, transp = 0, style=plot.style_line) plot(dis? c-t:na, title="OsMA Contr", color=(t>=c)?color.silver:color.silver, linewidth=1, transp = 40, style=plot.style_line) //lot(dis? 0:na, title="0 Line", color=color.silver, linewidth=1, transp = 0, style=plot.style_line) //plot(dish? 0:na, title="0 Line", color=color.silver, linewidth=1, transp = 0, style=plot.style_line) plot(0, title="0 Line", color=color.silver, linewidth=1, transp = 60, style=plot.style_line)