Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 609 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
function call error #487768
09/11/23 07:55
09/11/23 07:55
Joined: Sep 2023
Posts: 18
Freiburg
S
steyr Offline OP
Newbie
steyr  Offline OP
Newbie
S

Joined: Sep 2023
Posts: 18
Freiburg
Hello everyone, I come from the MQL5 community, and I'm puzzled by this compiler error: Error 111 crash in run: run()

Something seems to be wrong with the call to StdDevFunc(), but I can't figure out what it might be. I would greatly appreciate your help.

Code

// Strategy template ///////////////////////

var ExtStdDevPeriod = 14; // Definition der Periodenlänge (können Sie anpassen)

function run() 
{
	var StdDevFunc(vars ,vars , var);
	
	
	BarPeriod = 60;
	set(PARAMETERS|LOGFILE);
	LookBack = 1000;
	if(Train) Detrend = TRADES;
	StartDate = 20130101;
	EndDate = 2023;
	NumWFOCycles = 10;
	
	vars Price = series(price());
        vars Trend = series(MovingAverage(Price,60,EMA));

	vars standardA = series(StdDevFunc(Price,Trend,0));
	
	
	plot("Trend",Trend,0,BLUE);
	plot("stddev",standardA,NEW,BLUE);
	PlotWidth = 800;
	PlotHeight1 = 300;
	
	

}

	var StdDevFunc(vars Preis,vars MAprice, var position)
	{
		 
		 var dTmp = 0.0;
		 var i;
		 for (i = 0; i < ExtStdDevPeriod; i++)
		 {
			  dTmp += pow(Preis[position - i] - MAprice[position], 2);
		 }
		 dTmp = sqrt(dTmp / ExtStdDevPeriod);
		 return dTmp;
	}




Last edited by steyr; 09/11/23 07:56.
Re: function call error [Re: steyr] #487770
09/11/23 10:29
09/11/23 10:29
Joined: Aug 2023
Posts: 19
I
izorro Offline
Newbie
izorro  Offline
Newbie
I

Joined: Aug 2023
Posts: 19
The Troubleshooting Page has some good info.

You can use watch statement to debug and find which line might be causing the problem.

Re: function call error [Re: steyr] #487772
09/11/23 12:24
09/11/23 12:24
Joined: Feb 2017
Posts: 1,731
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,731
Chicago
That's not a compiler error, it compiled just fine. That's a runtime error.

Also, I don't understand why you put your function prototype for StdDevFunc() inside the run() body. Move it to prior. Or just move the actual function above it and remove the prototype.

Re: function call error [Re: steyr] #487783
09/14/23 08:25
09/14/23 08:25
Joined: Sep 2023
Posts: 18
Freiburg
S
steyr Offline OP
Newbie
steyr  Offline OP
Newbie
S

Joined: Sep 2023
Posts: 18
Freiburg
Thank you all!


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1