Hi, Thank you for the reply.

Before posting the question, I also did some search at the at forum and IBC 
read me section, but I could not find the answer.

I found some real time trail stop management samples from Barry. To avoid the 
possible internet disconnection, I would prefer to place the trail stop as 
attached orders with my entry orders.

I'd appreciate it very much If someone could show me the correct way to place 
Trail order through IBc.


--- In [email protected], reinsley <reins...@...> wrote:
>
> 
> Many answers in the forum "Auto Trading":
> 
> [email protected]
> 
> Best regards
> 
> 
> 
> Le 13/04/2010 16:58, XIAOFEI a écrit :
> >
> > Has anyone here using IBC to place trail orders?
> >
> > I tried different following( I plan to have 3 points above selling 
> > price as trail order):
> > SellOrderID=ibc.PlaceOrder( "TFM0-NYBOT-FUT", "Sell", 1, "LMT", 
> > LastValue(C), 0, GTC, False );
> > ibc.PlaceOrder("TFM0-NYBOT-FUT", "Buy", 1, "TRAIL", 0, 3, "GTC", True, 
> > 1000, "", SellOrderID );
> >
> > Or
> > SellOrderID=ibc.PlaceOrder( "TFM0-NYBOT-FUT", "Sell", 1, "LMT", 
> > LastValue(C), 0, GTC, False );
> > ibc.PlaceOrder("TFM0-NYBOT-FUT", "Buy", 1, "TRAIL", 3, 3, "GTC", True, 
> > 1000, "", SellOrderID );
> >
> > Or
> > SellOrderID=ibc.PlaceOrder( "TFM0-NYBOT-FUT", "Sell", 1, "LMT", 
> > LastValue(C), 0, GTC, False );
> > ibc.PlaceOrder("TFM0-NYBOT-FUT", "Buy", 1, "TRAIL", 0, 
> > LastValue(Trailprice), "GTC", True, 1000, "", SellOrderID 
> > );//Trailprice=C+3;
> >
> > All above orders are transmitted and placed by IB, but none of them 
> > work as the way should be. All above trail orders are triggered once 
> > the parent order transmitted. I read the IB "view audit Trail" on all 
> > trail orders or peg order's "place order section": AuxPrice=3 or 
> > Trailprice whatever the price assigned, but they all show "Stopprice=0.1;
> >
> > If I try manually to place the trail order, it works. I can see "place 
> > order" section from "view audit trail": AuxPrice=3 only (there is no 
> > Stopprice=0.1)
> >
> > Although the sell trail orders do not bust right away, they have the 
> > same problem "Stopprice=0.1"(the trail stop is not 3 points below the 
> > current price).
> >
> > Can anyone here to show me the correct way to place trail orders?
> >
> > Thanks
> >
> > --- In [email protected] <mailto:amibroker%40yahoogroups.com>, 
> > "Padhu" <ccie8340@> wrote:
> > >
> > > hello,
> > >
> > > this is a work in progress for me...but you can get idea from below 
> > code.
> > >
> > > // CODED BY PADHU ON 08/08/2007
> > >
> > > ibc = GetTradingInterface("IB");
> > >
> > > STOP=1.3665;
> > >
> > > LIMIT=1.3705;
> > >
> > > BuySTOP=1.3695;
> > >
> > > TICKS=1;
> > >
> > > JPY_TICKS=0.01;
> > >
> > > Broker_Symbol="EUR.USD-IDEALPRO-CASH";
> > >
> > > Quantity=25000;
> > >
> > > //
> > >
> > > ibc = GetTradingInterface("IB");
> > >
> > > if( ibc.IsConnected() ) // check if connection to IB was successfull
> > >
> > > {
> > >
> > > // BUYSTOP to enter a long position followed by a TRAILINGSTOP LOSS 
> > ORDER
> > >
> > > //parentID=ibc.PlaceOrder(Broker_Symbol,"Buy", Quantity, 
> > "STPLMT",Limit,Buystop, "GTC", False,100,"" ); // place order but do 
> > not transmit yet
> > >
> > > // ibc.PlaceOrder(Broker_Symbol,"Sell", Quantity, "TRAIL",0,STOP, 
> > "GTC", True, 100, "", parentID);
> > >
> > > }
> > >
> > > if( ibc.IsConnected() ) // check if connection to IB was successfull
> > >
> > > {
> > >
> > > //parentID = ibc.PlaceOrder(Broker_Symbol, "Buy", Quantity, "STP", 
> > 0, BuySTOP, "GTC", False,TICKS );
> > >
> > > // ibc.PlaceOrder(Broker_Symbol, "SELL", Quantity, "LMT", LIMIT, 0, 
> > "GTC", False, TICKS, "", parentID );
> > >
> > > // ibc.PlaceOrder(Broker_Symbol, "SELL", Quantity, "STP", 0, STOP, 
> > "GTC", True, TICKS, "", parentID );
> > >
> > > // Bracket order // place order but do not transmit yet
> > >
> > > //parentID = ibc.PlaceOrder("GBP.JPY-IDEALPRO-CASH", "SELL", 25000, 
> > "STP", 0, 238.55, "GTC", False );
> > >
> > > //ibc.PlaceOrder("GBP.JPY-IDEALPRO-CASH", "BUY", 25000, "LMT", 
> > 238.00, 0, "GTC", False, 100, "", parentID );
> > >
> > > //ibc.PlaceOrder("GBP.JPY-IDEALPRO-CASH", "BUY", 25000, "STP", 0, 
> > 239.25, "GTC", True, 100, "", parentID );
> > >
> > >
> > >
> > > //LimitBuy = D1+A1;
> > >
> > > //parentIDLong = ibc.PlaceOrder(Name(), "BUY", 1, "LMT", LimitBuy, 
> > 0, "DAY", False );
> > >
> > > //ibc.PlaceOrder(Name(), "SELL", 1, "LMT", LimitBuy+B1, 0, "DAY", 
> > False, 1, "", parentIDLong );
> > >
> > > //ibc.PlaceOrder(Name(), "SELL", 1, "TRAIL", C1, C1, "DAY", True, 1, 
> > "", parentIDLong );
> > >
> > >
> > >
> > > // BUYSTOP WITH TRAILINGSTOP ORDER
> > >
> > > //parentIDLong=ibc.PlaceOrder("EUR.NZD-IDEALPRO-CASH", "BUY", 25000, 
> > "STPLMT", 1.9498,1.9488, "GTC", False,1,"" ); // place order but do 
> > not transmit yet
> > >
> > > // ibc.PlaceOrder("EUR.NZD-IDEALPRO-CASH", "SELL", 25000, 
> > "LMT",1.9510, 0, "GTC", False,1,"",parentIDLong);
> > >
> > > // ibc.PlaceOrder("EUR.NZD-IDEALPRO-CASH", "SELL", 25000, 
> > "TRAIL",1.9450, 1.9450, "GTC", True, 1, "", parentIDLong);
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: dralexchambers
> > > To: [email protected] <mailto:amibroker%40yahoogroups.com>
> > > Sent: Saturday, September 22, 2007 10:42 AM
> > > Subject: [amibroker] Bracket Order with IB Auto-Trading interface
> > >
> > >
> > > Hello - I am trying to create a Bracket Order with the IB Auto-
> > > Trading interface. This would be like this:
> > >
> > > - Buy if price reaches x
> > > - If price reaches x and buy order triggered, enter a stop loss sell
> > > order at y
> > >
> > > Can anyone help with how I would do this?
> > >
> > > Thank you,
> > > Alex
> > >
> >
> >
>


Reply via email to