What does ConvertDateToBar return with exactMatch = true yet exact date is not located?
Author: 4estCapital
Creation Date: 10/7/2015 7:33 AM
profile picture

4estCapital

#1
Hi,

The synchronization of bars between applications (on my end) and the wealth-lab becomes serious issue when the scale of strategies narrows down to intraday bars.

In that sense, I happen to use ConvertDateToBar function extensively while compiling my strategies.

So, my curiosity:

What does ConvertDateToBar returns when exactMatch is set to True yet exact date is not located?

I did not come up with a decent answer on wealthscript manual, and did not find anything related in the forum as well. And, the quickref also fell short of answering this question:

Thanks in advance for your help,

Aykut Sarıbıyık

QuickRef defines this function as follows:
QUOTE:


ConvertDateToBar

int ConvertDateToBar(DateTime date, bool exactMatch);

Returns the bar number that matches the DateTime provided in the date parameter. If exactMatch is true, the precise DateTime value must be located in the Bars object. Otherwise, the first bar whose DateTime is greater than or equal to the specified date is returned.

profile picture

Eugene

#2
Hi,

I believe that it should return -1.
profile picture

LenMoz

#3
CODE:
Please log in to see this code.
profile picture

4estCapital

#4

Thank you both.

Kind regards,

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).