Your right...
Goes to show ya I really am coming up from the bottom on this...
I think the premise is sound in terms of time
I myself dont (wont) quibble to much on this. I just threw this out
there...
Probably a whole hell of a lot better to stick another dimension in
an array and just time stamp the call
Thanks for pointing out the obvious flaw. On the otherhand though,
crafty order id assignment could be an advantage i suppose
Scott
FWIW: I didn't know an IF statment from Jack's Shinola 6 months
ago...but I am trying like the dickens to learn fast...its the damn
logic that beach slaps me down every time....
Thansk
--- In twsapi@y..., "David" <kotomo@p...> wrote:
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.
----- Original Message -----
From: marinindextrader
To: twsapi@y...
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@y...
Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.