Dear all¡G

I test a AFL plugin example from ADK.  The fuction plugin implement the fuction 
VExampleMACD()¡A

AmiVar VExampleMACD( int NumArgs, AmiVar *ArgsTable )
{
        // First you need to fill-in
        // arguments table.
        //
        // we will call back MACD that gets two float
        // arguments:
        
        AmiVar arg[ 2 ];
                
        arg[ 0 ].type = VAR_FLOAT;
        arg[ 0 ].val = 12;

        arg[ 1 ].type = VAR_FLOAT;
        arg[ 1 ].val = 26;

        
        // Now you can call internal AFL function
        // using CallFunction callback pointer of the site interface
        // Please note that NO ERROR checking is done
        // on number/types of arguments passed
        // Specifying wrong args here ends with access violation in most cases
         AmiVar result = gSite.CallFunction( "macd", 2, arg );
        return result;
}

FunctionTag gFunctionTable[] = {
                                                                "ExampleMACD",  
        { VExampleMACD, 0, 0, 0, 0, NULL }, 
                                                                "ExampleMA",    
    { VExampleMA, 1, 0, 1, 0, NULL }, 
                                                                "ExampleEMA",   
     { VExampleMA, 1, 0, 1, 0, NULL } 
};


But when I call the fuction ExampleMACD() from AFL,aynone can tell me why AB 
report errors?

'm1' Variable used without having been initialized"
'm1' Variable used without having been initialized"

r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
m1 = ExampleMACD();
Plot( ml, StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD 
color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal 
color", colorBlue ), ParamStyle("Signal style") );
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), 
styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, 
maskHistogram ) );

Reply via email to