MQL4-Script: not enough stack for parameter

 

All of a sudden my script terminates with the following error:

4005: ERR_NOT_ENOUGH_STACK_FOR_PARAM: Not enough stack for parameter.

What could be the reason for this error, and how could I get rid of it?

 
Friesi:

All of a sudden my script terminates with the following error:

4005: ERR_NOT_ENOUGH_STACK_FOR_PARAM: Not enough stack for parameter.

What could be the reason for this error, and how could I get rid of it?

Check if u have any infinite recursion loops in your code. If not, show us your code...

 

Hello Gordon,

You were right. I had an infinite recursive loop. Problem solved.

Thank you for your help.

 
Friesi:

Hello Gordon,

You were right. I had an infinite recursive loop. Problem solved.

Thank you for your help.

If this code is for an EA and u plan on doing any optimizations, then I recommend u not use recursion at all, or u will run into memory problems. See here -> https://www.mql5.com/en/forum/118313.

 
gordon wrote >>

If this code is for an EA and u plan on doing any optimizations, then I recommend u not use recursion at all, or u will run into memory problems. See here -> https://www.mql5.com/en/forum/118313.

Gordon, Thank you for the helpful link.

 

I can't find the issue in this code, It give me Error Memory, Stack Overflow or 4005, depend which declaration is commented.

It happen just with this file.


string COS_Program_Name = "#Defcon___#Demo___IndicatorCountedDemo___v0.1b" ;

string COS_Program_ShortName = "IndicatorCounted Demo" ;

string COS_Program_Version = "v0.1b" ;

#property indicator_separate_window


//#property indicator_minimum 0
//#property indicator_maximum 0
/*
#property link "link"
#property copyright "Defcon"
*/
#property indicator_buffers 1 // see SetUserPreferences()

#property indicator_color1 Black/*
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black
*/
#property indicator_width1 2/*
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2
#property indicator_width7 2
#property indicator_width8 2
*/




// Info Code, Variables and errors
extern string VAR_UP_ShowInfo = "### Info about Vars & Code ###" ;
extern bool VAR_UP_ShowVarInfo = true ;
extern bool VAR_UP_ShowRunInfo = true ;
// string VAR_FuncName ;





// COSTANTI
// int COS_PointOfNotReturn = 500000 ; // used for exit from unexpected loop



/*

// User Preferences
extern string VAR_UP_BuffersColSch = "###### Buffers Colors ###" ;
extern int VAR_UP_BuffersColSchId = 1 ;
extern string VAR_UP_BuffersColSch1 = "Scheme 1" ;
extern string VAR_UP_BuffersColSch2 = "Scheme 2" ;
extern string VAR_UP_BuffersColSch3 = "Scheme 3" ;
extern string VAR_UP_BuffersColSch4 = "Scheme 4" ;

color ARR_UP_BuffersColor[8] ;
int ARR_UP_BuffersWidth[8] ;
int ARR_UP_BuffersStyle[8] ;
*/




/*
// Buffer
double BUF_Buffer0[] ; // set integer, or hold double
double BUF_Buffer1[] ;
double BUF_Buffer2[] ;
double BUF_Buffer3[] ;
double BUF_Buffer4[] ;
double BUF_Buffer5[] ;
double BUF_Buffer6[] ;
double BUF_Buffer7[] ;
*/




// AR Array
// string ARR_BuffersShortName[8] ; // see SetUserPreferences, line 373





// Cycle For, While and more
// int VAR_BarsCounted ; // used as IndicatorCounted
// int h, j, k, l ; // used for count in for and while











//################################################################
//# INIT #
//################################################################



int init() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Init ******...", "", "");







if (VAR_UP_ShowVarInfo) RunInfo("****** Init ******...DONE", "", "");
}






//################################################################
//# START #
//################################################################



int start() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Start ******...", "", "");







if (VAR_UP_ShowVarInfo) RunInfo("****** Start ******...DONE", "", "");
}





//################################################################
//# DE-INIT #
//################################################################



int deinit() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Deinit ******...", "", "");


// CODE...



if (VAR_UP_ShowVarInfo) RunInfo("****** Deinit ******...DONE", "", "");
return(0) ;
}





//#################################################################
//# RunInfo #
//#################################################################


void RunInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("RunInfo()...", "", "") ;



string aa = "RunInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("RunInfo()...DONE", "", "") ;
}





//#################################################################
//# VarInfo #
//#################################################################


void VarInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("VarInfo()...", "", "") ;



string aa = "VarInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("VarInfo()...DONE", "", "") ;
}





//#################################################################
//# ErrorInfo #
//#################################################################


void ErrorInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("ErrorInfo()...", "", "") ;



string aa = "ErrorInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("ErrorInfo()...DONE", "", "") ;
}

 
nowhere:

I can't find the issue in this code, It give me Error Memory, Stack Overflow or 4005, depend which declaration is commented.



If you are going to ask a question in a thread that is 2 years old you may have a long wait . . . .

