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

[amibroker] Call AFL plugin fuctions,why got "Variable used without having been initialized"



PureBytes Links

Trading Reference Links

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 ) );



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

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