I have a simple strategy that follows an indicator and enters long/exits short if the indicator crosses above, while it would exit long and enter short when the indicator crosses below. The strategy was put together by the wizard and works as expected on historical backtest.
I tried it with the real-time simulation account, too (connecting to IB) and observed the following flaw in order execution:
- entered long with 222 shares at the signal. Order quantity is set by account size in the strategy.
- at the turn of the signal, I had a Close position for 222 alright, but my short wasn't 222, it was 445 instead. Looks like the quantity was calculated with double the account size or something.
- this happens at every turn, so my position size is ever increasing until the entire account is exhausted.
What am I doing wrong?
Comment