Beginner AFL Program writers Thread

riser3

Active Member
#1
Dear Traders

This Thread is dedicated to all new program writers of AFL who want their programs to be effective and sophisticated.
Way of Posting in this thread
1)
So please post your program using code bar so that experienced code writers can have a look rather than downloading (saving time)
2)
Please write the goal of that program to be achieved in simple language (to avoid repetetive replies and time waste)

Senior Code writers are requested to resolve the problems of code and help in making better afl's

Suggestions from other traders in this regard are welcome
Please reply if you tink this thread helps us

Regards
Brijwanth
 

riser3

Active Member
#2
Here is my first one
experienced code writers please comment on corrections and suggestions

Code:
// Displays of todays Low is Lowest in 20 days 
i=0;
i=LLV(l,20)-low;
if (i=0)
printf ("Today is lowest in 20 days for %s",name()); 
addcolumn(Low, "Lowest");
buy=0;
sell=0;
Reason: To find if todays Low is Lowest in 20 days
 
#5
Dear Traders

This Thread is dedicated to all new program writers of AFL who want their programs to be effective and sophisticated.
.....
Hello Brijwanth,

All the best for the new initiative. Hope this thread becomes one stop place to post all the doubts in AFLs.

It will be better if we go through the Amibroker User Guide for any quick reference and detailed explanation of AFL functions, first. If we have doubts in their functionality or codes, AFL known members can always help them.

Regards,
Praveen.
 
#6
Here is my first one
experienced code writers please comment on corrections and suggestions

Code:
// Displays of todays Low is Lowest in 20 days 
i=0;
i=LLV(l,20)-low;
if (i=0)
printf ("Today is lowest in 20 days for %s",name()); 
addcolumn(Low, "Lowest");
buy=0;
sell=0;
Reason: To find if todays Low is Lowest in 20 days
Hi,

I'm afraid there is some logical errors in this code.

1. LLV(l,20)-low : returns an array and not a single boolean value. Hence it can't be compared in a 'if' statement at one shot.

2. if(i=0) : A very common error. 'if' statement needs boolean value and hence the expression inside the 'if' statement should return boolean value. But if you see "i=0", we are just assigning the value zero(0) to i and we are not comparing i to zero. So the correct usage of 'if' should be
if (i == 0) // i shouldn't be an array

Let me know if I'm wrong or understood the actual requirement wrongly.

Praveen.
 
#7
Modified code to check whether today's low is 20 day's low:

Code:
// Displays of todays Low is Lowest in 20 days 

i = (L == LLV(L, 20));
Filter = i;
AddColumn(Low, "Lowest");
Regards,
Praveen.
 

rkgoyal_98

Well-Known Member
#9
Dear seniors,

I am novice at trading as well as use of AFLs. So I need help. I wnat to write and AFL where Buy signal can be generated when prices are at the lower extream of Bolinger Band ( 20 period with 2 deviation) and also 5period smoothed line cross 72 period CCI. Reverse for the sell signal i.e. when price will be on the upper extream and again 5 smooth cross over to the otherIf Some one can explain the various things used in the AFL it will be helpful.
Please also advise if any learning book/site for the AFL is available.
I need to begin from ABC.
Thanks

Rajeev
 
#10
Modified code to check whether today's low is 20 day's low:

Code:
// Displays of todays Low is Lowest in 20 days 

i = (L == LLV(L, 20));
Filter = i;
AddColumn(Low, "Lowest");
Regards,
Praveen.
Thank you for the afl. the turtle traders went for stocks which made a 20 day high. Saw the afl today

Thanx
bamks
 

Similar threads