There are a couple of ways to do this. 1. Send and order. In your code monitor for the fill. Then get the the fill price. Then send a trailing order 15% above or below the fill price, i.e. stop price = trade price * 1.15 for short positions or trade price * 0.85 for long positions.
2. Send a bracket order with the buy or sell order as a SPT order with the stop price and then send a bracket trail with the stop set 15% away from the buy STP price as above for long or short positions. I put some code in the AFL library. Search the AFL lib using Author Barry and look at the manual bracket order code to see how to structure a bracket order. I also put an auto trading program in the AFL library called AutoTrader Basic Flow. If you want to modify AutoTrader code to either have it get the trade price and send another order as a trail or use brackets have a go. Have fun, Barry --- In [email protected], "guhu0434" <g....@...> wrote: > > Hello Guys, > > I have too a question concerning the IB plugin. > > I want to send a trailing stop order with for an example of 15%. > > I read the documentation at http://www.amibroker.com/at/. > > There I saw the possibility to creat a order of type "TRAIL", but I do > not see the chance to pass the "15%" as a parameter. StopPrice will > only take a real number. > > How can I achieve it? > > Any help is appreciated > > GuHu >
