Navigation: Realtest Script Language > Syntax Element Details >







Bar Data Values


The number of bars remaining before the end of data for this symbol


BarsLeft is 0 for the last bar, 1 for the next-to-last bar, and so on.

This can be used in the EntrySetup formula to avoid entering positions in stocks that will soon be delisted. RealTest will automatically exit any position that remains open on the last data date (or last date of a test) at the close of that bar, so it is not necessary to use BarsLeft unless you want to be sure to exit before the last date.

BarsLeft can also be useful when modeling futures rollovers using individual contract data.




Copyright © 2020-2024 Systematic Solutions, LLC