[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: New to Amibroker - How to create a function for use from another indicator



PureBytes Links

Trading Reference Links

When you create an include you just open a new formula and give it a name and save it somewhere, anywhere. I recommend the Ami Formulas>Include file. You can create sub folders there too. The include can contain constants, parameters, functions or whatever you dream up.

To locate it you need to write an #include statement. Depending on where you store it, you can use the system library directive < ... > or you will have to define the complete path and use " ... ". Examples below;  

Then you can use the system include library directive such as
#include <myInlcude.afl>

or if you put it in a sub folder in the include folder
#include <subfolder\myInlcude.afl>

OR if you put it in a common folder on your C drive then you have to define the complete path
#include "C:\YourAmiIncludeFolder\myInlcude.afl"

Or to the Ami formulas folder you would use something like this
#include "C:\Program Files\AmiBroker\Formulas\Include\myInlcude.afl"

One thing about includes. They can use global variables but then your include has to be inserted in your code AFTER the globals. In Ami any variable you declare in the main line code before it is used is global. You don't have to use global varName = xxx; 

Barry


 --- In amibroker@xxxxxxxxxxxxxxx, Tony Grimes <Tonez.Email@xxx> wrote:
>
> The price array identifier AVE- which is the typical price, is the same as
> your pivot point price.
> 
> Look up #INCLUDE, if you want to a external AFL inside another AFL.
> 
> On Wed, Apr 8, 2009 at 7:46 PM, neil.wrightson <neil.wrightson@xxx>wrote:
> 
> >
> >
> > Hi,
> >
> > As per above, I just bought Amibroker and it looks good so far.
> > I want to create a Pivot point price (may already exist in Amibroker but I
> > have not found it yet) that I can use in other indicators I develop.
> >
> > The function is
> >
> > function PPrice ()
> > {
> > return (High+Low+Close)/3;
> > };
> >
> > I then save this as PPrice.afl but if I then create another function and
> > attempt to use it from within this function I get a syntax error.
> >
> > i.e.
> > Plot( PPrice(), "Fast", ParamColor( "Fast Color", colorBlue ),
> > ParamStyle("Fast") );
> >
> > I know I can put the above function text into the same indicator as the
> > plot but this does not make for easily usable code (units).
> > I'm also a Pascal (Delphi) programmer :-)
> >
> > Neil.
> >
> >  
> >
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/