[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Confused about orderID's



PureBytes Links

Trading Reference Links

NEVER change OrderIDs or try to calculate them yourself. It is not a variable that is or can be controlled by the user.


Its been awhile since I played with bracket orders, however I would think that you can retrieve OrdeIds as i added to your code in Red, and save them in Staticvar for later use.


best regards,

herman




For tips on developing Real-Time Auto-Trading systems visit:

http://www.amibroker.org/userkb/


Friday, March 28, 2008, 8:01:34 AM, you wrote:


>

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

 

http://www.amibroker.org/userkb/2007/07/12/testing-your-ab-ibc-tws-communication/

 

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 );

  

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

 

     MaxLossSellOrderID = 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

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___