开云体育

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

twsapi: Re: Help! Cancel order


jaba_z
 

Hey Bruce, and I thought that the project I put on my pitiful website
was good enough... :)

regards
Jaba

--- In twsapi@y..., "marinindextrader" <marinindextrader@y...> wrote:
"Flyin an airplane is really simple too if you know how to do it. LOL"

Yep....its the landings that are tricky....

Scott



--- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...> wrote:
Flyin an airplane is really simple too if you know how to do it. LOL

Thanks for pointing me in the right direction I will see if I can
figure this out.

Have a safe holiday.

Bruce
----- Original Message -----
From: mk_trading_911
To: twsapi@y...
Sent: Thursday, July 04, 2002 7:00 AM
Subject: twsapi: Re: Help! Cancel order


Bruce, it's really simple.

existingId = Cells(ActiveCell.row, 13).value

it means that existingId get's loaded with whatever there is in
the
column 13 of the active row on the spreadsheet. then it passes
that
number to tws1.cancelOrder, and it cancels it.

Since you don't have spreadsheet, you need to store that ID
number
when you send your buy/sell order for execution. Or, a bit more
complicated, request open orders, get their IDs and use one of
them
to cancel that order.

MK

--- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...> wrote:
> First of all thanks for the response, here is the code in Excel
>
> Sub cancelOrder()
> clearError
>
> ' get existing id
> Dim existingId As Long
> existingId = Cells(ActiveCell.row, 13).value
>
> ' cancel order
> Sheet5.Tws1.cancelOrder (existingId)
> End Sub
>
> Maybe I did not make it clear but I am trying to come up with a
stand alone program, that being said in the code above there
> is references to sheets and cells which don't exist in my prog.
I
am not sure what to put in there place.
>
> Thanks,
>
> Bruce
> ----- Original Message -----
> From: mk_trading_911
> To: twsapi@y...
> Sent: Thursday, July 04, 2002 6:21 AM
> Subject: twsapi: Re: Help! Cancel order
>
>
> Open the workbook, and press Alt-F11. Visual Basic for
Applications
> should appear. All the code for cancelling an order is on
sheet2
> (Orders).
>
> What part of the code do you have a problem with, exactly?
> MK
>
> --- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...> wrote:
> > Thanks for the response, and if I was a little more savy
regarding
> VB what you sent would be helpful.
> >
> > I have looked at user's guide and Excel code trying to come
up
with
> what I need and I can't figure it out.
> >
> > But thanks anyway.
> >
> > Bruce
> > ----- Original Message -----
> > From: mk_trading_911
> > To: twsapi@y...
> > Sent: Thursday, July 04, 2002 6:04 AM
> > Subject: twsapi: Re: Help! Cancel order
> >
> >
> > Either: store in your application's globals the ID number
of
the
> > orders you are sending, and their status, or extract them
from
> TWS
> > (Tws1.reqOpenOrders). Once you know the ID, then use:
> > Tws1.cancelOrder (orderId). It's all in the Excel
spreadsheet
VBA
> > Macros, and user's manual.
> > I hope this helps.
> >
> > MK
> >
> >
> > --- In twsapi@y..., "Bruce Hawkins" <hawkinsk001@h...>
wrote:
> > > I have been struggling with this for 2 days, does
anyone
have
> VB
> > code for canceling a pending order. I 've tried 6
> > > ways from Sunday to make it work and I am totally lost.
> > >
> > > Thanks,
> > >
> > > Bruce
> >
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > twsapi-unsubscribe@y...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> Service.
>
>
> Yahoo! Groups Sponsor
>
>
> To unsubscribe from this group, send an email to:
> twsapi-unsubscribe@y...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


Yahoo! Groups Sponsor
ADVERTISEMENT



To unsubscribe from this group, send an email to:
twsapi-unsubscribe@y...



Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.

Join [email protected] to automatically receive all group messages.