ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • pinescript: bar plotting
    개발 2023. 6. 27. 00:02

     

    plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor, display)void

     


    //@version=5
    indicator("Example 2")
    paletteColor = close >= open ? color.lime : color.red
    plotbar(open, high, low, close, color = paletteColor)
    //@version=5
    indicator("Smoothed candles", overlay = true)
    lenInput = input.int(9)
    smooth(source, length) =>
        ta.sma(source, length)
    o = smooth(open, lenInput)
    h = smooth(high, lenInput)
    l = smooth(low, lenInput)
    c = smooth(close, lenInput)
    ourWickColor = close > c ? color.green : color.red
    plotcandle(o, h, l, c, wickcolor = ourWickColor)
    // NOTE: Use this script on an intraday chart.
    //@version=5
    indicator("Daily bars")
    
    // Use gaps to only return data when the 1D timeframe completes, `na` otherwise.
    [o, h, l, c] = request.security(syminfo.tickerid, "D", [open, high, low, close], gaps = barmerge.gaps_on)
    
    var color UP_COLOR = color.silver
    var color DN_COLOR = color.blue
    color wickColor = c >= o ? UP_COLOR : DN_COLOR
    color bodyColor = c >= o ? color.new(UP_COLOR, 70) : color.new(DN_COLOR, 70)
    // Only plot candles on intraday timeframes,
    // and when non `na` values are returned by `request.security()` because a HTF has completed.
    plotcandle(timeframe.isintraday ? o : na, h, l, c, color = bodyColor, wickcolor = wickColor)

    '개발' 카테고리의 다른 글

    pinescript: bar coloring  (0) 2023.06.26
    pinescript: arrays  (0) 2023.06.07
    pinescript: loops  (0) 2023.06.06
    pinescript: conditional structures  (0) 2023.06.05
    pinescript: variable declaration  (0) 2023.06.04
Designed by Tistory.