In this EasyLanguage & PowerLanguage Tutorial, we’ll talk about the EasyLanguage Time and Date reserved words. This tutorial can also be studied by PowerLanguage & MultiCharts users.
In many trading systems, you need to know the Date and Time.
For example, you are developing a strategy that starts only after 4 p.m. and that trade for only 1 hour.
TradeStation and MultiCharts in EasyLanguage and PowerLanguage using a numeric format of HHMM. If you want that the system starts to trading at 4 p.m. you need to write this in your code using HHMM, the result is “1600”.
To print the Time, only write Plot1(Time);
The output will be the time of your zone because to default the TradeStation uses the Local Time. To work well, you should use the exchange time.
Consider that many times in the year, there is a time zone that changes in summer and winter. You wrote “1600” because you want to open positions only after an hour has passed since the opening bell of Wall Street.
What’s happen if you use local time and in the summer your time zone change but the NY Time doesn’t change? It happens that you open at the wrong time.
TradeStation and MultiCharts using the same date format: YYYMMDD. If you want to insert the date May 25, 2008, you can write 1080525.
Another example for the past date, if you needed to write on June 10, 1997, you can write 970610
Want to know the day of the week on this date? It’s simple, just write: DayofWeek(970610);
This reserved word will return a value for the specific date:
- 0 – Sun
- 1 – Mon
- 2 – Tue
- 3 – Wed
- 4 – Thu
- 5 – Fri
- 6 – Sat
EasyLanguage Time and Date – Session Time Information
When the market opens, the session starts. You can modify the session in the charts with TradeStation and MultiCharts.
The reserved words to access to this information with EasyLanguage are: