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.