Calling Shellexecute with paramtrigger

This code works perfectly in the indicator window, but in the Analysis window it does not work. I know that paramtrigger works in the Analysis window, but when this command runs you must close param window and when you reopen parameters it opens notepad because now it sees trigger = 1. Any thoughts I how to get this to work in Analysis window?

PtkTrigger = ParamTrigger("Edit Parameters","Click to Edit");
if(Ptktrigger)
{
ShellExecute("notepad.exe", "O:\\Amibroker\\Formulas\\Include\\Parameters\\P_Sysv5.afl", "" );
}																	   

You do not neccassarily have to use Paramtrigger in analysis.
E.g, just use scan run as trigger.

PtkTrigger = ParamTrigger("Edit Parameters","Click to Edit");

is_scan = Status("action") == actionScan;

if(Ptktrigger OR is_scan)
{
	if ( Status("stocknum") == 0 ) {
		ShellExecute("notepad.exe", "O:\\Amibroker\\Formulas\\Include\\Parameters\\P_Sysv5.afl", "" );
	}
}

fxshrat, thanks for your reply and dedication to this forum. I am wanting to open my file that holds parameters in one click rather than opening file explorer and I do not need to open it every time a scan is run, Is there a way to do this?

Combine paramtrigger and e.g. scan.

PtkTrigger = ParamTrigger("Edit Parameters","Click to Edit");

is_scan = Status("action") == actionScan;

// first trigger then run analysis
if(Ptktrigger AND is_scan)
{
	if ( Status("stocknum") == 0 ) {
		Say("Hello World");
	}
}

Another way to execute is if param window is getting opened in analysis.
That's one click without running analysis.

if( Status("actionex") == actionExAAParameters )
{
	Say("Hello World");	
}

For what it is worth ParamTrigger was never intended to be used in Analysis.
It is purely for charts only because it is by design intended to REFRESH THE CHART and trigger one-time execution of given chart code.
Analysis is completely different beast.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.