Ed or TJ,

does GetPositionSize also return the size of open orders and not only
of open existing positions in portfolio?

Regards
Robert


--- In [email protected], "Edward Pottasch" <[EMAIL PROTECTED]>
wrote:
>
> hi,
> 
> since you check for the positionsize this should not happen.  Each
time the active chart is updated it will send this order again. Once
it is executed the positionsize should change to zero. So it seems to
me that two orders (or chart refreshes) follow eachother before the
positionsize change is known to the system.  It does not sound very
scientific but I see strange things happening (which should not be
able to occur) with the IBc as well that I can't explain.  I got a
faster internet connection and many of my problems have disappeared.
But still strange things happen. Especially if Amibroker is in the
process of backfilling data en the code below can not perform a
calculation because there is not sufficient data. The software enters
conditional statements that should not be possible. Still it does ....
> 
> regards, Ed
> 
> 
> 
> 
>   ----- Original Message ----- 
>   From: rhoemke 
>   To: [email protected] 
>   Sent: Saturday, September 30, 2006 7:24 PM
>   Subject: [amibroker] IBC sending two orders, but should send only one
> 
> 
>   Hello,
>   i got this code for putting automatic Stop when detecting an open
>   position, but it sends two stop orders at once.
> 
>   someone who can help me?
> 
>   thank you in advance
>   Robetr
> 
>   //Auto-Trailstop
> 
>   L_Trailstop = Ref(L,-1); //or whatever
> 
>   S_Trailstop = Ref(H,-1); //or whatever
> 
>   ibc = GetTradingInterface("IB");
> 
>   if(ibc.isconnected())
> 
>   {
> 
>   Position = ibc.getpositionsize(Name());
> 
>   if( Position < 0 ) 
> 
>   {
> 
>   OrderID = StaticVarGetText("OrderID" + Name());
> 
>   OrderID = ibc.ModifyOrder(OrderID, Name(), "BUY",
>   -Position, "STP", 0, LastValue(S_Trailstop), "DAY", False,
TickSize*100);
> 
>   StaticVarSetText("OrderID" + Name(), OrderID); 
> 
>   }
> 
>   if(Position > 0 )
> 
>   {
> 
>   OrderID = StaticVarGetText("OrderID" + Name());
> 
>   OrderID = ibc.ModifyOrder(OrderID, Name(), "SELL",
>   Position, "STP", 0, LastValue(L_Trailstop), "DAY", False,
TickSize*100);
> 
>   StaticVarSetText("OrderID" + Name(), OrderID); 
> 
>   }
> 
>   }
>







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 other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to