Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
3.9 kB
4
Indexable
Never
//@version=5
//author 

indicator('BHO', overlay=true, shorttitle='H.O.COMBO')
src = input(title='Source', defval=close)
//ho1 = input(7, 'MA Length1')
//plot(ta.sma(src, ho1), color=color.new(color.blue, 0), linewidth=2, title='MA50')

//ho2 = input(21, 'MA Length2')
//plot(ta.sma(src, ho2), color=color.new(color.red, 0), linewidth=2, title='MA200')

//col1 = ho1 > ho2
//col3 = ho1 < ho2
//cro = ta.crossover(ho1 ,ho2)
//cru = ta.crossover(ho2,ho1)


fastLength = input(9)
slowLength = input(18)
price = close
mafast = ta.sma(price, fastLength)
maslow = ta.sma(price, slowLength)
k1=ta.crossover(mafast, maslow)
plot(mafast, color=color.new(color.blue, 0), linewidth=2, title='MA50')
k2=ta.crossunder(mafast, maslow)
plot(maslow, color=color.new(color.red, 0), linewidth=2, title='MA50')
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

direction = 0
direction := k1 ? 1 : k2 ? -1 : direction[1]

string gr_sc = 'SCREENER'
string gr_sy = 'SYMBOL'
string t00 = 'ma Screener'
color c00 = #686868

lb_sh = input.bool(title='Show Label', defval=true, group=gr_sc)
lb_sz = input.string(title='Label Size', options=['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], defval='Normal', group=gr_sc)
lb_xa = input.int(title='Horizontal Axis', defval=20, group=gr_sc, tooltip='Label Position x Axis')
lb_ya = input.int(title='Vertical Axis', defval=1, group=gr_sc, tooltip='Label Position y Axis')
lb_cl = input.color(title='Colours', defval=#00bb00, group=gr_sc, inline='0')
lb_cs = input.color(title='', defval=#ff0000, group=gr_sc, inline='0')


sh01 = input.bool(title='01', defval=true, group=gr_sy, inline="01")
sh02 = input.bool(title='02', defval=true, group=gr_sy, inline="02")
sh03 = input.bool(title='03', defval=true, group=gr_sy, inline="03")



tf01 = input.timeframe(title='', defval='', group=gr_sy, inline="01")
tf02 = input.timeframe(title='', defval='', group=gr_sy, inline="02")
tf03 = input.timeframe(title='', defval='', group=gr_sy, inline="03")


s01 = input.symbol(title='', group=gr_sy, inline='01', defval='BINANCE:BTCUSDT')
s02 = input.symbol(title='', group=gr_sy, inline='02', defval='BINANCE:ETHUSDT')
s03 = input.symbol(title='', group=gr_sy, inline='03', defval='BINANCE:BNBUSDT')



f_screener(s) =>
    int x = na
    int y = na
    z = color(na)
    if s
        x := direction
        y := ta.barssince(x != x[1])
        z := x == 1 ? lb_cl : x == -1 ? lb_cs : c00
    [x, y, z]
//
f_bars(x) =>
    r = ' [' + str.tostring(x) + '] '
//
f_size(x) =>
      x == 'Tiny' ? size.tiny : 
      x == 'Small' ? size.small : 
      x == 'Normal' ? size.normal : 
      x == 'Large' ? size.large : 
      x == 'Huge' ? size.huge : size.auto
//
f_label(l, t, c) =>
    r = string(na)
    for i = l*2 to 0
        r += '\n\n'
    r += t
    var label lb = na
    label.delete(lb)
    fix_allign = ta.highest(200)
    lb := lb_sh ? label.new(
      x=bar_index + lb_xa, 
      y=bar_index > 200 ? fix_allign * (1 + lb_ya / 1000) : hl2 * (1 + lb_ya / 1000), 
      text=r, textcolor=c, textalign=text.align_right, 
      style=label.style_label_left, size=f_size(lb_sz), color=#00000000) : na



[a01, b01, c01] = request.security(s01, tf01, f_screener(sh01))
[a02, b02, c02] = request.security(s02, tf02, f_screener(sh02))
[a03, b03, c03] = request.security(s03, tf03, f_screener(sh03))


t01 = a01 == 1 ? '▲' + f_bars(b01) + s01 : a01 == -1 ? '▼' + f_bars(b01) + s01 : '■' + f_bars(b01) + s01
t02 = a02 == 1 ? '▲' + f_bars(b02) + s02 : a02 == -1 ? '▼' + f_bars(b02) + s02 : '■' + f_bars(b02) + s02
t03 = a03 == 1 ? '▲' + f_bars(b03) + s03 : a03 == -1 ? '▼' + f_bars(b03) + s03 : '■' + f_bars(b03) + s03



f_label(0, t00, c00)
f_label(1, t01, c01)
f_label(2, t02, c02)
f_label(3, t03, c03)
Leave a Comment