¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

Re: Cancel order lag - sometimes when lag they can fill

 

In case you wonder, by the asynchronous nature of the API (which is good) you should never assume instantaneous execution.
Sending the request is just queuing and intent. (more about callback below) and I like it that way.

I check explicitly order status before an assumption like a cancel being done, in particular if I have to re-submit a substitute order. (or you have to factor-in the risk of parallel execution, which could make sens if time is critical)
I am not sure it's a good practice to rely on any sleep, the API is a state machine and you should track the state of it either trough additional IB request or internally or both. (both is good as order are the crucial part of the usage of the API)

here "both" means:
Listening to orderStatus callback is generally enough. "generally" because:? When the callback fires, I always find it accurate,
but in IB doc I read that at least in some cases of immediate execution the callback may not be called. The sentence imply that there is a gray area there and better have a "plan B"
It's a difficult area for doing accurate tests,? it is very much market dependent, so that "belt and suspender" are required.
So doing an additional explicit detail request is safe and generally fast enough in view of execution time, so I never study that part of the API again. It work.

you surely read it but just in case:

also helpful


About cancel sl/tp:
I do cancel them but don't know if its needed, because I prefer to "over cancel" applying the rule that everything that have an individual orderid could and maybe should be cancelled.
So as I track childs ID, a "cancel session" is made of cancelling everything related to the bracket and thanks to the async API that have no impact I can notice.
Surely need some study.


Re: Interactive brokers over Tradingview Development

Franco Chiesa Docampo
 

The ultimate decision rests on the extent to which you are willing to leverage the IB platform. Have you conducted a comprehensive comparison of scalability, flexibility, response time, maintenance, and other factors between using the IB SDK and TView? This evaluation will provide valuable insights to make an informed choice.?


El El s¨¢b, 22 de jul. de 2023 a la(s) 17:03, joanmarcel119 <joanmarcel@...> escribi¨®:
David, thank you?for giving your point of view, is it possible to develop a system to trade option contracts through TradingView sending the orders to IB?


El s¨¢b, 22 jul 2023 a las 19:55, David Nevado via (<david_nevado=[email protected]>) escribi¨®:
Hi,?

Testing both platforms, I dont really find any advantage of IB over TradingView. TradingView provides an interfaz to develop strategies and test in a quick manner with Pine Script , backtesting is algo available and easy and quick to test getting past data and from my understanding , there is an interface between both to directly send orders to IB once any condition or signal in TradingView gets identifed?

Development in IB is not straightforward.?

Kind Regards

David Nevado


Re: Interactive brokers over Tradingview Development

 

David, thank you?for giving your point of view, is it possible to develop a system to trade option contracts through TradingView sending the orders to IB?


El s¨¢b, 22 jul 2023 a las 19:55, David Nevado via (<david_nevado=[email protected]>) escribi¨®:
Hi,?

Testing both platforms, I dont really find any advantage of IB over TradingView. TradingView provides an interfaz to develop strategies and test in a quick manner with Pine Script , backtesting is algo available and easy and quick to test getting past data and from my understanding , there is an interface between both to directly send orders to IB once any condition or signal in TradingView gets identifed?

Development in IB is not straightforward.?

Kind Regards

David Nevado


Interactive brokers over Tradingview Development

 

Hi,?

Testing both platforms, I dont really find any advantage of IB over TradingView. TradingView provides an interfaz to develop strategies and test in a quick manner with Pine Script , backtesting is algo available and easy and quick to test getting past data and from my understanding , there is an interface between both to directly send orders to IB once any condition or signal in TradingView gets identifed?

Development in IB is not straightforward.?

Kind Regards

David Nevado


Re: Cancel order lag - sometimes when lag they can fill

 

Sorry im only canceling the parent order by order Id. Shall I also cancel the sl and tp by order id too??


On Sat, Jul 22, 2023, 7:34 AM Andrew Bannerman <bannerman1985@...> wrote:
Yes I have added 2 seconds lag after cancel prior to sending new bracket. In each case I cancel the bracket only. Should I also by order number cancel tp and sl too?

On Fri, Jul 21, 2023, 11:03 PM misantroop <alepik@...> wrote:
In certain instances adding a 100ms sleep between cancelOrder requests has helped, especially when cancelling a large amount of orders.


Re: Cancel order lag - sometimes when lag they can fill

 

Yes I have added 2 seconds lag after cancel prior to sending new bracket. In each case I cancel the bracket only. Should I also by order number cancel tp and sl too?


On Fri, Jul 21, 2023, 11:03 PM misantroop <alepik@...> wrote:
In certain instances adding a 100ms sleep between cancelOrder requests has helped, especially when cancelling a large amount of orders.


Re: Cancel order lag - sometimes when lag they can fill

 

In certain instances adding a 100ms sleep between cancelOrder requests has helped, especially when cancelling a large amount of orders.


Cancel order lag - sometimes when lag they can fill

 


