PINE LIBRARY
已更新

Bar

1 473
Library "Bar"
A comprehensive library for creating and managing custom multi-timeframe (MTF) candlestick bars without using request.security calls, providing enhanced visualization and analytical capabilities with improved performance

Candle()
  Creates a new candle object initialized with current bar's OHLC data
  Returns: A new _Candle instance with current market data

method body(this)
  Calculates the absolute size of the candle body (distance between open and close)
  Namespace types: _Candle
  Parameters:
    this (_Candle)
  Returns: The absolute difference between closing and opening prices

method topWick(this)
  Calculates the length of the upper wick (shadow above the candle body)
  Namespace types: _Candle
  Parameters:
    this (_Candle)
  Returns: The distance from the higher of open/close to the high price

method bottomWick(this)
  Calculates the length of the lower wick (shadow below the candle body)
  Namespace types: _Candle
  Parameters:
    this (_Candle)
  Returns: The distance from the low price to the lower of open/close

method display(this, bullishColor, bearishColor, transp, borderWidth, lineWidth)
  Renders the candle visually on the chart with customizable colors and styling options
  Namespace types: _Candle
  Parameters:
    this (_Candle)
    bullishColor (color)
    bearishColor (color)
    transp (int)
    borderWidth (int)
    lineWidth (int)

candles(tf, autoDisplay)
  Creates and manages an array of custom timeframe candles with optional automatic display
  Parameters:
    tf (string): Target timeframe string (e.g., "60", "240", "D") for candle aggregation
    autoDisplay (bool)
  Returns: Array containing all completed candles for the specified timeframe

_Candle
  Custom candlestick data structure that stores OHLCV data with visual rendering components
  Fields:
    start (series int): Opening timestamp of the candle period
    end (series int): Closing timestamp of the candle period
    o (series float): Opening price of the candle
    h (series float): Highest price reached during the candle period
    l (series float): Lowest price reached during the candle period
    c (series float): Closing price of the candle
    v (series float): Volume traded during the candle period
    bodyBox (series box)
    wickLine (series line)

Example Usage
Pine Script®
// Change version with latest version import EmreKb/Bar/1 as bar // "240" for 4h timeframe // true for auto display candles on chart (default: false) candlesArr = bar.candles("240", true)
發行說明
v2

Updated:
method display(this, bullishColor, bearishColor, transp, borderWidth, lineWidth)
  Renders the candle visually on the chart with customizable colors and styling options
  Namespace types: _Candle
  Parameters:
    this (_Candle)
    bullishColor (color): Color used for bullish (green) candles when close > open
    bearishColor (color): Color used for bearish (red) candles when close < open
    transp (int): Transparency level for the candle body (0-100)
    borderWidth (int): Width of the border around the candle body
    lineWidth (int): Width of the wick lines extending from the body
發行說明
v3

Updated:
candles(tf, autoDisplay, sizeLimit)
  Creates and manages an array of custom timeframe candles with optional automatic display
  Parameters:
    tf (string): Target timeframe string (e.g., "60", "240", "D") for candle aggregation
    autoDisplay (bool): Draws candles automatically
    sizeLimit (int): Remove first candle from array if the array size higher than limit for memory save
  Returns: Array containing all completed candles for the specified timeframe

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。