Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 18:26:19 +0000



Time Range Formula

View Count: 2428

[2018-05-05 12:48:35]
User172040 - Posts: 70
Hi, I want to test signals only on RTH in the spreadsheet for trading study. I copied your code at this link (Spreadsheet Systems, Alerts and Automated Trading: Limiting Trading to Certain Time Ranges) and dumped it in a open cell in the spreadsheet study (cell P). Please see 'Time Formula' attachment. The code is exactly the same as per link so why do I get a #NAME? error (I did look at the Spreadsheet errors section but in this instance I dont know what the issue is). Cell J41 is the relevant cell for date and time in my sheet.

Then I reference cell P in my 'Buy Entry' (K) column as can be seen in attachment 'Buy Entry'. However, when I run a backtest with the reference to GETTIMEFROMDATETIMEVALUE, I get no signals although after manual inspections, there are clear instances where signals should be given. When I remove the GETTIMEFROMDATETIMEVALUE reference from my 'Buy Entry' column I get my signals again.

Can you please provide some guidance?
imageTime Formula.PNG / V - Attached On 2018-05-05 12:41:22 UTC - Size: 55.01 KB - 417 views
imageBuy Entry.PNG / V - Attached On 2018-05-05 12:41:29 UTC - Size: 65.62 KB - 365 views
[2018-05-05 15:12:40]
Sawtooth - Posts: 4120
The GETTIMEFROMDATETIMEVALUE function does not exist. Use the FRACTIME function instead.
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#FRACTIME_Function
The formula is meant to go in J28.

Here are two more formula examples to disable autotrading using J28:
Spreadsheet Example Formulas and Usage: Disable Trading From Spreadsheet Study for Trading
[2018-05-05 21:26:38]
Sierra Chart Engineering - Posts: 104368
The GETTIMEFROMDATETIMEVALUE function does not exist. Use the FRACTIME function instead.
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#FRACTIME_Function

Yes this is correct. What happened, was the GETTIMEFROMDATETIMEVALUE function was intended to be added at the time the documentation was updated, and then it was later realized that FRACTIME is equivalent and it was not added and we forgot to correct the documentation.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-05-17 14:46:08]
User172040 - Posts: 70
Hi, I set my trade time between 06:30 in the morning and 14:55 in the afternoon. So no new positions are to be taken outside these hours. I tested and this works. However, what I do find is that when I am in a position already, the stop may be triggered outside my trading hours. How do I set my time formulae so that if I still have an active position at 14:55 that all positions will be closed at that time - profit or loss - does not matter

=AND(J8 = 0, OR(FRACTIME(J41) < TIMEVALUE("06:30:00"), FRACTIME(J41) > TIMEVALUE("14:55:00")))

[2018-05-17 14:58:31]
Sawtooth - Posts: 4120
Use this in J29:
=FRACTIME(J41) >= TIMEVALUE("14:55:00")

The flatten time in J29 should always be >= the latest time in J28.
[2018-05-17 18:30:54]
Sierra Chart Engineering - Posts: 104368
Here is the documentation for the Flatten and Cancel Spreadsheet cell:
Spreadsheet Systems, Alerts and Automated Trading: Flatten Position and Cancel Working Orders [J29]
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2018-05-17 18:31:09

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account