step 1: cancel bracket order - see key 135
step 2: send new bracket order - see key 136





what happens is - there can be a reasonable lag in time maybe 2 seconds when the order is lingering there. Youl see status - there is an exclamation mark.
So while it its 'lagging' in this cancelled state sometimes they can still fill.

Has anyone encountered this?


Re: buy order at open if market open between a minimum and maximum

 

What you wish to implement is effectively a stop-limit order to be placed into the market center official opening auction. That is not possible.

LOO/MOO orders are totally special exchange orders, as well as MOC/LOC.?

It's not that IBKR somehow reduces their system capability in respect to these by denying clients to attach price and time conditions et cetera, it's just that such capabilities will not work with exchanges.?

These orders are executed atomically (even though not necessarily momentarily) at the opening and closing auctions, or "crosses" in Nasdaq speak. They must be submitted some time ahead of their respective daily trade cycle times. The submission time limit differs by exchange, auction kind (open/close) and order type - limit orders are allowed to be submitted closer to the auction in certain circumstances related to the accumulated balance of pre-orders. After some time once they are submitted and before the auction is carried out they also cannot be recalled. Also, no liquid trading on the exchange will happen in respective stocks before the opening auction and after the closing auction.

Certainly, you'll realize that any broker-imposed trading conditions would have zero chance of being respected or enforced under this scheme. Further, the idea that you can get an opening print and then quickly submit an OPG order is completely futile because the primary exchange will simply not start trading before the auction is executed, and even though trading may start a few moments earlier on non-primary exchanges and dark pools, by that time no OPG orders will be accepted by the primary exchange (and non-primary liquidity may not be?much better than in the early non-regular trading anyway).

--
Best,
DS


Re: I have a hard time doing Paper Trading

 

I have repeated the test and I attach here the audit log.

Thank you !


Re: I have a hard time doing Paper Trading

 

An update, I use TSW 10.19.2a
The answer from the support:
"
That issue is not related with your account, the market data subscription or trading hours. That kind of scenario is related with the fact that data processed by the platform for simulated trades might be wrong.
I understand that the Demo account is handy for testing strategies and see if it worthy to apply them in the real account but unfortunately it is not 100% reliable.
"
The only thing I add here is that is a PaperTrading account not a Demo.


Re: I have a hard time doing Paper Trading

 

The missing subscription to exchanges can be indeed a valid explanation of what is happening, so even if I do 'SMART' is actually only 'ISLAND', but anyway is strange that the first order is executed.


Re: I have a hard time doing Paper Trading

 

I have found that paper trading is realistic. It has issues with volatile prices (when the prices moves several cents at a time. For example, if I place an order to BUY at $10.15 and the price jumps from 10.17 to 10.12 then it isn't filled even though it should. It also takes longer to fill these days because the order isn't visible to all the exchanges and algorithms that might have an interest

I do have several deep-book subscriptions (ARCABOOK, OPENBOOK, , TOTALVIEW, etc).


Re: TWS startup parameters

 

I noticed that in the properties when TWS installs an icon on the desktop. From the start menu (Windows 10) there isn't a properties option so I guess it's buried in the registry.

The "starting" directory has two randomly named directories. One is for paper trading and one is for live trading.

I wonder what other parameters are available.


Re: Intraday VWAP standard deviation channel

 
Edited

A quick Web search (not with Google) for "ibkr tws chart study intraday vwap" brings up this:

It sounds to me as if the chart uses the last calculated stdev (at the time of chart display) as a constant for that chart, instead of the accurate stdev for each data point. Below ESU3 with 1min bars for today.

´³¨¹°ù²µ±ð²Ô


On Thu, Jul 20, 2023 at 03:58 PM, Simon Steiner wrote:
Gordon, thank you for your reponse.

Since I am only looking at vwap of the intraday trading session, I am using the 5sec bars' wap and volume of the RTH since open. So at least in my case the question regarding consideration of weekend effects should not apply. Also the calculated vwap itself appears to be an accurate reflection of what IB shows in their charts. So i think I got that.
What I am only struggling with is the displayed channels above and below the vwap: I was expecting it would be the standard deviation of the volume weighted prices to the calculated vwap. But it appears that is not the case: If I display the channels on the chart it looks like the distance to the vwap remains static across the trading day. If it was a "true" standard deviation I would expect it to change over the course of a session, and for instance rise in phases when prices move away from vwap...?


Re: Intraday VWAP standard deviation channel

 

Gordon, thank you for your reponse.

Since I am only looking at vwap of the intraday trading session, I am using the 5sec bars' wap and volume of the RTH since open. So at least in my case the question regarding consideration of weekend effects should not apply. Also the calculated vwap itself appears to be an accurate reflection of what IB shows in their charts. So i think I got that.
What I am only struggling with is the displayed channels above and below the vwap: I was expecting it would be the standard deviation of the volume weighted prices to the calculated vwap. But it appears that is not the case: If I display the channels on the chart it looks like the distance to the vwap remains static across the trading day. If it was a "true" standard deviation I would expect it to change over the course of a session, and for instance rise in phases when prices move away from vwap...?


Re: I have a hard time doing Paper Trading

 

Thank you Jurgen for your detailed response.

I downloaded the latest stable TWS.

About TSLA, I used it as an example, but I have the same experience with everything excepting Forex CFDs :).
As far as I remember the order filled around 20 min, even if there were partial fills, they were around that period in time.
I have tried different exchanges, it is the same, about the subscription, I only have NASDAQ for now.

