Hello Thomasz, thank you. This is what i also suspected, but why do i get multiple orders? I check for poitionsize, and then send Stop-Order (new order if OrderID is empty and modify existing Order if OrderID of stop still exists) so this should only produce one new order if there is no existing stop order. maybe i send this to support with screenshots, when TWS opens this evening? Or is it just a simple mistake i make? I'm so confused now, sorry :)
Regards Robert --- In [email protected], "Tomasz Janeczko" <[EMAIL PROTECTED]> wrote: > > Hello, > > It return the size of existing postion (for given symbol) in your IB account (the same as in TWS "account" page). > More information about IBc is available at: > http://www.amibroker.com/at/ > > > Best regards, > Tomasz Janeczko > amibroker.com > ----- Original Message ----- > From: "rhoemke" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Sunday, October 01, 2006 12:03 PM > Subject: [amibroker] Re: IBC sending two orders, but should send only one > > > > 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" <empottasch@> > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > 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/
