Amibroker For Dummies........a Beginner's Forum On How To Use Amibroker

will this thread serve its purpose?

  • yes

    Votes: 397 93.2%
  • no

    Votes: 29 6.8%

  • Total voters
    426

manishchan

Well-Known Member
Anyone can help me ... how to write afl that would open say 2 pane. I want to plot
1) say price first pane
2) macd second pane
3) another indicator like this..
No need to write afl for multiple panes.. you can do it in Ami bye default. ie ... if you have price pane showing.. then just go to other afl.. do right click and do "insert linked".. it will come in a diff pane.
 
Can you tell me how to save an AFL as a function so it can be referenced in any other code when needed, just like the inbuilt functions? ie how would you save and access this borrowed code -

//Transform DateNum (e.g., 1040928 or 921114) to String mmddyyyy (e.g., 09/28/2004 or 11/14/1992)
function DateToStr(nDate)
{
string = StrFormat("%7.07g", nDate);

//extract string part
yy = StrLeft(string, 3);
mm = StrMid(string, 3, 2);
dd = StrRight(string, 2);

yy = StrToNum(yy) + 1900; //CORRECT BEFORE AND AFTER 2000

return mm + "/" + dd + "/" + NumToStr(yy, 1, False);
}

Many thanks
 

rpc

Active Member
It is already saved as a function. Just call it. Make sure call is made AFTER the function is declared.
eg after function ends enter follo code

strDate = DatetoStr(1040928); // now u have date-"28/09/2004" in strDate variable
 
It is already saved as a function. Just call it. Make sure call is made AFTER the function is declared.
eg after function ends enter follo code

strDate = DatetoStr(1040928); // now u have date-"28/09/2004" in strDate variable
Thanks for the response, but I didn't make myself clear. What I wanted is a way to save this or any other new function so that they can be called from any new code without copying and pasting, in the same way that you can use any of the Amibroker supplied inbuilt functions without actually copying the entire code in to your new project.
 

rpc

Active Member
you can put them in a different afl and call it using
#include <yourafl.afl>
at the top of your afl from where you want to call it.
Don't forget to provide the path where you are storing yourafl.afl in prefernces tab
 

Similar threads