RealTest User Guide
RealTest User Guide

 

 

Navigation: Realtest Script Language > Syntax Element Details >

UntilEvent

 

 

 

 

Category

General-Purpose Functions

Description

Number of market days from the current bar until the next instance of an event of the given type

Syntax

UntilEvent(type)

Parameters

type - event type number (same numbering used with Event)

Notes

Returns 0 if an event of this type falls on the current bar, 1 if the next is on tomorrow's bar, and so on. Returns -1 if no future event of this type exists for the current symbol.

Conceptually equivalent to UntilTrue(Event(type)), with one critical difference: UntilEvent reads the underlying event list directly, so it sees events dated after the last imported bar.

This makes the function suitable for live order generation: it can report, for example, "7 market days until the next earnings release" when the release date is published in the Event List File but lies past the most recent price bar. UntilTrue cannot do this because it only looks at loaded bar data.

For events that have already occurred relative to the current bar, use Event(type) directly, or Event(type, 1) to get the most recent value.

Example

DaysToEarnings: UntilEvent(1)
SkipNearEarnings: DaysToEarnings >= 0 and DaysToEarnings <= 3

Avoid taking new positions within three market days of a scheduled earnings release.

 

 

 

Copyright © 2020-2026 Systematic Solutions, LLC