I think you can use:
getpositionlist() to count the number of opened positions and
and cancelAllpendingOrders() if that number is higher than 9.
On 3/6/2010 6:00 PM, B S wrote:
I use IB - is there a way to limit the number of executions one would
get using these orders? For example, say I am following 500 stocks
and have a system similar to #2 below. I would have 500
buystop/sellstop orders out, but would only want to take the first 10
that get filled. Is there a way to cancel the remaining 490
automatically? Or is there an entirely different way to manage this?
Thanks for your help.
------------------------------------------------------------------------
*From:* CorvidSys <[email protected]>
*To:* [email protected]
*Sent:* Fri, February 26, 2010 1:53:05 PM
*Subject:* [amibroker] Re: What do I need Buystop/Sellstop for?
Buystop/Sellstop are limit (or market) prices that are managed by the
exchange rather than triggered from your system.
Two examples if where it can help you:
1. If an event triggers your system, let's say a MovingAverage
crossover and let's also say that you are using the closing price of
the bar that triggered that event as your entry Limit-Buy price, there
is a good chance that the market will move away from your limit price
by the time your order hits the exchange.
If however you could determine what closing price would trigger the
crossover, you could have a Buy-Stop sent to the market before that
event happens.
2. For channel breakout/breakdown, where you have no idea whether the
market will break above or below but you are interested of going long
or short based upon which way it breaks, you could "bracket" that
channel with a buy-stop and a sell-stop. If it breaks to the up-side
you have a pre-existing order that is managed by the exchange,
likewise if it breaks down.
Of course with STOP orders, all exchanges will disclaim assurances
that you will ever get filled, you just have a better chances of
getting there.
They are very useful order types once you know how to use them and
learn to accept their limitations.
--- In amibro...@yahoogrou ps.com
<mailto:amibroker%40yahoogroups.com>, "Markus Witzler" <funny...@.. .>
wrote:
>
> Hello,
>
> I wonder what I need buystop/sell stop for.
>
> Isn“t it just enough to specify buy rule
>
> buy = ...
>
> and then set the
>
> buyprice = ...
>
> To simulate a buy stop condition, IMO one would just need to set the
buyprice accordingly.
>
> Where does buy stop here come into play?
>
> Thanks
>
> Markus
>
>
>
> __________ Information from ESET Smart Security, version of virus
signature database 4668 (20091207) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset. com <http://www.eset.com/>
>