Login Page - Create Account

Support Board


Date/Time: Sat, 11 May 2024 02:53:03 +0000



[Programming Help] - Auto trading spreedsheet start at 0731, stop at 1300, resume 1301 and flatten at 1500

View Count: 635

[2019-08-26 05:12:33]
batman_ - Posts: 190
Dear SC,

Kindly advise how to set auto trading spreadsheet to start at 0731, stop at 1300, resumes at 1301 and flatten at 1500?

In sierra chart website, i found the below instruction but it is without break lunch at 1300.
J28=OR(J41-INT(J41) < TIMEVALUE("07:31:00"), J41-INT(J41) > TIMEVALUE("15:00:00") )
J29=(J41-INT(J41)) > TIMEVALUE("15:00:00")
Date Time Of Last Edit: 2019-08-26 05:13:07
[2019-08-26 05:23:16]
Sawtooth - Posts: 3995
Here's an example for J28:
https://www.sierrachart.com/index.php?page=doc/SpreadsheetExampleFormulasAndUsage.php#DisableTradingOutsideOfRegularTradingHoursAnd2HoursMidday
This example also references J8, which allows exits outside the time window.

You can use FRACTIME instead of J41-INT(J41)
J29:
=FRACTIME(J41)>TIMEVALUE("15:00:00")
[2019-08-26 05:58:17]
batman_ - Posts: 190
Hi Tomgib
Thank you for your replied.

I try the below instruction for J28 and J29 but;
a) it starts at 0731 but it does not flatten position at 1259?
b) it does not resume trading at 1301 and but it does flatten at 1500?

J28=AND(J8 = 0, OR(OR(FRACTIME(J41) < TIMEVALUE("07:31:00"), FRACTIME(J41) > TIMEVALUE("15:00:00")), AND(FRACTIME(J41) > TIMEVALUE("12:59:00"), FRACTIME(J41) < TIMEVALUE("13:01:00"))))

J29=FRACTIME(J41)>TIMEVALUE("15:00:00")


Kindly advise accordingly. TQ
Date Time Of Last Edit: 2019-08-26 05:58:55
[2019-08-26 13:38:10]
Sawtooth - Posts: 3995
a) it starts at 0731 but it does not flatten position at 1259?
Try this in J29:
=OR(AND(FRACTIME(J41)>TIMEVALUE("12:58:59"),FRACTIME(J41)<=TIMEVALUE("12:59:01")),FRACTIME(J41)>TIMEVALUE("15:00:00"))
You might need to widen the window at 12:59 if there is no chart update within it.

b) it does not resume trading at 1301 and but it does flatten at 1500?
The J28 formula does not disable autotrading between 13:01 and 15:00 so there must be another reason.
To verify this, scroll the chart to a time between 13:01 and 15:00 and go to Chart >> Replay Chart, and note that the condition of J28 is 0.

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

Login

Login Page - Create Account