EasyLanguage Time and Date reserved word

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 trades for 1 hour.

EasyLanguage Time

TradeStation and MultiCharts in EasyLanguage and PowerLanguage using a numeric format of HHMM. If you want the system to start 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 there is a time zone that changes in summer and winter many times in the year. 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 your time zone change in the summer, but the NY Time doesn’t change? It happens that you open at the wrong time.

Change time exchange in tradestation

EasyLanguage Date

TradeStation and MultiCharts using the same date format: YYYY-MM-DD. 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, 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 this information with EasyLanguage are:

  • SessionStartTime(1,1)
  • SessionEndTime(1,1)