Page 164 of 210

Re: Bollinger Bands type indicators for MT4

Posted: Tue Apr 18, 2023 6:41 am
by RodrigoRT7
Abdi wrote: Mon Apr 17, 2023 11:33 pm
Image
Hi, i would like to share this bollinger bands indicator for those who like to trade with them. I particularly like the stats. It could be used in different ways. To scalp around div 3, trend and or trade breakouts when price stays around the upper or lower div bands, ...
Idk if its possible to convert it to mt4 but i think it would look great and help.


Code: Select all

//@version=5

/// ███ █   █ █ ███    █ █ █   ███ ███ ███    ███ ███ ███ ██▄ ███ █  █ ████
/// █▄█ █   █ █ █▄▄    █ █ █    █  █▄  █▄█     █  █▄  █▄█ █ █  █  ██▄█ █ ▄▄
/// █   █▄█ ███ ▄▄█    ███ █▄█  █  █ █ █ █     █  █ █ █ █ ███ ▄█▄ █ ██ █▄▄█
/// © PlusUltraTrading

indicator(title='Bollinger Bands assumption percentige Mod', overlay=true)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////--------------------- BaseLine --------------------///////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BaseLine_show = input(defval=true, title='Show BaseLine + Bands', group='══════════════════ BaseLine ══════════════════') 

BaseLine_Type = input.string(defval='SMA  | Simple MA', title='Type', options=['SMA  | Simple MA', 'SMMA | Smoothed MA'], group='══════════════════ BaseLine ══════════════════', inline='BaseLine')
BaseLine_Length = input.int(defval=34, minval=1, title='Length', group='══════════════════ BaseLine ══════════════════', inline='BaseLine')
BaseLine_Source = input.source(defval=close, title='Source', group='══════════════════ BaseLine ══════════════════', inline='BaseLine')


mult1 = input.float(defval=1.0, minval=0.001, maxval=50, title='Mult', inline='mult1', group='══════════════════ BaseLine ══════════════════')
mult2 = input.float(defval=1.0, minval=0.001, maxval=50, title='Mult', inline='mult2', group='══════════════════ BaseLine ══════════════════')
mult3 = input.float(defval=3.0, minval=0.001, maxval=50, title='Mult', inline='mult3', group='══════════════════ BaseLine ══════════════════')




