OmniTrader Professional Forum - OmniTrader Pro Technical Support
TMS Trade Plan Error

^ Top
James S

Posts: 62

Joined: 6/21/2007
Location: Dorset, England

User Profile
 
Subject : TMS Trade Plan Error
Posted : 7/27/2021 5:54 AM
Post #31538

Using the new TMS profile with IB and OT is not able to handle the partial exit trade plan.

OT is able to sell the correct amount of shares in IB so that 25% of the position remains, however the next day when I run the 'To Do List', I get the following error:

'Trade Plan for Symbol does not match the quantity with the brokers position. Please re-apply a trade plan'.

The trade then needs to be manually managed until exit which could be weeks later, far from ideal..

Attached file : TMS Trade Plan Error.jpg (584KB - 283 downloads)

^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/27/2021 1:33 PM
Post #31539 - In reply to #31538

James

FWIW

Using OT PR2H with AT running live automated trading with IB connected. NOT TMS profile but a personal highly adapted version of RS Boost (where I added T21 in it's own market state among other customizations)

After looking at the TMS video where Jeff described the positive difference the partial exit TPs made I looked at my live trading profile and changed some of my trade plans to do just that. There have been at least 10 trades where it has come into play (75% exited, 25% remained) and OT/AT/IB are all handling it perfectly. Some trades still in play, a few the 25% exited. All according to the TP. NO errors
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/27/2021 1:39 PM
Post #31540 - In reply to #31538

Also FWIW

Instead of manually managing the trade for those orphan 25% trades right click on the blue "L" on the RH edge. You can remove or edit (possibly fix - maybe just #shares is messed up?) the TP that is there (if it still is) or remove and apply a new TP - one that matches the step in the original TP (with FL and trailing profit stops). Then OT/AT will manage it from there on like normal
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/27/2021 1:57 PM
Post #31541 - In reply to #31540

Hi Buffalo

It’s my guess that some order types are more reliable than others for trade plans that do scaling in and out. I’m wary of Limit and StopLimit orders since they could get partial fills that the TP would not know about and be unable to properly manage. My testing has seen some really wierd results occasionally - even some cases where the position reversed itself.

What order types are you using?

And, do your TP’s mix scaling-in with partial exits - with the possibility of Adds in mid-trade after a prior PExit?
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/27/2021 3:10 PM
Post #31542 - In reply to #31541

Hi Jim

What order types are you using? - All Market orders

And, do your TP’s mix scaling-in with partial exits - No scaling IN

...with the possibility of Adds in mid-trade after a prior PExit? - Nope

So relatively simple partial exits - 75% out at some predetermined profit level (different on different strats) w/ a Market order, 25% trailed and out with market order too. But good testing and real world results (so far)

Hope you're doing good!


^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/27/2021 4:44 PM
Post #31543 - In reply to #31542

Thanks!

Advice re scaling in, if anyone needs it - as long as you do it before any PExits, it’s relatively easy to manage in a TP.

Afaik, from my tests, Market, StopMarket, or MOO overnight are safe and reliable.

StopLimit and Limit orders are dangerous due to potential partial fills.

^ Top
James S

Posts: 62

Joined: 6/21/2007
Location: Dorset, England

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/29/2021 2:51 AM
Post #31544 - In reply to #31539

Hi Buffalo,

That's interesting to hear. I'm also on PR2H but the trade plan is not working for me.

Any chance you can post your trade plan that is working?

Thanks

James
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/29/2021 9:29 AM
Post #31545 - In reply to #31544

James

Here is a pic on a trade which exited the 75% now trailing the remaining 25%.

It has a custom OL FL stop which makes no difference for what you're asking - replace it with standard FL

EDIT while I was putting this together I got an exit on a different partial exit TP from a different strat. It was in at $94.17, 75% exit at $95.07 (1%) the next day then 25% exit 3 days later at $99.6 (5.75%)
Attached file : Partial exit TP.png (448KB - 303 downloads)

^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/29/2021 10:26 AM
Post #31546 - In reply to #31545

Buffalo -

Pleased to see that all the SuperStop work is paying off!
^ Top
James S

Posts: 62

Joined: 6/21/2007
Location: Dorset, England

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/30/2021 4:53 AM
Post #31547 - In reply to #31545

Thanks Buffalo.

I can't see any difference between your trade plan and the one I am using, however I have had the error on all 6 trades that have exited 75%.

I'm at a loss to explain it..

James
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 7/30/2021 8:59 AM
Post #31548 - In reply to #31546

Jim

I have found the ATR tightening part to work very very well!
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 8/5/2021 9:30 AM
Post #31549 - In reply to #31538

James
OK had this error happen to me last night on 3 positions that had exited the 75% and was tracking the 25%.

What changed? Before yesterday I set AT to run in the AM before market opened. Yesterday I set it to run in the PM after mkt close. Then I got these errors at 4 am long after the run was completed. At 3am ish IB does something I think bc I regularly get these OT disconnected then reconnected warnings

So I have re set AT to run in the AM. You should try it too

PS If you have to reapply a TP to the 25% you should delete the previous step (the 75% exit part) and just have the trailing stop step left, and change the order to exit 100% not 25%. That works to get a TP attached
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 8/5/2021 9:56 AM
Post #31550 - In reply to #31549

Re the original post by James, where the IB size didn't match the TP the next morning ... I'm not clear on whether that is still an issue or not. If it is, there may be a couple of reasons:

1. if the stock is thinly traded &/or stoplimit order, then you could have gotten a partial fill ... the TP does not know about that. Solution: switch to Market or Market on Open or StopMarket order type.

2. if the 25% calculation resulted in some fractional number of shares, like 50.5, then the broker may have rounded up and the TP rounded down, etc. Solution: make sure the "100%" trade-calculator size can be evenly split into whatever partial exit percentages that your TP is using.



^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 8/5/2021 1:36 PM
Post #31551 - In reply to #31550

Jim

I don't think either of those things are the issue with the TPs. OBV they could've been for James (OP) but I did not get any partial fills (I also use a vol filter to avoid thinly traded or cheap stocks) or problems with the 75/25 division of the position (the numbers totaled the original position size) on any of the 3 that errored last night (at 4am).

What I saw was AFTER the 75% exit (step 2 complete) the tradeplan showed **step 2 still active** instead of complete, so it expected to see the original position size instead of just the 25%. This caused the error of TP/position size not matching.

I never saw this when I had AT run in the AM pre-mkt open. It only happened yesterday when I had it run PM the nite prior. I think it's what I suggested - when IB does some late night brokerage stuff it does every night around 3am that is causing this issue if AT ran before this but seems to be ok when AT runs after.

We'll see tomorrow if no errors occur
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 8/6/2021 8:01 AM
Post #31552 - In reply to #31551

I run a custom version of the T21 profile on another computer to use to trade my 401k. It's connected to a paper broker but I use AT just like my IB OT install.

The 75/25 thing with TPs has worked fine until yesterday when I did a test - instead of AT running in the AM prior to mkt open I set it to run PM after mkt close for the next day.

Sure enough - got this TP error. Hasn't happened before.

Soooooo it's not an IB brokerage thing bc this is a paper acct.

Two different computers with separate OT installs running different profiles - one IB, one paper - using different strats are having this same problem IF it runs the night prior. If they run AM before mkt open NP.

Barry?
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/1/2021 10:26 AM
Post #31592 - In reply to #31538

I was able to reproduce & report this issue with multistep partial exit trade plans. We're working on a fix.
^ Top
Buffalo

Posts: 603

Joined: 7/11/2007
Location: Braintree, MA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/11/2021 8:06 AM
Post #31596 - In reply to #31592

Barry

I see it now each time I shut down OT and restart - any open trade that did the partial exit and has the 25% remaining will generate this error when OT restarts
^ Top
SteveL

Posts: 133

Joined: 2/15/2007
Location: Boulder, CO

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/11/2021 3:31 PM
Post #31597 - In reply to #31596

Same here. Just recently started using the partial exit, and I got the same error yesterday (I had recently restarted OT). I'm glad Barry has reproduced the error.
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 9:50 AM
Post #31598 - In reply to #31597

The fix is in PR2J, going live shortly. Unfortunately it will not fix trade plans that have already been disconnected.
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 9:52 AM
Post #31599 - In reply to #31598

Barry:

Did the fix involve a change to the TP "engine", or to the TradePlan structure, or both? That is, could a user have made the necessary modifications?

It would help us to know more details. Thanks!
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:11 AM
Post #31600 - In reply to #31599

It was a change in the code to fix a bug with multistep partial exit trade plans when used with a broker due to not calculating the partial exit share size properly. A user could not have made modifications to get around it.
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:21 AM
Post #31602 - In reply to #31600

It would calculate the share size to place the trades. There's a validation check that happens with trade plans when connecting to a broker. If the number of shares at the broker is not the same as what OT thinks it should be, then it causes a disconnected trade plan. That's the piece that was failing with partial exit trade plans.
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:39 AM
Post #31603 - In reply to #31602

Ahhh ... a tricksey roundoff-handshake error.
Good catch!

Thanks for the explanation.
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:42 AM
Post #31604 - In reply to #31603

Barry:

SUGGESTION ... if that kind of mismatch error occurs again, PLEASE consider modifying the response-action to CLOSE THE TRADE (sell or cover all remaining shares), rather than let it continue unmanaged.

If there is debate about this, please offer it as an Option that the User can set. This is actually a pretty crucial thing. It can happen pretty often with Partial fills, which occur on thinly traded stocks OR on TradePlans that use StopLimit orders.
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:47 AM
Post #31605 - In reply to #31604

I don't think people would be too happy if their live trades closed upon connecting OT to their broker. That's just asking for trouble.
^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 10:51 AM
Post #31606 - In reply to #31605

I strongly disagree ... being conservative ... but I acknowledge that others might not. I believe that we need to TRUST automation to work CORRECTLY, and if it fails, it should FAIL SAFE.

That's why I suggested that you offer the OPTION for each user to make their own conscious decision.

If a trade plan disconnects, it could open a user up to CATASTROPHIC LOSSES, unless they are there to respond to the error. Automation is *supposed* to eliminate that necessity.

So, if it fails, please allow the option for it to FAIL SAFE.
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 11:58 AM
Post #31607 - In reply to #31606

If you're using automation, you will get an alert when a trade plan becomes disconnected. The user can then decide if they want to reapply a trade plan, close the trade, etc. That is our answer to these kind of problems. James was correctly informed of a problem at the start of this thread...

"Trade Plan for Symbol does not match the quantity with the brokers position. Please re-apply a trade plan'."

Even a setting to close trades like that is very dangerous. First, users do not always remember the settings they enable/disable. Second, things can break. For example we have this validation code for trade plans. When it didn't work, the worst that happens is the trade plan became disconnected. If a user has an option that force closes trades upon broker connection, if it isn't perfectly coded to handle every scenario, the worst that can happen is all your broker trades close. That can be catastrophic.

^ Top
Jim Dean

Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 1:13 PM
Post #31608 - In reply to #31607

I think your final scenario is highly unlikely ... for ALL your open trades to close. That would presume all were using the same TP, and that the flaw in the TP hits all of them at once. If you REALLY think that TP's are potentially that unreliable, then I hope there is a high priority on improving them.

I really don't think that closing a trade early is a "catastrophic" danger. However, FAILING to close a Long trade that has a sudden reversal due to horrible news, or FAILING to close a Short trade that has decided to reverse and take off, can create HUGE LOSSES. All it takes is for the trader not to be immediately available to respond to an error message.

This is even MORE FRAUGHT for INTRADAY traders.

It sounds to me like your POV is that even though the trade is "automated", the automation needs constant babysitting. That to me is not real "automation" ... but maybe realistically it's just where OT is at right now.

PLEASE solicit other opinions about this, and please include my cautionary examples.

I realize that *part* of your resistance might be due to users getting "hit" more frequently which would potentially increase the calls you get. But at least they would be *SAFE*. And, if you think it will happen that often, then that sounds like the TP engine needs fixing.

Thanks for listening.
^ Top
Barry Cohen

Posts: 2309

Joined: 1/1/1900

User Profile
 
Subject : RE: TMS Trade Plan Error
Posted : 9/13/2021 2:43 PM
Post #31609 - In reply to #31608

One could say the bug from this thread or many other issues are unlikely yet they happen. You're talking about a way to force close trades upon a broker connection. I imagine a new OT user that has 45 trades open at IB. He connects to OT & due to some problem with this new setting, all 45 of his trades close since there's no trade plans on them. It's just way too risky. I prefer to not have any way for something like that to occur.


https://www.omnitrader.com/currentclients/proforum/thread-view.asp?threadid=7943&posts=29