ERROR 041

Posted By: Bernardo

ERROR 041 - 03/11/14 10:03

Hi,
as a newbie in trading I tested this script:

Code:
function run()
{
	StartDate = 20130303;
	EndDate = 20140303;	
	BarPeriod = 240;
	printf ("\n Std, Min, Datum: %i:%i / %i.%i.%i",hour(),minute(),day(),month(),year());	
	string name;
	while(name = loop("AUD/USD","EUR/USD","EUR/CHF","GBP/USD","GER30","NAS100",
	"SPX500","UK100","US30","NZD/USD","USD/CAD","USD/CHF","USD/JPY",
	"USOil","XAG/USD","XAU/USD"))
	{
		asset (name);
		vars Price = series(price());
		vars Trend = series(LowPass(Price,1000));
		//		printf("\n Asset = %s",name);
		if(valley(Trend))
		{
			printf("\n Valley: %s",name);
			return;
			}else if(peak(Trend)){
			printf("\n Peak: %s",name);
			return;			
		}
	}
}




The output was:
Allassets_series_test compiling...............
Std, Min, Datum: 0:0 / 0.0.0 assets........
Subscribe asset NZD/USD
FXCM.dll => FXCM interface opened
Login FXCM.... at UTC 11.03. 07:54.......
Logout.. ok
BackTest: Allassets_series_test portfolio 2013..2014
Std, Min, Datum: 4:0 / 12.2.2013
Std, Min, Datum: 8:0 / 12.2.2013
Std, Min, Datum: 12:0 / 12.2.2013
Valley: USOil
Cancelled


Zorro stopped with Error 041 after printing "Valley: USOil".
What is my Error?

Thanks for all suggestions!

Greets
Bernardo
Posted By: jcl

Re: ERROR 041 - 03/11/14 12:38

Originally Posted By: The Mighty Manual
Error 041: Inconsistent series calls

The number or order of series calls in the script is different to the previous run. Make sure that the number and order of of series calls does not change; don't call them dependent on if conditions.


As soon as one asset got a valley or peak, you're aborting the function without running the other assets. This will certainly cause a different number of series calls in every run.
Posted By: Bernardo

Re: ERROR 041 - 03/11/14 13:25

Oops, I read this but I didn't understand.

Thanks for your pacience.
Posted By: jcl

Re: ERROR 041 - 03/11/14 17:30

What I meant was: remove your "return" statements! They are wrong here, and will abort the function and thus break your code.
Posted By: Bernardo

Re: ERROR 041 - 03/11/14 20:54

Oh, misunderstanding, I had already understood your posting but not the "Mighty Manual" blush .
This part is working well now, I fear further errors will occure ...

Thanks so much wink
© 2024 lite-C Forums