Sell signals not flowing to IBController

I am using a paper trading account with IB at the moment. My buy signals appear in IBController and get executed in IB. If I have an open position, another buy signal does not trigger another order which is what I want. However when a sell signal is triggered, although it appears in the Amibroker scan window it does not flow into the IBController and then onto IB. The sell code is a simple MA cross. Part of my code is set out below. Can you please tell me what I am doing wrong. I think I have read every thread on this topic.


In your code ibc.GetPositionSize("GBP.AUD") would give you zero ALWAYS because it is not correct symbol (not the whole symbol).


ibc.GetPositionSize("GBP.AUD") > 0

check will never be true.

To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?

It is important to note that GetPositionSize is not immediately updated by TWS (they send update only once per second or so).