I don’t understand what’s going on. I have a max forex limit of 5 mini lots (50000 shares). GREEN FOREX balance was zero, then purchased 40000 shares, still under my limit. Then it starts to sell them at 10000 per trade. But scaledQuant goes to 2537, not 10000. Now I’m out of sync again. What gives?
Here’s more evidence of the problem. This morning I was short 80K of GBP.USD. All positions had been opened by C2 and my software had auto-placed them. I did no manual orders so there should not have been any out-of-sync issues.
At 3pm MT today GREEN FOREX began closing out the positions in increments of 10K. The first 5 worked fine but the last 3 didn’t. C2 started scaling the quantities higher. The 6th trade covered 10,769 and the 7th trade covered 11,598. The signal failed to come for the 8th trade leaving me out-of-sync by 7633. I manually covered that amount and then unsubscribed from the system.
This all happened using protocol 8.2. (Protocol 10 has a different but worse problem) Even though I had a max forex limit set at 50000, C2 ignored it and continued to send the signals. That’s why I was short 80K and not 50K. I had already reported that problem separately but I’m stating it again because I believe the two are related.
When you see weird quants like that in closing trade signals, it means your program has reported weird quantities to C2 as the quantities it has opened.
The thing to note is that C2 calculates closing trade signals on a percentage basis. It will send you the opening trades based on the quantity the vendor recommends, combined with your scaling preference, but when it comes time to send closing trades, it basically does the following (for example): "Ah, the system wants to close 50% of its position. What quantity has Greg reported as confirmed opened? 120,000? Then I will send a closing trade signal of 60,000 quant."
When I look at the database, I see some weird stuff in terms of quantities you have reported to C2. Your custom software acknowledged receiving 130,000 quantity worth of signals. But it also acknowledged filling 162,367 quantity. That’s obviously a pretty strange quantity, both in the sense that it doesn’t seem like a real “forex” quantity (which ought to be increments of 10,000) and also because it doesn’t actually correspond to the signals you were sent.
I can only surmise that there is some weird thing going on where your program reacts to messages from your broker more than once (or perhaps your broker sends the messages more than once, perhaps at reconnect or daily shutdown?) In any case, I can’t really diagnose much more than this, given the information I keep on my side, but I think this may be a useful clue for you to use to track down the issue on your side.
All I do is convert your scaledQuant text field that I receive from C2 to an integer, like this:
mmOrder.m_totalQuantity = Integer.valueOf(sp.scaledQuant);
the m_totalQuantity field is IB’s field for placing the order. If the numbers being placed are weird, its because that’s what I’m getting from C2. When you say I acknowledged 130,000 quantity worth of signals, are you using the scaledQuant, or the originalQuant? They should be the same because I was trading GREEN FOREX at 100% but I have seen them NOT the same. I think your code for the max forex limit (because I have that set to 5) is affecting your scaledQuant field when my understanding is that it shouldn’t.