|
dontpanic
|
 |
« on: November 28, 2006, 11:44:19 PM » |
|
Hi, I am just getting started using the trading API (for MB).
I see there are several order types that are available, but as far as I can see it is only possible to specify 2 prices: limit and stop.
Below is an example of what I want to do, and I would to know if is it possible (and if so how) to do this by placing a single order, or if I have to place more than one order and/or manage the order in some way to accomplish it (basically its parent plus OCO contingent) :
say I'm trading EUR/USD and the current price is 1.9990. I want to place an order to buy 3 contracts if the price goes above 1.2000, and automatically include a stop at 1.9980 (for 3 contracts) and limit at 1.2040. Additionally, i would like the limit order to be only for 1 or 2 of the open contracts, not all 3. If either stop or limit is executed, then I want the other to cancel.
From reading the MB Trading API doc, I think it may be possible to get this done in one order (except maybe specifying the different contract number for the limit, but that could be done with a modify order?), but I can't see how to include my buy AND stop AND limit prices in the command, because there only seems to be limit and stop price that can be included.
Could I have an XML SEND example of how to accomplish this?
Thanks, Will.
|
|
|
|
|
Logged
|
|
|
|
ydfah
support
Hero Trader
   
Posts: 711
|
 |
« Reply #1 on: November 29, 2006, 12:13:11 AM » |
|
You have to decide what order you want to send based on what is available in QT GUI. For MB, QT has LIMIT+TTO, and the API has more than just the limit and stop price. There is also the PLUSLimitPrice and PLUSStopPrice.
You would specify LIMIT+TTO as the order type, specify LIMITPRICE and the two PLUS++++ prices for the TTO part of the order.
Something like this:
<TRADEAPI> <ID>TESTQT1</ID> <ACTION>SEND</ACTION> <TYPE>NEWORDER</TYPE> <PARAMS> <Symbol>EUR/USD</Symbol> <Action>BUY</Action> <OrderType>LIMIT+TTO</OrderType> <Quantity>3</Quantity> <LimitPrice>1.1990</LimitPrice> <PlusLimitPrice>1.2040</PlusLimitPrice> <PlusStopPrice>1.1980</PlusStopPrice> <TIF>DAY</TIF> <Route>MBTX</Route> </PARAMS> </TRADEAPI> {FF}
|
|
|
|
« Last Edit: November 29, 2006, 12:15:51 AM by ydfah »
|
Logged
|
|
|
|
|
dontpanic
|
 |
« Reply #2 on: November 29, 2006, 12:46:22 AM » |
|
Thanks that helps; I didnt see the pluslimit and plusstop parameters on the XML spec for NEWORDER, but now that you pointed them out it makes more sense.
I think in this case I would want STOPMARKET+TTO, wouldn't I? I mean, not to be pedantic, just to be clear. LIMIT would put me in below, whereas stop puts me in once the price has traded through my threshold?
Will.
|
|
|
|
|
Logged
|
|
|
|
ydfah
support
Hero Trader
   
Posts: 711
|
 |
« Reply #3 on: November 29, 2006, 07:16:15 PM » |
|
Using the STOPMARKET command would sell off your shares as a market order instead of a limit order, would it not? If that's fine with you then adjust the commands to your liking.
|
|
|
|
|
Logged
|
|
|
|
|
dontpanic
|
 |
« Reply #4 on: November 30, 2006, 07:19:17 PM » |
|
What I want to do (in the buy part of the order, and assuming I'm going long) is once the price has traded to my target price, I want to buy in as close as possible to that price. If I were to use a limit order here, it is possible that I may not be executed if the price keeps rising, is that correct?
whereas with a stop-market buy, I WILL be executed, but the price cannot be guaranteed, is this also correct?
If I am correct on both counts, then thats what I'm after.
Thanks, Will.
|
|
|
|
|
Logged
|
|
|
|
ydfah
support
Hero Trader
   
Posts: 711
|
 |
« Reply #5 on: November 30, 2006, 09:53:02 PM » |
|
You're correct on both counts. However, with the market order you could end up paying substantially more than you want to. It depends on the next asking price, and the next, and the next, all the way up until your order is filled.
|
|
|
|
« Last Edit: November 30, 2006, 09:56:05 PM by ydfah »
|
Logged
|
|
|
|
|
dontpanic
|
 |
« Reply #6 on: November 30, 2006, 10:05:09 PM » |
|
Then perhaps I am getting confused...
I have a couple of trading platforms, GTForex or SAXO for example, whereby I can place the order type I am talking about here, and I use a 'stop' type for the entry.
I rarely have failed to be executed at, or very close to, my target price. I'm new to FX trading, is it possible I am talking about something completely different?
Anyway, I suspect that these are questions I should take up with the QT support guys, or with my broker... not really questions for the API forum.
Thanks again, W.
|
|
|
|
|
Logged
|
|
|
|
ydfah
support
Hero Trader
   
Posts: 711
|
 |
« Reply #7 on: December 01, 2006, 09:04:09 AM » |
|
I rarely have failed to be executed at, or very close to, my target price. I'm new to FX trading, is it possible I am talking about something completely different? You're not confused, and yes market orders "usually" get filled close to the specified price. I was pointing out the risk not just for your benefit, but because others will also be reading this topic who might not be aware of the risk.
|
|
|
|
|
Logged
|
|
|
|
|
dontpanic
|
 |
« Reply #8 on: December 07, 2006, 11:39:49 PM » |
|
One more thing that got lost in the discussion.
on the plusStop order thats fine, so if my parent order gets triggered, my stop order for the full 3 contracts comes into place. However, on my limit sell order (price target) I only want to dump 1 of the 3 contracts. I have seperate exit strategies for the other 2 contracts.
there only seems to be one parameter for the number of contracts?
will i have to do 3 seperate initial orders and manage them seperately, or can I do it in the original order, or modify the original order to accomplish this trade management?
Thanks, Will.
|
|
|
|
|
Logged
|
|
|
|
|
HelenJames
Just Visiting
Posts: 1
I'm on http://twitter.com - Twitter and my http://www.essaysexperts.com - essays
|
 |
« Reply #9 on: July 28, 2010, 07:05:06 PM » |
|
Something alike was discussed on the Yahoo! Answers last week, i can share a link if you want some
|
|
|
|
|
Logged
|
|
|
|
|