Bar Type Scripts
Bar type scripts are used for building custom bar types that can be used interchangeably with native bar types throughout the platform. The custom data bars that are built by the script can either be based on tick, minute or daily bars depending on the underlying bar source. Note that when a bar type script is used by multiple symbols a single script instance is initialized for each one.
Setup
A Bar Type script can be set up anywhere a native bar type is used, including on charts, watchlists and in strategies.
Functions
Name |
Description |
This function is called when a new bar type instance is created. |
|
This function is called on each new tick of the underlying symbol (see the BarBuilder functions). |
|
OnDataBar(bool, long, long, double, double, double, double, double, double) |
This function is called on each new OHLCV+OI bar of the underlying symbol (see the BarBuilder functions). |
This function is called when a trading session for the underlying symbol is closed. |
Function Details
OnInitialize(double barSize) |
||||||
This function is called when a new bar type instance is created. Parameters
|
OnTick(long tickDateTime, double price, long size, C_TickType tickType) |
|||||||||||||||
This function is called on each new tick of the underlying symbol (see the BarBuilder functions). Parameters
|
OnDataBar(bool isMissing, long startDateTime, long endDateTime, double open, double high, double low, double close, double volume, double openInterest) |
||||||||||||||||||||||||||||||
This function is called on each new OHLCV+OI bar of the underlying symbol (see the BarBuilder functions). Parameters
|
OnSessionClose() |
This function is called when a trading session for the underlying symbol is closed. |