Adding a time of day condition to pairs trading system?
Author: pat469
Creation Date: 7/27/2010 1:54 PM
profile picture


I am attempting to break up over time the executions for a pairs strategy. I am currently running daily bars, with the signal generated at the Open. For each signal, I reverse the positions, meaning if short I cover and then go long the same stock and do the opposite for the existing long position. Currently, existing positions are closed out at the Open and new positions are initiated at the Close. I would like to change this to close out positions over 10 or 20 ten-minute bars after 930am and initiate new positions over 10 to 19 of the remaining ten-minute bars while still getting the signal at the Open. (I may try other bar lengths as well.) I believe I need to use SplitPosition and SetScaleDaily with ten-minute bars, but haven't been able to figure it out, especially with two existing positions. Can you point me to any example code that has done something similar? Any help is greatly appreciated. Thanks very much.

Please log in to see this code.
profile picture


So you're converting to intraday data? In this case, why not add a time of day condition:

How do I code a rule for time of the day? (closer to the end of the document).
profile picture


I will try that. Thank you.