The behaviour is like this: the first trade on either side is working as expected, but when I try to close the position, or open another one on the
same stock it has delay.


On Thu, Jul 20, 2023 at 10:57?PM ´³¨¹°ù²µ±ð²Ô Reinold via <TwsApiOnGroupsIo=[email protected]> wrote:

Nothing is impossible, but we have found the Paper Account to be remarkably realistic and accurate and we don't experience trade delays during liquid hours for liquid instruments and marketable orders. The long time-to-fill might have been real. Couple things come to mind:
  • Which version of TWS are you using? The "latest" track V10.23 seems to have several regressions. If you are on that track try the current "stable" version 10.19.2b
  • TSLA is under SEC "Up Tick" Rule 201 restrictions since yesterday afternoon. Not sure whether that has an impact on (real and simulated) order fills. Do you have the same problem with other instruments?
  • Did the order fill in one trade after 20 min or did you have partial fills along the way? Is it possible that you had selected "All Or None" on the sell order? That can cause delays.
  • Do you experience the delays when you route the order directly to NASDAQ instead of using? an IBKR SMART routing algorithm?
  • And finally, do you have data subscriptions to exchanges other than NASDAQ? TSLA is listed on many exchanges and SMART routing, under certain circumstances, may require you to have subscriptions to all of them.

Check the TWS Account-> Audit Trail option. May give you some hints in case this was related to the actual TSLA market situation.

´³¨¹°ù²µ±ð²Ô



On Thu, Jul 20, 2023 at 02:21 PM, <flaviupaul@...> wrote:
In my opinion a MKT order that doesn't get filled when it should have been means that the platform doesn't work. Is not an API issue, because even if I place the trade from TWS GUI is the same, even 20, 30 minutes to fill a MKT order.

I don't rely in paper trading to test the strategy, I did backtesting, and used it on other platform, but I have to test the integration of the strategy into the platform, , connection, data, orders and others.


Re: I have a hard time doing Paper Trading

 

Nothing is impossible, but we have found the Paper Account to be remarkably realistic and accurate and we don't experience trade delays during liquid hours for liquid instruments and marketable orders. The long time-to-fill might have been real. Couple things come to mind:
  • Which version of TWS are you using? The "latest" track V10.23 seems to have several regressions. If you are on that track try the current "stable" version 10.19.2b
  • TSLA is under SEC "Up Tick" Rule 201 restrictions since yesterday afternoon. Not sure whether that has an impact on (real and simulated) order fills. Do you have the same problem with other instruments?
  • Did the order fill in one trade after 20 min or did you have partial fills along the way? Is it possible that you had selected "All Or None" on the sell order? That can cause delays.
  • Do you experience the delays when you route the order directly to NASDAQ instead of using? an IBKR SMART routing algorithm?
  • And finally, do you have data subscriptions to exchanges other than NASDAQ? TSLA is listed on many exchanges and SMART routing, under certain circumstances, may require you to have subscriptions to all of them.

Check the TWS Account-> Audit Trail option. May give you some hints in case this was related to the actual TSLA market situation.

´³¨¹°ù²µ±ð²Ô



On Thu, Jul 20, 2023 at 02:21 PM, <flaviupaul@...> wrote:
In my opinion a MKT order that doesn't get filled when it should have been means that the platform doesn't work. Is not an API issue, because even if I place the trade from TWS GUI is the same, even 20, 30 minutes to fill a MKT order.

I don't rely in paper trading to test the strategy, I did backtesting, and used it on other platform, but I have to test the integration of the strategy into the platform, , connection, data, orders and others.


Re: I have a hard time doing Paper Trading

 

Thanks for your suggestion, I will do that, until now I've raised only a ticket but I've received the 'default' answer that can be found on IBKR page, saying that paper trading is a simulation... etc. Agree, is a simulation, but in my case it makes everything not usable.


Re: I have a hard time doing Paper Trading

 

In my opinion a MKT order that doesn't get filled when it should have been means that the platform doesn't work. Is not an API issue, because even if I place the trade from TWS GUI is the same, even 20, 30 minutes to fill a MKT order.

I don't rely in paper trading to test the strategy, I did backtesting, and used it on other platform, but I have to test the integration of the strategy into the platform, , connection, data, orders and others.