Zero Divide Error
You showseveral lines where you perform division.
You will have to figure out why the divisor becomes 0 sometimes.
int StepMAStochSignal(string nSymbol, int PeriodWATR=7, double Kwatr=0.7, int HighLow=0)
I have never seen variables intitalized in the call like that. If the variables are part of the call, they should already have values.
I made a test, and you can't do that:
//+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- int x = 5; Print("When x == 5 you get ",Test1(x)); x = 0; Print("When x == 0 you get ",Test1(x)); //---- return(0); } //+------------------------------------------------------------------+ int Test1(int xx = 2){ return(xx); }
Output:
2008.07.04 20:08:24 Phy__CallTest GBPJPYm,Daily: removed 2008.07.04 20:08:24 Phy__CallTest GBPJPYm,Daily: uninit reason 0 2008.07.04 20:08:24 Phy__CallTest GBPJPYm,Daily: When x == 0 you get 0 2008.07.04 20:08:24 Phy__CallTest GBPJPYm,Daily: When x == 5 you get 5 2008.07.04 20:08:24 Phy__CallTest GBPJPYm,Daily: loaded successfully 2008.07.04 20:08:18 Compiling 'Phy__CallTest'That is likely your zero divide problem.
Ok, show me an example that does what you say...
//+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- int x = 5; Print("When x == 5 you get ",Test1(x)); x = 0; Print("When x == 0 you get ",Test1(x)); Print("When you don't provide nothing you get ",Test1()); //---- return(0); } //+------------------------------------------------------------------+ int Test1(int xx = 2){ return(xx); }
Hi
I'm making a signal table where i'm going to put signals of indicators I like, so today I made a function that returns a signal for the indicator StepMA Stoch, now the problem is that sometimes it gives an error Zero Divde and most wierd thing is that sometimes, not aways, when I remove the function the error stops to show. So the problem is in the function's code but I don't know where because I tryied a lot and got no solution,
thanks in advance.