Navigation: Realtest Script Language > Script Sections > Data Section >

Bar-Size-Specific Items

 

 

 

RealTest supports multiple bar sizes (periodicity) at the test/scan level, the data calculation level, and the data item reference level.

 

In the Data section, the name used for a data item can also determine the bar size with which it is calculated. Specifically, if the item name begins with the name of a bar size ("Daily", "Weekly" or "Monthly"), that item is automatically calculated using those size bars.

 

Here is a very simple example:

 

 

The first item, MA20, will be calculated using whatever the current global bar size setting is.

 

The second item, DailyMA20, will be calculated as a 20-day average, regardless of the current global setting.

 

The third item, WeeklyMA20, will be calculated as a 20-week average, regardless of the current global setting.

 

It is important to understand that each data item is STORED in the bar size with which it is calculated. So for the Weekly item, there is only one value per week in memory.

 

It is not possible to convert a data section item to a different timeframe. However, there is no limit to what can be done with regard to timeframe in the data section.

 

Examples:

 

WeeklyMA20D: Extern(~Daily, MA(C,20)) // calculates a 20-day average once a week (Friday)

DailyMA20W: Extern(~Weekly, MA(C,20)) // calculates a 20-week average (using weekly bars) for each day (will be the same for 5 days in a row)

 

The key point to understand is the distinction between (a) the frequency with which the calculation is made and (b) the bar size used to make it.

(a) is determined by the current global bar size setting (the default) unless overridden by the word at the start of the data item name

(b) is determined be these same criteria as well, unless overridden by using the Extern function to refer to a different bar size

 

If you try to access a higher-timeframe data item for a date which is not its end date, NaN is returned.

 

Note that in higher timeframes, the bar date is always the last day of the bar. In weekly bars, for example (excepting holiday weeks), the open is Monday's open, the close is Friday's close, and the date is Friday's date.

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC