Strategy on specific day


Category:
0
0

Hello,

I was wondering if it was possible to execute a strategy on a specific day of the week.  If I only want my strategy to backtest trades on say Tuesday vs all market hours, is this possible?  I have played around with thinkscript and so far I have not found a solution.  Thanks

 

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on December 22, 2018 1:07 pm
55 views
0
Private answer

For this we can use a function named “GetDayOfWeek()”. Get details here: http://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Date—Time/GetDayOfWeek.html

You did not provide an code so the only thing I can offer is to show you how to use that function to create a true/false variable you can use to filter when your strategy can post a theoretical order to the chart.

def onlyTradeMondays = GetDayOfWeek() == 1;

 

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on December 23, 2018 1:36 pm