Page 1 of 1
Date comparison
Posted: Dec 14 2020
by kinwai
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”
Re: Date comparison
Posted: Dec 14 2020
by TJ
See post #1 & post #2
viewtopic.php?t=11713
Re: Date comparison
Posted: Dec 15 2020
by kinwai
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”
Re: Date comparison
Posted: Dec 15 2020
by TJ
Please go to wiki and look up the definition of DATE.
There usage examples you can copy.
Re: Date comparison
Posted: Dec 15 2020
by kinwai
Hi TJ, can you show me the wiki link?
Re: Date comparison
Posted: Dec 15 2020
by TJ
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)
Re: Date comparison
Posted: Dec 15 2020
by kinwai
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?
Re: Date comparison
Posted: Dec 15 2020
by TJ
First, you need to study the definition of DATE.
Re: Date comparison
Posted: Dec 16 2020
by kinwai
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.
Re: Date comparison
Posted: Dec 16 2020
by TJ
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.
Re: Date comparison
Posted: Dec 16 2020
by kinwai
Re: Date comparison [SOLVED]
Posted: Dec 19 2020
by masterchanger
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!