BarLibrary "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
// 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)