Starting to mess with bracket orders. Added a stop and target to Herman’s
testing prog.

 

HYPERLINK
"http://www.amibroker.org/userkb/2007/07/12/testing-your-ab-ibc-tws-communic
ation/"http://www.amibroker.org/userkb/2007/07/12/testing-your-ab-ibc-tws-co
mmunication/

 

Confused on how I can retrieve the orderID for the 2nd order (the SELL LMT
order)

 

longID = StaticVarGetText( "OrderID" );

 

if ( BuyOrderTrigger )

{

     longID = ibc.PlaceOrder(Name(), "BUY", 1, "MKT", 27, 0, "DAY", False );

  

     ibc.PlaceOrder(Name(), "SELL", 1, "LMT", 690.00, 0, "DAY", False, 1000,
"",longID ); 

 

     ibc.PlaceOrder(Name(), "SELL", 1, "STP", 670.00, 670.00, "DAY", True,
1000, "", longID );

  

}

 

If I understand it correctly PlaceOrder retrieves an orderID from the IBC
for the first order, on each subsequent call to PlaceOrder the orderID is
incremented by 1. 

 

When I use this code  StaticVarSetText( "OrderID", longID ); I get the
orderID of the first order in the bracket and I then know the orderID of the
second order is longID + 1, I just don’t know how to reference it in code
properly this is what I have been trying:

 

targetID = longID + 1;

 

targetID = ibc.ModifyOrder( targetID, Name(), "BUY", 1,"LMT", LastValue( C )
+ 0.60, 0, "Day", True ); 

 

but that is not working, but I can substitute the actual id # and then it
modifies the second order so I know I am close

 

targetID = 413;

 

Can someone help me out?

 

thanks,

Bruce

 

 


No virus found in this outgoing message.
Checked by AVG. 
Version: 7.5.519 / Virus Database: 269.22.1/1346 - Release Date: 3/27/2008
10:03 AM
 

Reply via email to