Date comparison  [SOLVED]

Questions about MultiCharts and user contributed studies.
kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Date comparison

Postby kinwai » 14 Dec 2020

In Hong Kong market, the market close time became 1630 after 25 Jul 2017, before that was 1615, the logic likes:

if date >= “20170725” then
close_time = “1630”
else
close_time = “1615”;


How can I set the date format for date comparison in backtest? I tried the below function but doesn’t work.

FormatDate("yyyyMMdd", ELDateToDateTime(currentdate))} >= “20200725”

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Date comparison

Postby TJ » 14 Dec 2020

See post #1 & post #2
viewtopic.php?t=11713

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: Date comparison

Postby kinwai » 15 Dec 2020

In Hong Kong market, the market close time became 1630 after 25 Jul 2017, before that was 1615, the logic likes:

Code: Select all

if date >= “20170725” then close_time = “1630” else close_time = “1615”;
How can I set the date format for date comparison in backtest? I tried the below function but doesn’t work.

Code: Select all

FormatDate("yyyyMMdd", ELDateToDateTime(currentdate))} >= “20200725”

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Date comparison

Postby TJ » 15 Dec 2020

Please go to wiki and look up the definition of DATE.

There usage examples you can copy.

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: Date comparison

Postby kinwai » 15 Dec 2020

Hi TJ, can you show me the wiki link?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Date comparison

Postby TJ » 15 Dec 2020

Hi TJ, can you show me the wiki link?
Go to the top of this page,
Look for the SUPPORT tab,
put your mouse over the tab,
a new window will show up.
The 4th heading from the left is "Online Help & Wiki"
https://www.multicharts.com/trading-sof ... /Main_Page

Go to #8 in the table of contents
8 PowerLanguage Keyword Reference

Look under:
Data Information/General‎ (77 P)

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: Date comparison

Postby kinwai » 15 Dec 2020

Hi TJ,

Thanks for your information, I have checked the page of both “Data Information/General (77 P)” and “Date and Time Routines (55 P)”, the example is quick simple, I cannot find any example of date comparison, may I check if anything I missed?

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Date comparison

Postby TJ » 15 Dec 2020

First, you need to study the definition of DATE.

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: Date comparison

Postby kinwai » 16 Dec 2020

Hi TJ,

I have already studied the function of DATE from "Date and Time Routines (55 P)”, the example is quite simple, don't mention any comparison scenarios.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Date comparison

Postby TJ » 16 Dec 2020

Hi TJ,

I have already studied the function of DATE from "Date and Time Routines (55 P)”, the example is quite simple, don't mention any comparison scenarios.
Study again.

Go to #8 in the table of contents
8 PowerLanguage Keyword Reference

Look under:
Data Information/General‎ (77 P)


Please go to wiki and look up the definition of DATE.

kinwai
Posts: 89
Joined: 03 May 2019
Has thanked: 12 times
Been thanked: 1 time

Re: Date comparison

Postby kinwai » 16 Dec 2020


masterchanger
Posts: 36
Joined: 03 Sep 2013
Location: Chicago, IL
Has thanked: 14 times
Been thanked: 12 times

Re: Date comparison  [SOLVED]

Postby masterchanger » 19 Dec 2020

Hi Kinwai,
Your code doesn't follow the proper format for date.
It's in the definition and examples are provided.
Check it again and change your code to conform to the proper format.
I'm sure it will work out after you do that! :)


Return to “MultiCharts”