Call function or procedure

I am learning AFL. I need to make Paramlist and then plot RSI, MACD and MA20.

OrderDraw = ParamList("Choose me", "RSI|MACD|MA20");
Switch (OrderDraw)
{
case "RSI":
   drawRSI();
   break;
case "MACD"
   drawMACD();
   break;
case "MA20";
   drawMA20();
   break;
}

Function drawRSI()
{
EnableScript("vbscript");
//And then below is vbscrip for example
<%
Select case 
   Case 1 ....
   Case 2 .....
End Select
%>
Plot(RSI)  // bla bla bla. 
}
(continiuos)

Please help to clear my idea. Thanks for your help.

Choosing various plotting indicators as an example is not the best choice.
For plotting various combinations of indicators, you will achieve it more optimally using Chart sheets and Layouts.
https://www.amibroker.com/guide/h_sheets.html

Also, avoid EnableScript() and it is used very rarely for specific requirements only, not general AFL programming.

If you browse through the forum, there are very many examples of well written AFL codes and maybe that is a better way to learn AFL. Copy them, tweak them and study changes. Even basic concepts will be cleared.

2 Likes

Thanks you for your reply.
I want to compare MACD of a symbol with MACD of index or MACD of Industry (and RSI, and MA20). BTW, I am thinking about an overall picture of a stock relative to its industry.
Please help me code to let me learn.
Thks.

1 Like

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