Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (dBc), 17,435 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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,806
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,806
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