I’m using the Portfolio Trader, and want to close a strategy before close of RTH session (4 pm EST). I’ve read through just about every thread on it, and I’m using the code below. But because my strategy runs on 15 min. candles, the order to close gets sent at exactly 4 pm – and hence into the after-hours market. Which wouldn’t be a big deal (the securities I trade have a lot of volume during AH), but it makes it impossible to close on time on Fridays.
My thinking here is that I could use a data2 feed with a lower time resolution (let’s say, 1 min.), and use that feed as the time trigger for closing all positions. But I’m unsure how to do that, or if it’s even a possibility.
Code:
Code: Select all
[intrabarordergeneration = False]
input: TimeClosePosition(155800);
if (currenttime_s > TimeClosePosition) then
Begin
sell ("EOD_LX") this bar on close; %is this where specifying data2 feed would make sense?
buytocover("EOD_SX") this bar on close;
End;