开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育
Date

Re: IB Routinely Misses Stops and Hidden LMTs

 

One factor to consider is which trigger to use: Bid, Ask, or Last. That obviously plays a role, including vulnerability when bored institutional traders run the Stops.

On Thu, Jun 23, 2022 at 2:42 PM Jenzi <jzip@...> wrote:
That's a very interesting thought, because the exits were made in the second the us markets did open.
Otherwise, i have made many other trades during the day where it worked (same instrument, exits on taget limit or stop).
In the TWS 'Global Configuration' - 'Presets' for Futures the checkmark is set.

You mean to set the option for every bracket order when creating/sending an order? I'll give that a try.

bool? [get, set]
? If set to true, allows orders to also trigger or fill outside of regular trading hours.


Re: IB Routinely Misses Stops and Hidden LMTs

 

That's a very interesting thought, because the exits were made in the second the us markets did open.
Otherwise, i have made many other trades during the day where it worked (same instrument, exits on taget limit or stop).
In the TWS 'Global Configuration' - 'Presets' for Futures the checkmark is set.

You mean to set the option for every bracket order when creating/sending an order? I'll give that a try.

bool? [get, set]
? If set to true, allows orders to also trigger or fill outside of regular trading hours.


Re: IB Routinely Misses Stops and Hidden LMTs

 

开云体育

Did you set the stop-loss orders to execute outside regular trading hours? It’s not enough just to set that for the parent order.

?

?

?

From: [email protected] <[email protected]> On Behalf Of Jenzi
Sent: 23 June 2022 20:16
To: [email protected]
Subject: Re: [TWS API] IB Routinely Misses Stops and Hidden LMTs

?

It's ES before the US open, during European markets.


Re: IB Routinely Misses Stops and Hidden LMTs

 

It's ES before the US open, during European markets.


Re: IB Routinely Misses Stops and Hidden LMTs

 

Ok, pulled up a footprint of the situation, basically this should not be possible to happen.


Re: IB Routinely Misses Stops and Hidden LMTs

 

How liquid are the contracts you're trading? Even if the stop gets triggered you still need some liquidity for the trade to execute


On Thu, Jun 23, 2022 at 11:52 AM Jenzi <jzip@...> wrote:
These aren't Stop Limits 'STP LMT', but Stop Orders 'STP', that should exit via a market order, when according to IB doc "the user-specified stop trigger price is attained or penetrated".
This is happened live. And i've seen this with Trailing Stops too.
I've checked the ES trades, take a look at the 2min chart, i've marked the two candles with the short entries, it wasn't even a volatile market and i doubt anything got jumped. The exits were made more than four hours later.


Re: IB Routinely Misses Stops and Hidden LMTs

 

These aren't Stop Limits 'STP LMT', but Stop Orders 'STP', that should exit via a market order, when according to IB doc "the user-specified stop trigger price is attained or penetrated".
This is happened live. And i've seen this with Trailing Stops too.
I've checked the ES trades, take a look at the 2min chart, i've marked the two candles with the short entries, it wasn't even a volatile market and i doubt anything got jumped. The exits were made more than four hours later.


Re: IB Routinely Misses Stops and Hidden LMTs

 

Apologies if I'm being slow, the image shows two ES brackets, both of which have triggered stops. Assuming your last column is the average fill they did get caught clearing above their trigger level - that's expected isn't it? I think your stop is a market order triggered at a certain price. If your example shows the stop not triggering, can you please clarify it for me, I'm reading it as "every stop here was triggered and cleared"
Note the difference between
order.OrderType = "STP";? // Market order placed on price trigger
and
order.OrderType = "STP LMT"; // Limit order placed on price trigger

Best wishes,


M