You seem to be using 8 Indicator buffers ?

#property indicator_buffers 1
 

discussions are usually listed for the date of response;

I've insert comment from indicator_buffers 2 and 8, so I'm using just one buffer. sorry but it don't take the color syntax.

#property indicator_buffers 1 // see SetUserPreferences()

#property indicator_color1 Black/*
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black
*/

#property indicator_width1 2/*
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2
#property indicator_width7 2
#property indicator_width8 2
*/

 
nowhere:

discussions are usually listed for the date of response;

I've insert comment from indicator_buffers 2 and 8, so I'm using just one buffer. sorry but it don't take the color syntax.


Ah I see . . . . so you are using no buffers . . . . where is your buffer declared ?

Perhaps you could edit your code to take out all the stuff you are not using and re-post it using SRC . . .

 

The same answer that answered the original thread 2 yeas ago (2nd posting) applies here also. You are calling RunInfo() recursively from within RunInfo() for no apparent reason and with no exit condition.

It has nothing to do with bufffers and stuff.

 
string COS_Program_Name = "#Defcon___#Demo___IndicatorCountedDemo___v0.1b" ;

string COS_Program_ShortName = "IndicatorCounted Demo" ;

string COS_Program_Version = "v0.1b" ;


#property indicator_separate_window


#property indicator_buffers 1 // see SetUserPreferences()

#property indicator_color1 Black
/*
#property indicator_color2 Black
#property indicator_color3 Black
#property indicator_color4 Black
#property indicator_color5 Black
#property indicator_color6 Black
#property indicator_color7 Black
#property indicator_color8 Black
*/
#property indicator_width1 2
/*
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
#property indicator_width6 2
#property indicator_width7 2
#property indicator_width8 2
*/




// Info Code, Variables and errors
extern string VAR_UP_ShowInfo = "### Info about Vars & Code ###" ;
extern bool VAR_UP_ShowVarInfo = true ;
extern bool VAR_UP_ShowRunInfo = true ;
// string VAR_FuncName ;





// COSTANTI
// int COS_PointOfNotReturn = 500000 ; // used for exit from unexpected loop



/*

// User Preferences
extern string VAR_UP_BuffersColSch = "###### Buffers Colors ###" ;
extern int VAR_UP_BuffersColSchId = 1 ;
extern string VAR_UP_BuffersColSch1 = "Scheme 1" ;
extern string VAR_UP_BuffersColSch2 = "Scheme 2" ;
extern string VAR_UP_BuffersColSch3 = "Scheme 3" ;
extern string VAR_UP_BuffersColSch4 = "Scheme 4" ;

color ARR_UP_BuffersColor[8] ;
int ARR_UP_BuffersWidth[8] ;
int ARR_UP_BuffersStyle[8] ;
*/




/*
// Buffer
double BUF_Buffer0[] ; // set integer, or hold double
double BUF_Buffer1[] ;
double BUF_Buffer2[] ;
double BUF_Buffer3[] ;
double BUF_Buffer4[] ;
double BUF_Buffer5[] ;
double BUF_Buffer6[] ;
double BUF_Buffer7[] ;
*/




// AR Array
// string ARR_BuffersShortName[8] ; // see SetUserPreferences, line 373





// Cycle For, While and more
// int VAR_BarsCounted ; // used as IndicatorCounted
// int h, j, k, l ; // used for count in for and while











//################################################################
//# INIT #
//################################################################



int init() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Init ******...", "", "");







if (VAR_UP_ShowVarInfo) RunInfo("****** Init ******...DONE", "", "");
}






//################################################################
//# START #
//################################################################



int start() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Start ******...", "", "");







if (VAR_UP_ShowVarInfo) RunInfo("****** Start ******...DONE", "", "");
}





//################################################################
//# DE-INIT #
//################################################################



int deinit() {
if (VAR_UP_ShowVarInfo) RunInfo("****** Deinit ******...", "", "");


// CODE...



if (VAR_UP_ShowVarInfo) RunInfo("****** Deinit ******...DONE", "", "");
return(0) ;
}





//#################################################################
//# RunInfo #
//#################################################################


void RunInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("RunInfo()...", "", "") ;



string aa = "RunInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("RunInfo()...DONE", "", "") ;
}





//#################################################################
//# VarInfo #
//#################################################################


void VarInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("VarInfo()...", "", "") ;



string aa = "VarInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("VarInfo()...DONE", "", "") ;
}





//#################################################################
//# ErrorInfo #
//#################################################################


void ErrorInfo(string a, string b, string c) {
if(VAR_UP_ShowRunInfo) RunInfo("ErrorInfo()...", "", "") ;



string aa = "ErrorInfo:" ;
Print( aa + " " + a + " " + b + " " + c ) ;



if(VAR_UP_ShowRunInfo) RunInfo("ErrorInfo()...DONE", "", "") ;
}

This is the result next I commented the variables one at a time.

It is a template