Login Page - Create Account

Support Board


Date/Time: Sun, 06 Jul 2025 05:41:22 +0000



Post From: Help: Time within Bar

[2019-03-15 14:14:37]
rahul - Posts: 173
So if a bar is not complete, will sc.BaseDataEndDateTime[] give me time latest time, if I set the data storage unit to 1 second? Will this even work in backtesting?
In that case, will this work?

Time Elapsed = sc.BaseDataEndDateTime[sc.Index].GetTime() - sc.BaseDateTimeIn[sc.Index].GetTime();

The problem is I have multiple contract order fills at the close of a bar... to avoid a lot of slippage I want to close the trades at 5 second intervals prior to bar close
Suppose I have 3 contracts and its a 1 minute bar.
If Bar Open = 9:30am and next Bar Open = 9:31am, I want trades to occur at 9:30:50, 9:30:55 and 9:31am respectively