Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 03:35:53 +0000



Post From: Spreadsheet System for Trading - Flatten Positions And Cancel Orders At Set Time

[2019-11-23 00:08:19]
Sawtooth - Posts: 4000
To return a particular date, use this function and syntax:
=DATEVALUE("11/22/2019")
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#DATEVALUE_Function

To compare it to the Date in J41:
=INT(J41)=DATEVALUE("11/22/2019")
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#INT_Function

To include it in your example:
=AND(J41-INT(J41)>TIMEVALUE("10:00:00"),J41-INT(J41)<TIMEVALUE("11:00:00"),INT(J41)=DATEVALUE("11/22/2019"))

Note:
J41 contains a number in Serial Date Time format, where the integer is the number of days since 1/1/1900, and the decimal is the portion of a day beginning at Midnight.
=INT(J41) returns the integer of the Serial Date Time value.
=J41-INT(J41) returns the decimal portion of the Serial Date Time value. (You can use the FRACTIME function instead): =FRACTIME(J41)
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#FRACTIME_Function
The DATEVALUE function returns the integer of the Serial Date Time value from a text string of the date.
The TIMEVALUE function returns the decimal portion of the Serial Date Time value from a text string of the time.
Spreadsheet Example Formulas and Usage: Using Date Time
Date Time Of Last Edit: 2019-11-23 13:17:06