Question About the AFL

Hello,

The following AFL I got it from somewhere else, I want to convert to TOS, but I don't know what is the "1" mean in "BBandTop(C,20,0.5),1" and what are the "0" and "-1" mean in "BBandTop(C,20,0.5),0,-1".

Can someone explain to me or convert to TOS?

Thank you very much!

_SECTION_BEGIN("");
tf= IIf(C > BBandTop(C,20,0.5),1, IIf(C<BBandTop(C,20,0.5) AND C>BBandBot(C,20,0.5),0,-1))*10;

td=(tf+100)/2;
Colortf=IIf(td>50,colorBlue,IIf(td<50,colorRed,colorgreen));

Plot(td,"Trend",colortf ,styleDots);
_SECTION_END();

@chaser2009 you've been using AmiBroker for many years so perhaps you should become familiar with the functions and how to properly post code on the forum using code tags.

User guide reference for immediate IF

More discussion on this forum,

So the code within the nested immediate IF's will return a 1 or a 0 (zero) or a -1 depending upon the position of the Close and the Bollinger Bands. Then it multiplies by 10.

tf= IIf(C > BBandTop(C,20,0.5), 1, IIf(C<BBandTop(C,20,0.5) AND C>BBandBot(C,20,0.5),0,-1))*10;
1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.