Гусев Владимир Петрович
Гусев Владимир Петрович личный блог
15 апреля 2020, 22:46

Color Resolution / PineScript v4 TradingView

Я уже давал скрипт с подсветкой дней.
Придумал название попроще и сделал удобную функцию выбора разрешения.
Color Resolution / PineScript v4 TradingView

//@version=4
study("Color Resolution", overlay=true)

resolution = input(title="Resolution", type=input.resolution, defval="D")
resolution_open = security(syminfo.tickerid, resolution, open, barmerge.gaps_off, barmerge.lookahead_on)
resolution_close = security(syminfo.tickerid, resolution, close, barmerge.gaps_off, barmerge.lookahead_on)
p_open = plot(resolution_open, color=#00000080, display=display.all, style=plot.style_stepline)
p_close = plot(resolution_close, color=#00000080, display=display.all, style=plot.style_stepline)
fill(p_open, p_close, resolution_close >= resolution_open ? color.green : color.red, 75)

Версия от Винни Пуха из комментариев.
Добавлены тени.
//@version=4
study("Color Resolution Vinni", overlay=true)

rsl = input(title="Resolution", type=input.resolution, defval="D" )
resolution = timeframe.isweekly? "M": rsl

resolution_high = security(syminfo.tickerid, resolution, high, barmerge.gaps_off, barmerge.lookahead_on)
resolution_low = security(syminfo.tickerid, resolution, low, barmerge.gaps_off, barmerge.lookahead_on)
p_high = plot(resolution_high, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title="High")
p_low = plot(resolution_low, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title="Low")
fill(p_high, p_low, color = #131722, transp = 80, title="Fill_High_low")


resolution_open = security(syminfo.tickerid, resolution, open, barmerge.gaps_off, barmerge.lookahead_on)
resolution_close = security(syminfo.tickerid, resolution, close, barmerge.gaps_off, barmerge.lookahead_on)
p_open = plot(resolution_open, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title="Open")
p_close = plot(resolution_close, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title="Close")
fill(p_open, p_close, resolution_close >= resolution_open? #0cf8c4: #e91e63, transp = 90, title="Fill_Open_Close")
4 Комментария
  • Винни Пух
    16 апреля 2020, 22:07

    rsl = input(title=«Resolution», type=input.resolution, defval=«D» )
    resolution = timeframe.isweekly? «M»: rsl

    resolution_high = security(syminfo.tickerid, resolution, high, barmerge.gaps_off, barmerge.lookahead_on)
    resolution_low = security(syminfo.tickerid, resolution, low, barmerge.gaps_off, barmerge.lookahead_on)
    p_high = plot(resolution_high, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title=«High»)
    p_low = plot(resolution_low, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title=«Low»)
    fill(p_high, p_low, color = #131722, transp = 80, title=«Fill_High_low»)


    resolution_open = security(syminfo.tickerid, resolution, open, barmerge.gaps_off, barmerge.lookahead_on)
    resolution_close = security(syminfo.tickerid, resolution, close, barmerge.gaps_off, barmerge.lookahead_on)
    p_open = plot(resolution_open, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title=«Open»)
    p_close = plot(resolution_close, color=#000000, display=display.all, style=plot.style_stepline, transp = 100, title=«Close»)
    fill(p_open, p_close, resolution_close >= resolution_open? #0cf8c4: #e91e63, transp = 90, title=«Fill_Open_Close»)




    Добавил на скорую руку еще и максимумы/минимумы.
      • Винни Пух
        16 апреля 2020, 22:21
        Анал,  спасибо, не заметил такую «фишку» с кавычками. Надеюсь кому-то пригодится.

Активные форумы
Что сейчас обсуждают

Старый дизайн
Старый
дизайн