[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] exit after 'N' bars: auto trading



PureBytes Links

Trading Reference Links

Hi,
In my strategy when I get into a position(for e.g long) then there is 
a stop order also placed. My exit is after specific number of bars
(for e.g 10).
Can somebody give me code example as to how to club this stop order 
and sell order after 'N' bars into one group.
The specific code snippet is 

// hold the buy signal for 9 bars
Buy = ExRemSpan(Buy,9);
// generate the sell signal at 10th bar
Sell = Ref(Buy,-10)

// Now when buy is 1 first time, I should place order with stop as 
// well as sell after specific time using GAT
// but then after 10 bars I assume I will have to ignore Sell
// but this is where it gets tricky
// I can have a buy signal generated at the exit bar thats why I have
// buy held upto 1 bar less than exit
// if there is a buy signal generated at the exit signal then Sell
// signal from previous buy should be ignored (in auto trading 
// the sell order would have been executed by this time)
// the stop order should be modified to include a new price and then
// exit order should be placed after 10 new bars

I am new to amibroker. If there is anyone in this forum who can 
provide consultancy to write the auto trading code then please 
contact me urgently.




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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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