Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 21:32:24 +0000



[User Discussion] - Exiting Trade Automatically Before the Close

View Count: 1157

[2015-01-12 14:05:47]
infpz - Posts: 826
My question is in regards to setting up an "exit on close" parameter for orders being created while autotrading using the Excel spreadsheet study.

First I have my charts set to market hours for the markets being traded (ie 9:30-16:00)

A.) I am using the Time Range Highlight study to attempt to accomplish an exit on close. The settings I use on the study are "start time: 16:00 / end time: 9:30 / display forward projection: no".
B.) I will reference the TRH study for both entry and exit parameters including it in an AND function with the logic being for ENTRY: TRH=0 and EXIT: TRH>0 as the study registers a 0 when the Highlight condition is negative and a larger than zero number when the condition is true.

I believe I have the logic correct however I still get "overnight holds" (i.e. exit at 9:30am the next day) when backtesting.

Any thoughts or suggestions are appreciated.

[2015-01-12 22:28:56]
Sawtooth - Posts: 4141
Use cell J28 to disable autotrading outside of regular hours, like this:
=OR(J41-INT(J41)<TIMEVALUE("09:30:00"),J41-INT(J41)>TIMEVALUE("16:00:00"))

Use cell J29 to flatten at a certain time, like this:
=J41-INT(J41)>TIMEVALUE("16:00:00")

You might want to use an end time of 15:59:00 instead, if you must be flat by 16:00:00.

Here are more examples for additional situations:
http://www.sawtoothtrade.com/example-4.html
Date Time Of Last Edit: 2015-08-14 02:17:39

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

Login

Login Page - Create Account