PureBytes Links
Trading Reference Links
|
Ron,
Not sure exactly what youıre trying to accomplish, but AFL is an array
processing language. Itıs confusing at first if youıre used to regular
program code. This statement you have written: "x =
IIF(C==LLV(C,300),true,false)" works for every bar (every day) in the
database all at once. x will be true when the current dayıs low is
equivalent to the low of the past 300 days.
If youıre trying to figure out what day the low value of the last 300 days
occurred you might try: y = BarsSince(LLV(C,300));"
Which tells you how many bars ago (from the current day) the low occurred.
Better check to see what happens when current day is the low. I check by
plotting results.
If you want a real loop to do this day by day, which I donıt think you need,
do something like this (untested) looping code:
for ( i = 300; i < BarCount - 1; i++)
{
//your lines of code go here, as many as you need such as
// i will be the bar (day) you are testing
// BarCount = total number of bars (days) in your database
// BarCount is zero based so the last bar = BarCount 1
for ( j = i - 300; j <= i ; j++)
if (C[j] < C[j-1])
{
low[j] = C[j];
lastLowBar[j] = j;
}
lowBarLast300[i] = lastLowBar[i];
// and so on to accomplish your goal.
}
You can find more on looping in Help. Search for For-Next.The top choice
will be AFL Reference Manual. It is at the bottom. (Yes, this is HARD to
find.)
Terry
-
> Try as I may, I still have not been able to get my mind to create a simple
> loop. I have read the manual, and studied a lot of posts regarding looping,
> but I still can't get it.
>
> I would sure appreciate it if someone would convert the below pasted
> "IIF(C==LLV(C,300)" into a complete working loop that will continue to check
> each day up to the current day.
>
> Having complete working codes of something that I am interested in is about
> the only way I have been able to learn new things in AFL.
>
> TIA Ron D
>
>
>
> Day11=IIf(item==LLV(item,289)Day12);
>
> Day10=IIf(item==LLV(item,290)Day11);
>
> Day9=IIf(item==LLV(item,291),Day10);
>
> Day8=IIf(item==LLV(item,292),Day9);
>
> Day7=IIf(item==LLV(item,293),Day8);
>
> Day6=IIf(item==LLV(item,294)Day7);
>
> Day5=IIf(item==LLV(item,295),Day6);
>
> Day4=IIf(item==LLV(item,296),Day5);
>
> Day3=IIf(item==LLV(item,297),Day4);
>
> Day2=IIf(item==LLV(item,298)Day3);
>
> Day1=IIf(item==LLV(item,299),Day2);
>
> Day0=IIf(item==LLV(item,300),Day1);
>
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/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/
|