On Thu, 23 Jun 2022 at 19:02, Rob Tilley Jr. <fladventurerob@...> wrote:
Does this behavior occur in live trading, or just paper trading? Per IB own docs (and every other broker I've ever used) a stop-limit "is an instruction to buy or sell limit order when the stop trigger price is attained or penetrated." The thought that this wouldn't trigger and become marooned if it jumps below is confusing to me, because there shouldn't be any condition in which that would occur if I'm understanding this issue correctly?

On Thu, Jun 23, 2022, 1:57 PM jcopp <johndcopp@...> wrote:
If you're using LIMIT stops, that's how they behave. If the market suddenly leaps over or below your stop, it's marooned. Try using a TRAIL and monitor it closely.

On Thu, Jun 23, 2022 at 10:09 AM Jenzi <jzip@...> wrote:
Just from yesterday and today.



--
+44 (0) 7528 551604?
Gulfstream Software - Winner Risk Management Awards 2010
This message is subject to :


Re: IB Routinely Misses Stops and Hidden LMTs

 

Does this behavior occur in live trading, or just paper trading? Per IB own docs (and every other broker I've ever used) a stop-limit "is an instruction to buy or sell limit order when the stop trigger price is attained or penetrated." The thought that this wouldn't trigger and become marooned if it jumps below is confusing to me, because there shouldn't be any condition in which that would occur if I'm understanding this issue correctly?


On Thu, Jun 23, 2022, 1:57 PM jcopp <johndcopp@...> wrote:
If you're using LIMIT stops, that's how they behave. If the market suddenly leaps over or below your stop, it's marooned. Try using a TRAIL and monitor it closely.

On Thu, Jun 23, 2022 at 10:09 AM Jenzi <jzip@...> wrote:
Just from yesterday and today.


Re: IB Routinely Misses Stops and Hidden LMTs

 

If you're using LIMIT stops, that's how they behave. If the market suddenly leaps over or below your stop, it's marooned. Try using a TRAIL and monitor it closely.

On Thu, Jun 23, 2022 at 10:09 AM Jenzi <jzip@...> wrote:
Just from yesterday and today.


Re: IB Routinely Misses Stops and Hidden LMTs

 

Just from yesterday and today.


Re: IB Routinely Misses Stops and Hidden LMTs

 

Do you have an example? I've used IB for years and not seen the behaviour you describe ( though I've encountered plenty of other weirdnesses)

Best wishes,


M

On Wed, 22 Jun 2022, 19:09 Jenzi, <jzip@...> wrote:
Sad, but still true.
I've seen this behaviour in paper trading, where you can actually specify the trigger method in TWS settings, and during live trading, where the stop order is getting handled by the exchange.
When the market gaps over the stop trigger point, the stop order will not get executed. The stop order will just stay there for hours, while the price is well beyond.
Absolutely no way trusting this system.


Re: IB Routinely Misses Stops and Hidden LMTs

 

Sad, but still true.
I've seen this behaviour in paper trading, where you can actually specify the trigger method in TWS settings, and during live trading, where the stop order is getting handled by the exchange.
When the market gaps over the stop trigger point, the stop order will not get executed. The stop order will just stay there for hours, while the price is well beyond.
Absolutely no way trusting this system.


Re: AttributeError: 'TestApp' object has no attribute 'nextValidOrderId'

 

LOL, now its working... how?


AttributeError: 'TestApp' object has no attribute 'nextValidOrderId'

 

from ibapi.client import EClient from ibapi.wrapper import EWrapper, iswrapper from ibapi.contract import Contract from ibapi.order import Order import threading import time ... class TestApp(EWrapper, EClient): def __init__(self): EClient.__init__(self, self) @iswrapper def nextValidId(self, orderId:int): super().nextValidId(orderId) self.nextValidOrderId = orderId def nextOrderId(self): oid = self.nextValidOrderId self.nextValidOrderId += 1 return oid ... def BracketOrder(action, quantity, limitPrice, takeProfitLimitPrice, stopLossPrice): parent = Order() parent.orderId = app.nextValidOrderId parent.action = action parent.orderType = "LMT" parent.totalQuantity = quantity parent.lmtPrice = limitPrice parent.transmit = False takeProfit = Order() takeProfit.orderId = app.nextValidOrderId takeProfit.action = "SELL" takeProfit.orderType = "LMT" takeProfit.totalQuantity = quantity takeProfit.lmtPrice = takeProfitLimitPrice takeProfit.parentId = app.nextValidOrderId takeProfit.transmit = False stopLoss = Order() stopLoss.orderId = app.nextValidOrderId stopLoss.action = "SELL" stopLoss.orderType = "STP" stopLoss.auxPrice = stopLossPrice stopLoss.totalQuantity = quantity stopLoss.parentId = app.nextValidOrderId stopLoss.transmit = True bracketOrder = [parent, takeProfit, stopLoss] return bracketOrder bracket = BracketOrder("BUY", how_much, get_price, win_price, lost_price) for o in bracket: app.placeOrder(app.nextValidOrderId, stonk(whom), o) time.sleep(1) app.nextOrderId()


I got this error:
Traceback (most recent call last):
? File "C:/Users/komp/PycharmProjects/paperbuild0.1/final8.py", line 105, in <module>
? ? bracket = BracketOrder("BUY", how_much, get_price, win_price, lost_price)
? File "C:/Users/komp/PycharmProjects/paperbuild0.1/final8.py", line 77, in BracketOrder
? ? parent.orderId = app.nextValidOrderId
AttributeError: 'TestApp' object has no attribute 'nextValidOrderId'

I admit that I'm completely surprised and exhausted. This code has been working yesterday during live session, today cannot get order Id. Could anybody fix this error and explain why this method (changed a lot of times) is so erratic? Best, G.


Re: Can I combine a bracket order with a MOC (Market on close) order - Invalid OCA handling method

 

On Sun, Jun 19, 2022 at 06:35 AM, <johannes.kreckel@...> wrote:
order.Tif = 'GTC'
Take a look at my sample code in this thread -?/g/twsapi/message/49108?to see how I have modeled the FlattenOrder to do what you are doing using the GAT order type.


Moderated Re: Fundamentals Explorer

 

开云体育

Ok, I got it,
Once again I am using a Delphi library that can be used in C++ Builder (no python,? C#,? Java or VC++)
so it feels a little like being on a deserted island.? And I was busy in the month gone. Thanks.

On 19/05/2022 12:44 pm, Colin B Maharaj via groups.io wrote:

I am sorry, I rushed to ask a question without a bit of research.
Not a good habit.

Thanks, I'll figure it out.

On 19/05/2022 05:22 am, Richard L King wrote:

Well, just a glance at that image shows that you've got contract data, real-time market data, and fundamentals data.

?

Armed with the API documentation, why do you need to ask this question? Please make a bit of an effort to work this out for yourself, and then if you get stuck ask a more specific question.

?

?

From: [email protected] <[email protected]> On Behalf Of Colin B Maharaj
Sent: 18 May 2022 21:02
To: [email protected]
Subject: [TWS API] Fundamentals Explorer

?

Hi all,
What API should I call to recreate one like this, it's in the TWS..

Also if I have a list of symbols, how about a minimal set of info to make a table of the following say.....

symbol, current price, low price, high price, volume, 200 dma, 50 dma etc...

?


Re: Can I combine a bracket order with a MOC (Market on close) order - Invalid OCA handling method

 

Hi Jürgen,

thanks for your tips. Actually it sounds very obviously that a MOC order can not be part of OCA group if cancelling is not always possible. I wasn't aware about that.

Now I will change my code to using?ibapi.order_condition.TimeCondition.

Also I am wondering, if it it can be done simple setting order attributes as below:

order.Tif = 'GTC'   
order.ActiveStartTime =?'20220621 15:20:00'?# Defines the start time of GTC orders., Valid format: YYYYMMDD HH:MM:SS.?

I will play a little bit around and do some paper trading next Tuesday (when NYSE) is open again.
Guess this order specifications types are only doable in NYSE.


Re: RealTimeBars for SPX

 

sorry my bad. i had initially tried for SPX then later was trying to see if SPY is working . hence when i pasted the code snippet it was SPY.?
But originally my intention was to get real time bars for SPX.
The code you had posted seems to be working. thanks alot. The mistake i had done , when i was originally trying SPX was
contract.exchange("SMART")?
contract.primaryExchance("CBOE")

the above two lines seems to be the issue, in your snippet you are setting the exhange to CBOE which seems to be helping.? ?

thanks again?


Re: Multiple Price Conditions with "OR"

 

Hi,

I use Python.. Here is what I am trying to do (I removed the imports and made the code simplified here, so that we can focus on the topic, rather than the full code)

First I create "price_condition" (only 1) and in that, they dont have a "isConjunctionConnection" property (even the docs say there is, docs is v9.72 and i am using 9.81.1). I am attaching the order_condition.py file that came with 9.81.1 and from that you can see the property is not there, but its there in another class.. But I am not sure how to use it..

After that, I create an order, then I am? appending the price_condition to the order and sending it.. This works well, but I want to add another price_condition with "OR"

Let me know if its clear.

Thanks.

price_condition = PriceCondition(triggerMethod=PriceCondition.TriggerMethodEnum.Default, conId=contract_id, exch=exchange, isMore=False, price=100)

?

order = Order()

order.action = action

order.orderType = "MKT"

order.totalQuantity = quantity

?

order.conditions.append(price_condition )