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

[amibroker] Re: Global Parameter?? Success!!



PureBytes Links

Trading Reference Links

My thanks to Herman, dingo, Dimitris, and Ara for your help. For the 
info of anyone else who's interested in doing this sort of thing, 
here are my modified test files which produce the result I've been 
seeking. Access the right-click parameter box in the Parameters pane, 
move the slider as desired, close the box, hit F5, and the ATR and 
RSI indicators are immediately updated to the new period value. The 
TestPeriod.par file created by the SS function is stored in the main 
AmiBroker folder and re-saves itself automatically whenever the 
slider is moved (even before the parameter box is closed). Now the 
fun can begin. Here are the files:


*** File ...\AmiBroker\AFL\Parameters.afl ***

/* -- Parameters -- */

function SS(FileName,String)
	{
	fh=fopen(FileName,"w");
	if(fh)
		{
		fputs(String,fh);
		fclose(fh);
		}
	return fh;
	}

TestPeriod=Param("TestPeriod",10,5,20,1);
TestPeriodString=NumToStr(TestPeriod,1.0);
SS("TestPeriod.par",TestPeriodString);

Title="\\c55"
+Name()
+"\\c42    Parameters"
+"\\c49    TestPeriod: \\c55"
+WriteVal(TestPeriod,1.0);


*** File ...AmiBroker\AFL\TestATR.afl ***

/* -- TestATR -- */

function RS(FileName)
	{
	fh=fopen(FileName,"r");
	Str=fgets(fh);
	return Str;
	}

TestPeriodString=RS("TestPeriod.par");
TestPeriod=StrToNum(TestPeriodString);

Plot(ATR(TestPeriod),"",colorPink,styleLine);

Title="\\c55"
+Name()
+"\\c42    TestATR"
+"\\c49    TestPeriod (for graph): \\c55"
+WriteVal(TestPeriod,1.0);


*** File ...AmiBroker\AFL\TestRSI.afl ***

/* -- TestRSI -- */

function RS(FileName)
	{
	fh=fopen(FileName,"r");
	Str=fgets(fh);
	return Str;
	}

TestPeriodString=RS("TestPeriod.par");
TestPeriod=StrToNum(TestPeriodString);

Plot(RSI(TestPeriod),"",colorBrightGreen,styleLine);

Title="\\c55"
+Name()
+"\\c42    TestRSI"
+"\\c49    TestPeriod (for graph): \\c55"
+WriteVal(TestPeriod,1.0);


Best regards, Ned



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

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