Login Page - Create Account

Support Board


Date/Time: Sat, 04 May 2024 00:06:52 +0000



[User Discussion] - Market on close orders with automated trading

View Count: 2411

[2017-09-28 22:09:44]
GiantAvocado - Posts: 67
I can't seem to find any info on how you would program a 'market on close' for spreadsheet automated trading (day trading); please guide me in the right direction, thanks...
[2017-09-29 17:00:19]
Sierra Chart Engineering - Posts: 104368
You would need to write a formula that makes reference to the cell containing the last bar end Date-Time in order to trigger an order at the appropriate time. Refer to:
http://www.sierrachart.com/index.php?page=doc/SpreadsheetSystemsAlertsAndAutomatedTrading.php#CellJ41_LastBarEndDateTime
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: 2017-09-29 17:01:26
[2017-10-06 16:12:34]
GiantAvocado - Posts: 67
I have entered formulas in L3 (Buy exit) & N3 (Sell Exit) respectively as;

L3 - =and($J$8>0,$J$41 = $J$76)
N3 - =and($J$8<0,$J$41 = $J$76)

$j$41 & $J$76 are set to same number format - (Time) only;

Additionally:
Cancel all working orders on exit is set to 'true'; also tested with 'false' with no change;

I have done 'auto trade system bar backtests' and cannot get a closed open position on market close (ESZ7 @ 16:14:59).
Is there something else I am missing?
[2017-10-06 18:28:57]
Sierra Chart Engineering - Posts: 104368
$J$41 = $J$76
This type of comparison is going to be imprecise. For a way to do this, refer to:
Spreadsheet Functions: Serial DateTime Values
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
[2017-10-06 21:30:48]
Sawtooth - Posts: 3993
In addition to the imprecision of DateTime values, there are other considerations:
1) J41 does not necessarily update every second.
2) The Time number format of a cell does not affect the underlying DateTime value.
3) An order at the last second of the day may not execute before the day's close.

Ignoring #3, I would use formulas like these, which gives a 2 second window from 16:14:58 to 16:15:00:
L3: =AND($J$8>0,$J$41-INT($J$41)>$J$76-INT($J$76)-1/86400,$J$41-INT($J$41)<$J$76-INT($J$76)+1/86400)
N3: =AND($J$8<0,$J$41-INT($J$41)>$J$76-INT($J$76)-1/86400,$J$41-INT($J$41)<$J$76-INT($J$76)+1/86400)

Here's another way to do it, without referencing J76:
L3: =AND($J$8>0,$J$41-INT($J$41)>TIMEVALUE("16:14:58"),$J$41-INT($J$41)<TIMEVALUE("16:15:00"))
N3: =AND($J$8<0,$J$41-INT($J$41)>TIMEVALUE("16:14:58"),$J$41-INT($J$41)<TIMEVALUE("16:15:00"))
Using the above, it would be easier to adjust the time window, to account for #3, either wider or earlier or both.
[2017-10-07 16:36:54]
GiantAvocado - Posts: 67
tomgilb; thanks a lot for the help; I finally settled on these formulas for now;

L3 =AND($J$8>0,$J$41 > (Int($J$41) + TIMEVALUE("16:10:00")))
N3 =AND($J$8<0,$J$41 > (Int($J$41) + TIMEVALUE("16:10:00")))

for now & for testing I just want to be out before the close. I think my problem is that I use a 2t Renko chart and the times are updating in the spread sheet at the end of each renko bar, these can be very long, If this is true I may add 1M chart to reference for time. With this scenario I need to add, in the 'buy entry & sell entry' columns, not to trade after 1600; Still working this out. Much appreciated!

Steve
[2017-10-26 14:44:25]
vectorTrader - Posts: 86
Is there a way to incorporate and simulated ordered at close instead of the next bar open? I asked as I am testing my strategy on daily historical bars. In CL, the close appears to be the 14:30 EST settle and the next bar open appears to be the globex session open. Since my strategy is based on the 14:30 EST, I would like to simulate fill there rather than the next bar open. IS there a way to do that in ASCIL?

TIA
[2017-10-27 23:00:47]
User29926 - Posts: 92
Is there a way to incorporate and simulated ordered at close instead of the next bar open? I asked as I am testing my strategy on daily historical bars. In CL, the close appears to be the 14:30 EST settle and the next bar open appears to be the globex session open. Since my strategy is based on the 14:30 EST, I would like to simulate fill there rather than the next bar open. IS there a way to do that in ASCIL?

jbutta, it would be best if you create your own support thread relating to your question.
[2017-10-30 15:36:45]
GiantAvocado - Posts: 67
To do this on historical daily bars seems hard to do; I would create daily bars with intraday data then you could get your trade closed at or near the close. If CL RTH session is say 0800 to 1430 that is 390 minutes; make 390M bars; create your system in a spreadsheet automated trading and trigger your close out off cell J41; J41 is the timer of the current bar (called Last Bar End Date Time) similar to what I have been doing above; I haven't checked yet but I am sure you can reference that from ACSIL too.

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

Login

Login Page - Create Account