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: [email protected]
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);
}