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

Reply via email to