Profile Picture

Position Management issue

Posted By Trader Naum Last Year
Message
Posted Saturday August 13 2016
I encountered an interesting problem with RE. I used the basic cross over system that is shipped with RE (SMA 50 crossing SMA 200) and ran it against SPY. It worked as expected  for 2 round trips and then didn't execute buy orders on 4 occasions with the following logged message:
Unexpected order cancel: OpenPosition: 5: Market Buy SPY 0/958 - Rejected - Open Position Not enough cash to fill order. Resulting cash would be -65.9240999999893. The current account value is 125020.5559. The current minimum cash is 0. 

Of course, there's plenty of cash to buy. If I adjust the Position Management allocation in System settings to 99% rather than 100%, then all is fine. Shouldn't RE be smart enough and buy as many stocks as needed as long as there's cash to buy at least 1?

Thanks!
Posted Sunday August 14 2016
What's happening is that RightEdge calculates the position size based on the current price at the end of a bar, and submits an order for that size.  It doesn't know what price it will actually be filled at.  During the next bar, the paper broker tries to fill the order at the now-current price, which can be different than what was used to calculate the order size.  If the required cash to fill the order has gone up, this can result in there not being enough buying power to actually fill the order.  Usually this is by a small amount, in the error you pasted it was off by about $66.

To avoid hitting this issue, you can either set up your system to use slightly less than 100% of the available buying power, or you can set the Account Margin Factor in the paper broker settings to slightly over 1.  Setting it to 1.05 would allow the system to go 5% over.

Thanks,
Daniel
Posted Sunday August 14 2016
Got it, thanks!


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems