- ago
I haven't been able to auto-trade with IB. Opening transactions are working well, however closing transactions can't find the opening as in below pic.

I have tried all sync checkmarks in preferences ON and OFF with no difference.

Note... pic shows 2 opening transactions and 2 closing - with error message . Irrelevant data erased to protect confidentiality

Thank you for any help here


0
1,225
Solved
58 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.94% )
- ago
#1
Hmmm, if you view your Accounts window under tools, do you see the Positions under the IB account? What this is indicating is that WL8 isn't seeing the Positions from IB.
0
- ago
#2
I'll have to run auto-trade again.. Before doing so, is there any requirement for sync options ticked in preferences?
0
Glitch8
 ( 10.94% )
- ago
#3
There're not strictly required, it just depends on what you're trying to achieve. But the troubling thing here is that it looks like WL8 isn't getting the Position updates from IB, that's why I wanted to see if you can see the Positions in the Accounts tool.
0
- ago
#4
Account (ctrl T) shows the open position
0
Glitch8
 ( 10.94% )
- ago
#5
We discovered some latency in the IB Positions updates, and are addressing it in Build 7.
1
- ago
#6
Thank you
0
- ago
#7
I am finding it difficult to have a strategy that places the buy below the last close, and then places a sell signal for profit target, as well as a stop loss (either trailing or just based on the buy signal).
The Buy signals seem to work just fine from Strategy Monitor with auto place, however the sell signals can never work unless the buy actually was filled immediately. The positions can't be found to place the sell.

"Could not find a matching Position to exit."
The back testing mechanism works great... it is the execution against TD Account that isn't working. Or I need guidance to make it work. :-)
Any assistance would be appreciated.
0
Cone8
 ( 24.99% )
- ago
#8
Hi Raude,
Find the example in the QuickRef for AssignAutoStopTargetPrices for setting stop and limit orders on the same bar as the entry.

If you need help with the code, please create a new topic for that, with a name like "How to Program a same-bar bracket exit"
0
MIH8
- ago
#9
Hello mb5413,
Hello Raude,

did you use limit orders or market orders?
0
- ago
#10
@Cone - I will look into your suggestion.
What is weird, I did create a separate topic "problem with Sell after Buy at limit below Close - WL8" - but I gather that is was brought into this one for context.

@MIH - They were limit. Not code - well I tried both. But @Cone has a inside track to get me there. :)

Leveraging the Think-Or-Swim I was able to box the entries needed for satisfaction - with OCO. but that defeats the whole plan. I will investigate the suggestion and then come back.

For others - this also helped.
https://wealth-lab.com/Discussion/Bracket-orders-7419
0
MIH8
- ago
#11
Cone's suggestion may help for your use case.

However, you should keep in mind that once orders are placed, they do not necessarily end up in the portfolio.
This is especially true for limit orders.

At least with IB (mb5431 is using it) there are different views.
A placed order is first parked in the API tab. If the limit is reached, and only then, it will of course end up in the portfolio.

I can't say now what implications this has for sync operations. there are full filled positions (portfolio), partial filled positions (portfolio,parking place), parked orders. This seems to be a difficulty. In some cases this leads to unwanted and difficult to track behavior when sell signals come into play.

I think the WL team already has an eye on this.
1
Glitch8
 ( 10.94% )
- ago
#12
Yes, that’s the complete focus of build 7. Development is complete and we’re testing it all now.
1
- ago
#13
How can I fix this error "Could not find a matching Position to exit." ?

0
Cone8
 ( 24.99% )
- ago
#14
Since you're using Limit exits, you may want to turn on Preferences > Trading > Portfolio Sync > Exit Orphan Positions at Market.

There's a good deal to read about this preference in the User Guide. Basically if a limit exit price is reached, there's still a chance your limit order wont be filled in live trading. This option will exit the position at market - but only at the end of the bar, when this scenario is detected.
0
- ago
#15
I see the issue now - it was a wrong symbol name

0
- ago
#16
What is the reason for this error message? It cannot find a matching position a minute after buying

I tried this already on 2 different symbols

0
- ago
#17
Duplicate topic, why? Appended the post to this thread.
0
- ago
#18
Looks like IB V11 is causing all this issues

0
Cone8
 ( 24.99% )
- ago
#19
In all the blank space in the image, it would have been helpful to see the Accounts tool (Ctrl+T) with IB selected.

For now, I would have expected to see 2 positions. One for ESU22 and another (an artifact) for @ES#C.
0
Cone8
 ( 24.99% )
- ago
#20
In testing this, there's a non-obvious explanation that the Accounts tool would have resolved...

You "Bought" @ES#C and it was filled. Clearly the contract mapping worked. The part we can't see it what's actually in the account. If you had started with a short position, buying the contract "flattened" the account. Consequently there is no "matching Position to exit".

This is actually one area that traders really need to concentrate on when "turning on" an auto trading system. For stop-and-reverse (SAR) systems you should make sure that your account is "in sync" with the strategy. (This is not important for long or short-only strategies, because the current Portfolio Sync functions give you the ability to work with Position already in the account.)

This SAR example is probably the best reason I can think of that a strategy needs visibility into account holdings. Place your vote in the topic starter for this feature request -
https://www.wealth-lab.com/Discussion/Access-Accounts-data-from-broker-programmatically-7914
0
- ago
#21
The current Active contract is now Oct 2022 CLV2 for CL (Crude Oil)



But in my Accounts Window it's jumping to CLU22



and because of this, I am getting "Could not find Position" Errors
0
Cone8
 ( 24.99% )
- ago
#22
I suspect you started with =CLU22

After using the mappings, I've noticed they're cached. To change them, you need to restart Wealth-Lab. I'll call it a bug.
0
- ago
#23
I restarted many times - Still the same error

It's not caching - maybe some of the TXT files I need to adjust
0
Cone8
 ( 24.99% )
- ago
#24
The CLU22 position is in the account, that won't change until you sell it.

The CLV22 position does not exist, so it's correct that it cannot be found.

Edit:
We're going to clean up this 'position artifact' error in IB Build 12. Meanwhile, to get reset, just sell the CLU22 position, and restart Wealth-Lab to get rid of the #C contract.
0
- ago
#25
Where should I sell it? in TWS?

I can not sell it in Wealth-Lab
0
Cone8
 ( 24.99% )
- ago
#26
You can sell CLU22 from Wealth-Lab (or TWS), but you'll be left with QCL#C so you need to restart Wealth-Lab to clear that.
0
- ago
#27
the issue with order manager not finding IB matching position has come up again.

account, symbols and open positions are correct. I had preferences on for OCO, portfolio sync size reduction and full exit. tried unchecking all but continue having order manager problem with IB


0
Cone8
 ( 24.99% )
- ago
#28
I don’t see the problem. The strategy is trying to sell *hypothetical* positions that the Account doesn’t have - you don’t have a live position in GOOG or GS.
0
- ago
#29
the account has both positions open in IB (I have entered a manual order to close)


0
- ago
#30
0
Cone8
 ( 24.99% )
- ago
#31
Are you a single login-multi-linked-IB-accounts user? Because another customer (innertrader) is having trouble with that configuration, and I've thrown in the towel on that since we have no way to test it.

If you're using a single login for 1 account, I'll go out on a limb to say the multi-account scenario is the only way it's possible for WL8 not to get the correct positions from IB Build 12. I verified this over 2 days with more than 2000 trades. It didn't fail even once.

Please don't show me partial images captured at different times. I need to see:
1. Order Manager,
2. the signaling tool, and,
3. the Accounts (with IB only selected) all in one big picture.

After you take that screenshot, and IF Accounts doesn't actually show the positions you own at the IB Account, click the Accounts "Request Updates.." button and see if there's any change. (This should never be required.)
0
- ago
#32
I have multi-account (family setup) access from my IB user id.

Have downgraded to IB B11 and IB is working well again.

I don't think we should limit IB access to single account. Up until B11 it worked well.
TDA is enabled for multi-account access
0
Cone8
 ( 24.99% )
- ago
#33
There's no reason B12 shouldn't work with multiple accounts, but we cannot test it so we don't have any visibility why would not. B11 doesn't work for innertrader's linked accounts, so take that for what it's worth.

I've thrown in the towel and am saying that we do not support multi-accounts for IB. We're not taking any bug reports or otherwise for multiple accounts.

If it's not clear still, the IB Adapter for Wealth-Lab does not support multiple accounts. (But if it works for you, great.)
0
- ago
#34
Does this behavior seem normal to you?

0
Cone8
 ( 24.99% )
- ago
#35
Are you sure IB Build 12 is installed? Check what's indicated on Tools > Home Page > Version Information.
0
- ago
#36
I have the latest build (you know I was looking forward to it...)

0
Cone8
 ( 24.99% )
- ago
#37
You guys keep showing me half the story. I can't tell what's in the account because you're not showing the Accounts tool. It's possible for a "Buy" to Cover and end up with a flat account and then a "Sell" fills yielding a Short Position. We could tell if that were the case by looking at Accounts.

That said, it does look odd to me that the Sell would be place given that "Portfolio Sync could not find a Position".
0
- ago
#38
I show you gladly the Account window

Its Empty - what do you want to see?



0
Cone8
 ( 24.99% )
- ago
#39
Even with that I can't tell if the IB account is selected to view.

Look, the idea is to put all of these windows in one image:
1. Order Manager
2. Accounts
3. Tool that is generating the Alert (Chart or S. Monitor).

Without all the information, I can't help.
0
- ago
#40

QUOTE:
I've thrown in the towel and am saying that we do not support multi-accounts for IB. We're not taking any bug reports or otherwise for multiple accounts.


I struggled during IB B6 with multiple accounts until I found the issue in TWS. Multi-account access has possibilities to allocate trades to sub-accounts . I don't use it but had Account Groups with Allocation Methods on, causing problems. Below pic is what works for me with multi-account access in IB (until B11) - in case others find of use


0
Cone8
 ( 24.99% )
- ago
#41
There's another way we can try to subscribe to Positions, and I'm pretty sure we were using it before, so we'll revert.
0
Cone8
 ( 24.99% )
- ago
#42
Follow up on kls06541's "could not find a Position"...

The Workspace saved the IB Account ID for each of the streaming charts when kls06541 was practicing with a Paper account. Because the Workspace was saved with "Stream" selected , the broker account id is "locked" and doesn't change automatically on connecting with IB.
1
- ago
#43
Confirming IB B13 is working properly with IB multi-account environment. Thank you Cone & WL Team!
1
Best Answer
Cone8
 ( 24.99% )
- ago
#44
Good to know. Some questions -

1. Are your multi accounts "Linked Accounts" or organized some other way, like under a Financial Advisor group?

2. Does the Accounts tool show the correct Total and Cash balances for each account?

3. In the API set up, you said that "Use Account Groups with Allocation Methods" must be unchecked to work correctly, right? Does it still make a difference?
0
- ago
#45
QUOTE:
1. Are your multi accounts "Linked Accounts" or organized some other way, like under a Financial Advisor group?


Master account with access to other Family accounts. Probably similar to FA, however no fees involved and all accounts must have same postal address

QUOTE:
2. Does the Accounts tool show the correct Total and Cash balances for each account?


Accounts tool shows the correct open positions. Total and Cash balances are wrong. I am not using the portfolio sync feature for pos sizing from IB.

QUOTE:
3. In the API set up, you said that "Use Account Groups with Allocation Methods" must be unchecked to work correctly, right? Does it still make a difference?


Account groups lets you group, view positions and trade across multiple accounts in TWS. Since the API doesn't support account grouping, when activated WL's order manager did not report back closed orders and the (1min intraday) strategy would not work properly. This required in turn a fresh start of WL to run properly again.

0
Cone8
 ( 24.99% )
- ago
#46
QUOTE:
Total and Cash balances are wrong.
Are they zero or do they have some non-zero value?

Also, please check the Log Viewer for errors and messages and let me know if you see one with "...[your accoutID] not found..."
0
- ago
#47
The trade is closed along time already

0
Cone8
 ( 24.99% )
- ago
#48
Decimal precision isn't set up correctly since it's only showing 2 decimal places. The problem is that the strategy could be working on 2 decimals when the trade is really 4-decimal precision. As far as the strategy is concerned, the order didn't fill - which is a real possibility any time you use limit orders (although when everything is set up correctly, usually it's the strategy that fills even though the live order did not).

How do you have @BP#C set up in Markets & Symbols?

1
- ago
#49
0
Cone8
 ( 24.99% )
- ago
#50
Hmm, that looks right. Assuming you were using the Strategy Monitor, was "CME ET" selected in the Strategy Monitor configuration for that symbol/DataSet?

... Although I don't think that should matter here. Remind me how you're set up. You're using IQFeed for data, but trading with IB, right? How is the symbol mapped to IB?
0
- ago
#51
99.99% It was set to CME ET

0
- ago
#52
0
Cone8
 ( 24.99% )
- ago
#53
Okay, we'll investigate why that's happening. Don't trade that contract because it appears that the order price is being rounded to 2 decimals.
0
- ago
#54
As always, thank you very much for your patience & support - your help is unparalleled.
1
Cone8
 ( 24.99% )
- ago
#55
This is an IB Adapter bug. It's not setting the Order Decimals correctly and up to Build 20 will almost always use 2 decimals for limit and stop orders. Do not trade any instruments with more than 2 decimals with IB until this is fixed in IB Build 21.
0
- ago
#56
I hope you can have an update soon (not 2 weeks... )
0
Glitch8
 ( 10.94% )
- ago
#57
Thanks for your gracious patience and understanding.
1
Cone8
 ( 24.99% )
- ago
#58
IB Build 22 is ready with the fix.
1

Reply

Bookmark

Sort