Profile Picture

Close and open position on same (next day) bar

Posted By k2trade Last Year
Posted Wednesday May 11 2016
So, I have my first strategy in RE coded and I am in the middle of backtesting.  The strategy  trades a relative strength custom indicator with SPY as the underlying index....all EOD.  The issue I run into is after several months/weeks of trading, I have multiple positions open with cash near zero.  That is fine, until I receive a sell signal and buy signal on the same bar.  I close the "sell" position at the next day's open, but RE does not recognize that I now have a cash balance, albeit available via temporary margin.  As a result, the "buy" signal does not open until the next bar (day).  I would very much like to close a position and open on the same bar the day after both the buy and sell signals are received. 

Unfortunately, I do  not  yet understand Position Manager enough to know if  I can essentially sell one position at the  open, update available capital to  reflect this sale, and then open a  new position with  the proceeds on the  same bar.  

Any help is much appreciated.

Edited: Wednesday May 11 2016 by k2trade
Posted Thursday May 19 2016
Hmmm...  Can someone at least tell me if I can post this elsewhere to get some assistance? 

I'm starting to think I may need to write my own paper broker to fix this.  Is the RE paper broker code available anywhere such that I do not have to start from scratch?
Posted Friday May 20 2016
Try this

Posted Saturday May 21 2016
Try setting your account margin factor to > 1. Otherwise you can't open positions until the next bar which is after you've exited the closing positions.

Similar Topics

Reading This Topic

2005-2017 © RightEdge Systems