How to close open positions at the end of the day in Range Bars interval

“If we are backtesting an intraday strategy and we do not want to keep open positions overnight - then it’s necessary to force the closing of all open positions before the end of the session”, see

If we choose to use Range Bars we no longer have this Time interval control!

“Range Bars are price-oriented bars, with each bar having a required minimum high-low range. Source data are consolidated into one bar until the range requirement is reached, then a new bar is started”, see AmiBroker Knowledge Base » How to display Range Bars

So, with the absence of this Time interval control, the question that remains is: How to close open positions at the end of the day (for day traders) using Range Bars interval?

Create an auxiliary time control to inform that the end of the day has been reached?

Any suggestions?

Thanks in advance,

Braulio

Hi I suggest you use

Blockquote

ExitatClose = now(4) == “ your exit time”( in timenum format);
// now(4) is system time indapendent to bar timing.

Blockquote