Limit order

21 views
Skip to first unread message

Kelvin

unread,
Jun 30, 2008, 5:28:08 PM6/30/08
to JBookTrader
Since most of our strategies are based on anti-trend, we can use limit
order instead of market order. The nature of anti-trend strategies
makes the limit order be traded successfully with high probability. In
one month and 1000 trades, we can save 0.25*50*1000=1250$.

Is it possibile that we change the code for function setPosition(.),
so that the limit order could be supported?

nonlinear5

unread,
Jun 30, 2008, 8:22:14 PM6/30/08
to JBookTrader
Supporting limit orders involves a *lot* of complications. JBT would
need to know not just how to place limit orders, but also how to move
limit orders and cancel them. The strategy code would be a lot more
complicated, too. Consider this: your strategy has a long profitable
position and it wants to sell. It places a limit order to sell, but
the market never reaches that limit, but moves lower instead. What
should the strategy do? It has to have some sort of code that would
instruct it to cancel the existing limit sell order, then place
another limit sell order. And what if that second limit is never hit
either? Additionally, partial fills will be a problem, too. With the
limit order, it's quite possible that you managed to sell half of your
position, and left with the other half to sell. So, again, at some
point, the strategy would need to decide somehow whether to wait for
the other half to be filled at the existing limit order, or to cancel
the remaining order and to place a new one. All of this becomes pretty
complex. None of these issues exist with market orders.

One would think that you'd get some benefit for the trouble of using
limit orders, but it doesn't work quite the way you calculated
(0.25*50*1000=$1250). That's because you are not accounting for the
trades that were not filled at the limit and lost profit because of
that. What I am saying here is that using limit orders instead of
market orders does not give you an extra edge. You'll gain an extra
0.25 points on the orders that were filled, and lose some amount on
the trades that were not filled. Overall, it would probably balance
itself out.

Message has been deleted

xjustin

unread,
Jun 30, 2008, 8:49:17 PM6/30/08
to JBookTrader
We can use limit order for entry and/or second contract.
1. For limit entry, and still market order to exit.
2. For second contract, which means the first contract will still be
entered with market order and the second contract to reverse will be
entered with limit.

Thus we can expand JBT into a multiple-contract system. For example,
we
enter 1 market order to buy, and another limit to buy at lower price
which may not be filled. If it is filled, then later we sell 3
contracts at market rather than 2 to reverse, which resulting -1
contract, and also place 1 limit-
sell at a higher price which may be filled or not. So on and on...

nonlinear5

unread,
Jun 30, 2008, 9:28:32 PM6/30/08
to JBookTrader
> Thus we can expand JBT into a multiple-contract system. For example,
> we
> enter 1 market order to buy, and another limit to buy at lower price
> which may not be filled. If it is filled, then later we sell 3
> contracts at market rather than 2 to reverse, which resulting -1
> contract,  and also place 1 limit-
> sell at a higher price which may be filled or not. So on and on...
>

JBT already fully supports scaling strategies (i.e. strategies that
hold variable number of shares/contracts depending on condition). It's
very easy to code. For example:

if (balance >= entry) {
setPosition(1);
}
if (balance >= 2 * entry) {
setPosition(2);
}
if (balance <= -entry) {
setPosition(-1);
}
if (balance <= -2 * entry) {
setPosition(-2);
}

xjustin

unread,
Jun 30, 2008, 9:51:24 PM6/30/08
to JBookTrader
Yeah. That's a good way to enter scaled orders based on balance
indicator.
Limit order may provide extra flexibility based on price. Howeve, not
sure about the complexity it may introduce.

Gab

unread,
Jul 1, 2008, 6:45:20 AM7/1/08
to jbook...@googlegroups.com
There's another thing to consider about limit order.  Every time you cancel an order, IB charge a fee of 0.30$ or something like that.  It aint much, but after a month of consistently canceling order, it would make a big amount.

Kelvin

unread,
Jul 1, 2008, 9:27:21 AM7/1/08
to JBookTrader
I know that IB charges cancellation fee for stocks. But are you sure
that IB charge cancellation fee for futures?

On Jul 1, 6:45 am, Gab <gabrieldanca...@gmail.com> wrote:
> There's another thing to consider about limit order.  Every time you cancel
> an order, IB charge a fee of 0.30$ or something like that.  It aint much,
> but after a month of consistently canceling order, it would make a big
> amount.
>
> On 7/1/08, xjustin <xiang...@gmail.com> wrote:
>
>
>
>
>
> > Yeah. That's a good way to enter scaled orders based on balance
> > indicator.
> > Limit order may provide extra flexibility based on price. Howeve, not
> > sure about the complexity it may introduce.
>
> > On Jun 30, 9:28 pm, nonlinear5 <eugene.kono...@gmail.com> wrote:
> > > > Thus we can expand JBT into a multiple-contract system. For example,
> > > > we
> > > > enter 1 market order to buy, and another limit to buy at lower price
> > > > which may not be filled. If it is filled, then later we sell 3
> > > > contracts at market rather than 2 to reverse, which resulting -1
> > > > contract,  and also place 1 limit-
> > > > sell at a higher price which may be filled or not. So on and on...
>
> > > JBT already fully supports scaling strategies (i.e. strategies that
> > > hold variable number of shares/contracts depending on condition). It's
> > > very easy to code. For example:
>
> > >         if (balance >= entry) {
> > >             setPosition(1);
> > >         }
> > >         if (balance >= 2 * entry) {
> > >             setPosition(2);
> > >         }
> > >         if (balance <= -entry) {
> > >             setPosition(-1);
> > >         }
> > >         if (balance <= -2 * entry) {
> > >             setPosition(-2);
> > >         }- Hide quoted text -
>
> - Show quoted text -

Beastie Boy

unread,
Jul 1, 2008, 11:26:06 AM7/1/08
to JBookTrader
If a limit order is required, it would probably be less complicated,
and possibly cheaper to simulate it in JBT. If the strategy decides to
go long and the current price is 1330.50, then tell the strategy to
enter if the price reaches 1330.25, or even 1330.00. This way, there
is never a need to cancel orders that may be sat on IB servers.

nonlinear5

unread,
Jul 1, 2008, 12:51:03 PM7/1/08
to JBookTrader
That's correct. The limit orders can be simulated with the market
orders in the current version of JBT, as Beastie outlined. No code
changes in the framework are required for that, and it is fully
supported by trader, backtester, and optimizer. It is not *exactly*
the same as using limit orders, but it's pretty close.

Kelvin

unread,
Jul 1, 2008, 1:47:51 PM7/1/08
to JBookTrader
Good idea! We can trade it this way.
But, to simplify the strategy developing, we may add a pseudo limit
order function.

dyno

unread,
Jul 2, 2008, 1:08:12 AM7/2/08
to JBookTrader
It is difficult to simulate the case that the ask price never goes
down from 1330.5 and you buy limit @1330.25 is executed. This is
probably a profitable trade.

I think the bottom line is who pays for the spread.

Gab

unread,
Jul 2, 2008, 2:12:20 PM7/2/08
to jbook...@googlegroups.com

I know that IB charges cancellation fee for stocks. But are you sure
that IB charge cancellation fee for futures?
 
 
No actually, I'm not sure about that. 

 

Skyisthelimit

unread,
Jul 4, 2008, 9:19:27 PM7/4/08
to JBookTrader
Maybe you can set a limit buy order, if not filled in 5 bars, cancel
the order. If there is a sell signal within 5 bars before being
filled, order is also canceled.
Reply all
Reply to author
Forward
0 new messages