Scott,
the problem with your code is that if you put orders
through? one after the other, TWS will complain about the duplicate order
as they will be (the orderid i mean) separated by 1 to 2 seconds(numbers
apart)
another way is to
Public gblOrderId&()
DIM IC%
?
ReDim Preserve gblOrderId(IC)
IC = IC + 9
gblOrderId(IC)
= DatePart("YYYY", Date) & DatePart("M", Date) & DatePart("Y", Date)
& IC
?
This way you know the day of the year and all orders of that
day, and you cancel any orders that not filled through the gblOrderId() array.
Of course, you would need to monitor it through the OrderStatus
event.
?
Thanks
David
PS Andrew your comments about sharing and not sharing are
disturbing...
when I helped you i did know that you had something to offer
(AI).
Just go with the flow... you may enjoy it. I would not mind
seeing your bit on AI anyway.
?
toggle quoted message
Show quoted text
----- Original Message -----
Sent: Monday, June 24, 2002 7:10 AM
Subject: twsapi: Re: VB Sample Project:
How To Place An Order
Here is the footnote I left off concerning order id's,
thier creation
and value.
Why choose an arbitrary value for an
order id?
I might suggest that your order id system be based on time.
Using various functions one can extract a string from the system time
and date, convert it to a long value and then and use this as an id.
Why would one want to do this?
If they were (in the future) to
decide to capture all trades and
store in a database, the id can be
reconverted into its date value
and reports can be printed on a time
basis.
Here is a crude example of creating an id based on date and
time:
Example Date: 6/20/02 10:24:17 AM
Private Sub
Command2_Click()
Dim newString As String
Dim newId As Long
newString
= newString & Month(Date)
newString = newString &
Day(Date)
newString = newString & DatePart("h", Now)
newString =
newString & DatePart("m", Now)
newString = newString &
DatePart("s", Now)
Text1 =
newString?????? 'displays 620102417; a unique
number
newId = CLng(newString) 'convert to long value
'this value is
within the confines of Long type data: 2,147,483,647
End
Sub
There are other reasons to manipulate the order
id...
What if you want your id to be based on a conditional check of
the
symbol...for instance all trades with cisco will be between X and
Y...
Or...if you trade options you might want an order prefix that
describes where in the money you are...or something like that..
I dont
know much about options specifications
Or...you may want use an
ordering system that relates to the type of
trade it was...Long or
Short...
The choices are endless, and to dismiss everything but an
arbitrary
system is ridiculous
If your storing the number...put it
to work
Scott
Owner TWS API Yahoo Discussion Forum
"The other
Yahoo Board"
heheheheh
To unsubscribe
from this group, send an email
to:
twsapi-unsubscribe@...
Your use of
Yahoo! Groups is subject to the .