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

[amibroker] Re: Modifying delay and getting the exit price right



PureBytes Links

Trading Reference Links


> I'd like to compare my current results with the
> results of exiting at the close on the day after entry (bar 2 close
> instead of bar 3 open), but ONLY if the close on that second bar is
> less than my Buyprice from the first bar.

So basically you are gonna run 2 backtests right? One for 3-bar stop, 
and a second for the 2/3-bar stops.

> I am not sure exactly how to go about doing this.  I thought I could
> use a conditional IIF to set the delay.  For example: IIF(Ref(C,1) <
> Buyprice, delay = 1, delay = 2).  Then I thought I would do 
something
> like: IIf(delay = 1, SellPrice = Close, SellPrice = Open).

To setup the 2/3-bar stops, I wouldn't modify the delay.  I would 
leave the applystop as is, and just create a new Sell statement.  
Maybe someone else can think of something more elegant.

Something like:
NewStop = BarsSince(Buy) == 2 AND C < Ref(O, -2);
Sell = [your stuff];
Sell = Sell OR NewStop;

- chris





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

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