I meant the parent/child stuff,
Quick question:
does API support changing LMT to MKT?
I knew STP to TRAIL will be rejected, cause type change is not supported,
A->B type change is not supported in general or some of them?
toggle quoted message
Show quoted text
--- In TWSAPI@..., "btw12342001" <newguy@...> wrote:
I'm not sure what part you figured out but I'll clear up my post.
I think you must not be placing orders correctly as my method should work for market orders. I'm just saying that I only use limit orders so I haven't verified this.
Just FYI, I use limit orders as you suggest at either the bid or ask if I want an order that fills as fast as a mkt order. I never place mkt orders and don't really miss them.
--- In TWSAPI@..., ustcbbc <no_reply@> wrote:
I figured that part out. thank you.
but the thing for scapling is,
I can afford slippage from MKT order than the opportunity cost from LMT order.
--- In TWSAPI@..., "btw12342001" <newguy@> wrote:
I only use limit orders but I think you should send the parent order with transmit = false. On the last child order set transmit = true and then they all get sent.
--- In TWSAPI@..., ustcbbc <no_reply@> wrote:
Hi,
I am writing a forex scalping program with IB POSIX C++ API,
there is one question:
I need to submit one parent order and attach one trailing stop order and one profit taking order.
parent order is market order as I don't want to miss any opportunity, filling as fast as need. but trailing order can't be attached to market parent order.
if I attach a stop order first, I am not able to change it to TRAIL type later.
So what kind of solution you use?
1. submit parent order with limit order, you could put limit price higher than market price (for buy) to simulate a market order, but in this case I have to track the bid/ask as fast as I could, I don't even know IB is capable of it (no real tick price and latency between my computer and their servers).
2. submit parent order with MKT type, no child order, put a trailing order afterwards?
3. manually implement a TRAIL order by modifying stop price for STP order attached whenever necessary.
Second question,
m_pClient->placeOrder(m_orderId, m_contract, order_parent);
m_pClient->placeOrder(m_orderId + 1, m_contract, order_stoploss);
m_pClient->placeOrder(m_orderId + 2, m_contract, order_profittaking);
trying to make a MKT parent order,
and two child orders, one sl with STP type, one tp with LMT type.
problem is,
I have to submit three orders in turn. parent order first.
but after I submitt the parent order, it will be filled immediately.
child orders will produces error msg like:
Error id=59, errorCode=201, msg=Order rejected - reason:The parent order is bein
g canceled.
And another question, In TWS, I am able to submit stop with stop price of actually traded price of parent order, How should I do it via API? the trade price of parent order is unknown when submitting attached child stop loss order.
right now,
I am submitting two child orders with very wild sl and tp level and modified it once parent order gets filled. apparently this is not a good solution
Any idea?
Thanks a lot for your help!