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

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



PureBytes Links

Trading Reference Links

http://www.amibroker.com/guide/afl/afl_view.php?applystop

/* N-bar stop */ 
ApplyStop( stopTypeNBar, stopModeBars, 5 ); 


If you need to read a signal back from sell array you can use Equity(1) function
that writes back stop-generated exists to sell/cover arrays.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "vishy_sharma" <vishy_sharma@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, February 29, 2008 11:10 AM
Subject: [amibroker] exit after 'N' bars: auto trading


> 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
> 
> 
> 


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/