What data type is a bar?
Author: dhirsch
Creation Date: 9/16/2009 12:15 AM
profile picture

dhirsch

#1
I am fairly new to Wealthlab Pro. I wish to create a function to evaluate a bar (creating a function so I can re-use the code). But, in declaring the function I must identify the variable I am passing to it.

public bool CandleStick_Eval( [bar type?????] bar_eval ) {

The data I wish to pass to the function is a single bar. Bar has various definitions, such as Close and Open. The problem I'm having is I do not know what datatype to declare for the bar variable that I wish to pass to the function. Any advise or direction is appreciated.

Thx,
Dave
profile picture

Eugene

#2
The Bars class, along with some methods, mechanisms (e.g. Bars.Cache) and custom data series, contains a collection of DT+OHLCV values.

1. If your function is called inside the main (trading) loop:

Pass the whole Bars object and the bar number (e.g. i) to your function, then get the associated OHLCV values on that bar by using the indexer:
CODE:
Please log in to see this code.

2. If your function is designed to work outside of the main (trading) loop:

Pass the whole Bars object and the bar number to your function, then loop through the collection to get associated OHLCV values on that bar.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).