PureBytes Links
Trading Reference Links
|
Looks like you modified the code as now it is
if( Position > 0 )
Sz= ibc.getpositionsize(Name()); <--- ONLY THIS PART IS CONDITIONAL !
{ // the following block is UNCONDITIONAL
While it should be:
if( Position > 0 )
{
Sz= ibc.getpositionsize(Name()); // THIS HAS TO BE INSIDE CURLY BRACES BLOCK
// retrieve orderID from previous run, will be empty if no order was placed before
stopOrderID = StaticVarGetText("OrderID"+Name());
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: laster
To: amibroker@xxxxxxxxxxxxxxx
Cc: 'AMIBROKER SUPPORT'
Sent: Thursday, December 21, 2006 5:38 PM
Subject: [amibroker] Recent changes to IB calls?
Hi,
Until yesterday the following code reported correctly short and long positions. Now is sending orders even if position is negative. Any clues?
if( Position > 0 )
Sz= ibc.getpositionsize(Name());
{
// retrieve orderID from previous run, will be empty if no order was placed before
stopOrderID = StaticVarGetText("OrderID"+Name());
// place or modify the order - don't transmit yet
OrderID = ibc.ModifyOrder( OrderID, Name(), "SELL", sz*2, "LMT", Prss, 0, "Day", True );
// store orderID for next run so we know which order to modify
StaticVarSetText("OrderID"+Name(), OrderID);
}
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.15.26/594 - Release Date: 12/20/2006 3:54 PM
|