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

[amibroker] Re: How to backtest using a swing low?



PureBytes Links

Trading Reference Links

How about:

swing_low = valuewhen(L>ref(L,-1) and 
                      ref(L==lowestsince(L<ref(L,-1),L,1),-1),
                      ref(L,-1),
                      1);

This handles the case of multiple successive Lows at identical prices.

David



--- In amibroker@xxxxxxxxxxxxxxx, "foginthehills" <andrewdelin@xxx> wrote:
>
> Hi,
> 
> I want to create a SELL condition in a backtest that exits a position 
> when the Close price falls 2% below the most recent swing low. Thinking 
> of Gann or similar.
> 
> I am not clear how to define the swing low - can someone give me some 
> code how to do this in AFL?
> 
> many thanks -
> 
> Fog (Andy)
>




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/