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

[amibroker] Using Buy / Sell signals within loops



PureBytes Links

Trading Reference Links

Hi guys,

I've been playing with simple AFL's for some time with a fair degree
of success however a recent foray into a more advanced approach
utilising looping has left me perplexed.

I have a very simple trade entry determination based on Williams %R
crossing above/below an arbitrary value which works fine.  Where I run
into difficulties is with my exit strategy which should work as
follows (from a logic perspective):

1) If Williams%R crosses below 'x', then assign the low of the day to
a static variable 'st'
2) If Williams%R is below 'x' and today's close is lower than 'st'
then Sell

This should then continue to iterate through the remainder of the
BarCount.  Extraneous triggers are removed by a susbsequent
Sell=Exrem(Sell,Buy); type of approach - I'll look at smartening it up
with an OpenPos check once I have the base level functionality working OK.

The issue I have is that I can't figure out the best approach to
determine the crossover within the for loop (given that I can't use
the Cross() function) and the AFL language checker doesn't like the
Sell variable being referenced within the loop.

I'm sure it's a simple thing that I am overlooking and problem exists
between keyboard and chair!  Does anyone have any pointers or advice
for me to get this going?

Many thanks,
Dave



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/