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

[amibroker] Modifying delay and getting the exit price right



PureBytes Links

Trading Reference Links


Hello,

I'm trying a simple system with an exit on the open two days after the
buy.  I'm initializing delay = 2, then using applystop like this:
ApplyStop( stopTypeNBar, stopModeBars, delay, True, True) to get the
exit on the right bar.  Sellprice is the Open.  To this point, I'm not
having any problems.  The backtester is producing entries and exits
where they should be, and at the correct prices.

Here is my question.  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.

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

But this doesn't work, apparently.  All trades are still 3 bars. 
Sorry, but I have never programmed anything other than a VCR before,
and this is kind of tough for me.

RG





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/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/