**Farnood1988:**

hi guys,

this function return the number of modes that sum of all variables(currencyinerest[1]+currencyinerest[2]+...+curencyinerest[n]) are equal to 100;this code perfectly work when you assign number 3 to to variable "currencynumber"

when you assign number 4 to "currencynumber" the code works with some delay, but if you assign a number greater than 4 to "currencynumber" meta trader will crashed.

i really need to run it on 20 currency , and i know it will takes several minutes to calculate;so what's your offer?

any suggestion will much appreciated.

Of course it "crashed". For currencynumber=3 the while loop is executed ~100^3.

So for 5 it's 100^5 = 10,000,000,000, for 20 it will be 10,000,000,000,000,000,000,000,000,000,000,000,000,000...that's insane :-D

Your "bruteforce" algorithm is not usable. You need to find an other one. And the worst is it's not even correct for 3 (you need currencyinerest[x] to be >0, right ?).

hi guys,

may you help me on this code please :

this function return the number of modes that sum of all variables(currencyinerest[1]+currencyinerest[2]+...+curencyinerest[n]) are equal to 100;

this code perfectly work when you assign number 3 to to variable "currencynumber"

when you assign number 4 to "currencynumber" the code works with some delay, but if you assign a number greater than 4 to "currencynumber" meta trader will crashed.

i really need to run it on 20 currency , and i know it will takes several minutes to calculate;so what's your offer?

any suggestion will much appreciated.