upperbase_colbull = input.color(defval=color.new(#434651, 0), title='U|Base Bull', inline='BaseLine Style', group='══════════════════ BaseLine ══════════════════')
upperbase_colbear = input.color(defval=color.new(#2a2e39, 0), title='U|Base Bear', inline='BaseLine Style', group='══════════════════ BaseLine ══════════════════')

lowerbase_colbull = input.color(defval=color.new(#434651, 0), title='L|Base Bull', inline='BaseLine Style', group='══════════════════ BaseLine ══════════════════')
lowerbase_colbear = input.color(defval=color.new(#2a2e39, 0), title='L|Base Bear', inline='BaseLine Style', group='══════════════════ BaseLine ══════════════════')

upper1_colbull = input.color(defval=color.new(#009f6a,0), title='U|Bull', inline='mult1', group='══════════════════ BaseLine ══════════════════')
upper1_colbear = input.color(defval=color.new(#005d3e,0), title='U|Bear', inline='mult1', group='══════════════════ BaseLine ══════════════════')

lower1_colbull = input.color(defval=color.new(#64005e,0), title='L|Bull', inline='mult1', group='══════════════════ BaseLine ══════════════════')
lower1_colbear = input.color(defval=color.new(#9e0095,0), title='L|Bear', inline='mult1', group='══════════════════ BaseLine ══════════════════')

upper2_colbull = input.color(defval=color.new(#00ffa9,0), title='L|Bull', inline='mult2', group='══════════════════ BaseLine ══════════════════')
upper2_colbear = input.color(defval=color.new(#009f6a,0), title='L|Bear', inline='mult2', group='══════════════════ BaseLine ══════════════════')

lower2_colbull = input.color(defval=color.new(#9e0095,0), title='L|Bull', inline='mult2', group='══════════════════ BaseLine ══════════════════')
lower2_colbear = input.color(defval=color.new(#ff00d7,0), title='L|Bear', inline='mult2', group='══════════════════ BaseLine ══════════════════')

upper3_colbull = input.color(defval=color.new(#ffbe1d,0), title='L|Bull', inline='mult3', group='══════════════════ BaseLine ══════════════════')
upper3_colbear = input.color(defval=color.new(#ffbe1d,33), title='L|Bear', inline='mult3', group='══════════════════ BaseLine ══════════════════')

lower3_colbull = input.color(defval=color.new(#f7525f,33), title='L|Bull', inline='mult3', group='══════════════════ BaseLine ══════════════════')
lower3_colbear = input.color(defval=color.new(#f7525f,0), title='L|Bear', inline='mult3', group='══════════════════ BaseLine ══════════════════')


//multiplier1_LineWidth = input.int(defval=2, title='L', inline='mult1', group='══════════════════ BaseLine ══════════════════')//
//multiplier2_LineWidth = input.int(defval=2, title='L', inline='mult2', group='══════════════════ BaseLine ══════════════════')//
//multiplier3_LineWidth = input.int(defval=2, title='L', inline='mult3', group='══════════════════ BaseLine ══════════════════')//

ma_Type(_type, _src, _len) =>
    float baseline = 0.0
    
    if _type == 'SMA  | Simple MA'
        baseline := ta.sma(_src, _len)


    else if _type == 'SMMA | Smoothed MA'
        w = ta.wma(_src, _len)
        baseline := na(w[1]) ? ta.sma(_src, _len) : (w[1] * (_len - 1) + _src) / _len

basis = ma_Type(BaseLine_Type, BaseLine_Source, BaseLine_Length)

upper1 = basis + mult1 * ta.stdev(BaseLine_Source, BaseLine_Length)
lower1 = basis - mult1 * ta.stdev(BaseLine_Source, BaseLine_Length)
upper2 = basis + mult2 * ta.stdev(BaseLine_Source, BaseLine_Length)
lower2 = basis - mult2 * ta.stdev(BaseLine_Source, BaseLine_Length)
upper3 = basis + mult3 * ta.stdev(BaseLine_Source, BaseLine_Length)
lower3 = basis - mult3 * ta.stdev(BaseLine_Source, BaseLine_Length)


plot_basis = plot(BaseLine_show ? basis : na, title='BaseLine', color=upperbase_colbull)
plot_upper1 = plot(BaseLine_show ? upper1 : na, title='Upper 1', color=upper1_colbull)
plot_lower1 = plot(BaseLine_show ? lower1 : na, title='Lower 1', color=lower1_colbear)
plot_upper2 = plot(BaseLine_show ? upper2 : na, title='Upper 2', color=upper2_colbull)
plot_lower2 = plot(BaseLine_show ? lower2 : na, title='Lower 2', color=lower2_colbear)
plot_upper3 = plot(BaseLine_show ? upper3 : na, title='Upper 3', color=upper3_colbull)
plot_lower3 = plot(BaseLine_show ? lower3 : na, title='Lower 3', color=lower3_colbear)


///////////////////////////////////////--------------------- BB STD Bar coloring ------------------/////////////////////////////////////////
BBSTD_showbarcolor = input(defval=true, title='Color Bars/Candles based on STD Value', group='══════════════════ BaseLine ══════════════════') 




cond1bear = close>basis and close<upper1 and open > close
cond1bull = close>basis and close<upper1 and close > open

cond2bear = close>basis and close>upper1 and close<upper2 and open > close
cond2bull = close>basis and close>upper1 and close<upper2 and close > open

cond3bear = close>basis and close>upper1 and close>upper2 and close<upper3 and open > close
cond3bull = close>basis and close>upper1 and close>upper2 and close<upper3 and close > open

cond4bear = close>basis and close>upper1 and close>upper2 and close>upper3 and open > close
cond4bull = close>basis and close>upper1 and close>upper2 and close>upper3 and close > open

cond5bear = close<basis and close>lower1 and open > close
cond5bull = close<basis and close>lower1 and close > open

cond6bear = close<basis and close<lower1 and close>lower2 and open > close
cond6bull = close<basis and close<lower1 and close>lower2 and close > open

cond7bear = close<basis and close<lower1 and close<lower2 and close>lower3 and open > close
cond7bull = close<basis and close<lower1 and close<lower2 and close>lower3 and close > open

cond8bear = close<basis and close<lower1 and close<lower2 and close<lower3 and open > close
cond8bull = close<basis and close<lower1 and close<lower2 and close<lower3 and close > open

BBSTD_barcolor = cond1bear ? na : cond2bear ? upper1_colbear : cond3bear ? upper2_colbear : cond4bear ? upper3_colbear : cond5bear ? na : cond6bear ? lower1_colbear : cond7bear ? lower2_colbear : cond8bear ? lower3_colbear : 
                 cond1bull ? na : cond2bull ? upper1_colbull : cond3bull ? upper2_colbull : cond4bull ? upper3_colbull : cond5bull ? na : cond6bull ? lower1_colbull : cond7bull ? lower2_colbull : cond8bull ? lower3_colbull : na

barcolor(BBSTD_showbarcolor ? BBSTD_barcolor : na, title='Bar/Candle-colors Trend')



///////////////////////////////////////--------------------- BB STD Stats ------------------/////////////////////////////////////////
BBSTD_show_stats = input(defval=true, title='Show BB STD Stats', group='══════════════════ BaseLine ══════════════════') 

if BBSTD_show_stats
    perc_line = box.new(left=na, top=na, right=na, bottom=na, border_width=1,border_color=upperbase_colbull)
    box.set_lefttop(perc_line, left=bar_index + 3, top=upper1)
    box.set_rightbottom(perc_line, right=bar_index + 3, bottom=basis)
    box.delete(perc_line[1])

    wa_low_perc_line_l = box.new(left=na, top=na, right=na, bottom=na, border_width=1, border_color=upperbase_colbear)
    box.set_lefttop(wa_low_perc_line_l, left=bar_index + 3, top=basis)
    box.set_rightbottom(wa_low_perc_line_l, right=bar_index + 3, bottom=lower1)
    box.delete(wa_low_perc_line_l[1])


    wa_up_perc_line = box.new(left=na, top=na, right=na, bottom=na, border_width=1, border_color=upper1_colbull)
    box.set_lefttop(wa_up_perc_line, left=bar_index + 3, top=upper2)
    box.set_rightbottom(wa_up_perc_line, right=bar_index + 3, bottom=upper1)
    box.delete(wa_up_perc_line[1])

    wa_low_perc_line = box.new(left=na, top=na, right=na, bottom=na, border_width=1, border_color=lower1_colbear)
    box.set_lefttop(wa_low_perc_line, left=bar_index + 3, top=lower1)
    box.set_rightbottom(wa_low_perc_line, right=bar_index + 3, bottom=lower2)
    box.delete(wa_low_perc_line[1])


    ao_up_perc_line = box.new(left=na, top=na, right=na, bottom=na, border_width=1, border_color=upper2_colbull)
    box.set_lefttop(ao_up_perc_line, left=bar_index + 3, top=upper3)
    box.set_rightbottom(ao_up_perc_line, right=bar_index + 3, bottom=upper2)
    box.delete(ao_up_perc_line[1])

    ao_low_perc_line = box.new(left=na, top=na, right=na, bottom=na, border_width=1, border_color=lower2_colbear)
    box.set_lefttop(ao_low_perc_line, left=bar_index + 3, top=lower2)
    box.set_rightbottom(ao_low_perc_line, right=bar_index + 3, bottom=lower3)
    box.delete(ao_low_perc_line[1])


// total number
var bars = 1
if upper3 != upper3[1]
    bars += 1
// number that close > upper1
var u1 = 0.0
if upper1 <= close
    u1 += 1
// number that close > upper2    
var u2 = 0.0
if upper2 <= close
    u2 += 1
// number that close > upper3    
var u3 = 0.0
if upper3 <= close
    u3 += 1
// number that close < lower1      
var l1 = 0.0
if lower1 >= close
    l1 += 1
// number that close < lower2  
var l2 = 0.0
if lower2 >= close
    l2 += 1
// number that close < lower3  
var l3 = 0.0
if lower3 >= close
    l3 += 1
//probability

p_u1 = u1/bars * 100
p_l1 = l1/bars * 100
p_u2 = u2/bars * 100
p_l2 = l2/bars * 100
p_u3 = u3/bars * 100
p_l3 = l3/bars * 100

if BBSTD_show_stats
    var label label_u1 = na
    label.delete(label_u1)
    label_u1 := label.new(bar_index+9, upper1, text='' + str.tostring(mult1) + ' :  ' + str.tostring(p_u1,'#.##')+'%', style=label.style_label_left, color=na, textcolor=upper2_colbear,textalign=text.align_left)

    var label label_u2 = na
    label.delete(label_u2)
    label_u2 := label.new(bar_index+9, upper2, text='' + str.tostring(mult2) + ' :  ' + str.tostring(p_u2,'#.##')+'%', style=label.style_label_left, color=na, textcolor=upper2_colbull,textalign=text.align_left)

    var label label_u3 = na
    label.delete(label_u3)
    label_u3 := label.new(bar_index+9, upper3, text='' + str.tostring(mult3) + ' :  ' + str.tostring(p_u3,'#.##')+'%', style=label.style_label_left, color=na, textcolor=upper3_colbull,textalign=text.align_left)

    var label label_l1 = na
    label.delete(label_l1)
    label_l1 := label.new(bar_index+9, lower1, text='' + str.tostring(-mult1) + ' :  ' + str.tostring(p_l1,'#.##')+'%', style=label.style_label_left, color=na, textcolor=lower2_colbull,textalign=text.align_left)

    var label label_l2 = na
    label.delete(label_l2)
    label_l2 := label.new(bar_index+9, lower2, text='' + str.tostring(-mult2) + ' :  ' + str.tostring(p_l2,'#.##')+'%', style=label.style_label_left, color=na, textcolor=lower2_colbear,textalign=text.align_left)

    var label label_l3 = na
    label.delete(label_l3)
    label_l3 := label.new(bar_index+9, lower3, text='' + str.tostring(-mult3) + ' :  ' + str.tostring(p_l3,'#.##')+'%', style=label.style_label_left, color=na, textcolor=lower3_colbear,textalign=text.align_left)

    var label label_total = na
    label.delete(label_total)
    label_total := label.new(bar_index+15, basis, text=BaseLine_Type + ' : ' + str.tostring(BaseLine_Length) + ' | Bars Back ' + str.tostring(bars,"#"), style=label.style_label_left, color=na, textcolor=#636363,textalign=text.align_left)
mrtools wrote: Sun Apr 18, 2021 12:42 pm Added outer bands fill.
Image
I know it's not exactly what you're looking for, but maybe this could help.

Re: G channel

Posted: Tue Apr 18, 2023 8:12 am
by kvak
太虚一毫 wrote: Mon Apr 17, 2023 11:27 pm The G Channel has several outstanding works. :thumbup:

Filtered RSI histo genre works are wonderful and very combative.

Looking forward to the teacher making another G channel + filtered rsi histo BT version.

The merit is immeasurable!
Hello, I made this version (from my rsi-xuma). Combo RSI like line and G-MA as histogram, if it is ok for you, test it....

Re: G channel

Posted: Tue Apr 18, 2023 10:06 am
by 太虚一毫
kvak wrote: Tue Apr 18, 2023 8:12 am Hello, I made this version (from my rsi-xuma). Combo RSI like line and G-MA as histogram, if it is ok for you, test it....
Image

Image

Image
Very interesting! :thumbup:

Looking forward to adding a button.

The merit is immeasurable!

Re: G channel

Posted: Tue Apr 18, 2023 12:50 pm
by 太虚一毫
kvak wrote: Tue Apr 18, 2023 8:12 am Hello, I made this version (from my rsi-xuma). Combo RSI like line and G-MA as histogram, if it is ok for you, test it....
Image

Image

Image


The RSI is a momentum indicator.

If you replace RSI with other momentum indicators, such as Velocity, Momentum & ROC, can it be understood as "momentum accumulation formation G_Channel"?

viewtopic.php?f=579496&t=8472232

If RSI or Velocity, Momentum, ROC level, do not use 70, 30, but use the donchian channel (sl), believe that RSI or Velocity, Momentum, ROC + G_Channel will be a complex and efficient trading system.

In short: RSI+ G_Channel is fun!

The merit is immeasurable! :thumbup:

Re: G channel

Posted: Tue Apr 18, 2023 5:41 pm
by 太虚一毫
kvak wrote: Tue Apr 18, 2023 8:12 am Hello, I made this version (from my rsi-xuma). Combo RSI like line and G-MA as histogram, if it is ok for you, test it....
Image

Image

Image


Header Settings, what does the displayed number mean? :)

Re: G channel

Posted: Tue Apr 18, 2023 6:03 pm
by kvak
太虚一毫 wrote: Tue Apr 18, 2023 5:41 pm Header Settings, what does the displayed number mean? :)
Rsi level....

Re: G channel

Posted: Fri Apr 21, 2023 4:37 am
by Mickey Abi
mrtools wrote: Sat Oct 15, 2022 2:02 am G Channel Updated Version with code optimization

Looks like it should be fixed in this version.
Image
Hello @mrtools

I have a very cogent request to make.
I will love it if you can make a double 2 time frames G Channel Indi with one Alert when both timeframes match...

See chat sample attached below. (two G Channel indi with one set to current time frame and the other set to the first higher time frame)
Thank you.

Re: G channel

Posted: Fri Apr 21, 2023 4:43 am
by mrtools
Mickey Abi wrote: Fri Apr 21, 2023 4:37 am Hello @mrtools

I have a very cogent request to make.
I will love it if you can make a double 2 time frames G Channel Indi with one Alert when both timeframes match...

See chat sample attached below. (two G Channel indi with one set to current time frame and the other set to the first higher time frame)

Image


Thank you.

! G - Channel - (mtf + alerts + arrows + candles + btn).ex4
Not abte to do that, sorry.

Re: G channel

Posted: Fri Apr 21, 2023 8:14 am
by kvak
Mickey Abi wrote: Fri Apr 21, 2023 4:37 am Hello @mrtools

I have a very cogent request to make.
I will love it if you can make a double 2 time frames G Channel Indi with one Alert when both timeframes match...

See chat sample attached below. (two G Channel indi with one set to current time frame and the other set to the first higher time frame)



Thank you.

! G - Channel - (mtf + alerts + arrows + candles + btn).ex4
Maybe this is very close what you want...I use THIS indicator as a baseline.
It repaint if you use higher timeframes and displayed only one colored line...

Re: G channel

Posted: Fri Apr 21, 2023 7:52 pm
by Mickey Abi
mrtools wrote: Fri Apr 21, 2023 4:43 am Not abte to do that, sorry.
Oh! That's alright. Will stick to placing both on the chart for now.
Thanks Chief