How solve this zero divide error in Trend calculation
I'd probably do something like this:
if( (x2-x1) == 0) { Print("Divide by zero!"); return -1; }
I'd probably do something like this:
yes it is work but how can get trend value from this
// calculate the slope of the line (m) if( (x2-x1) == 0) { Print("Divide by zero!"); return -1; } double m = (y2-y1)/(x2-x1);

trend not still work .
how can get the value to get trend bro.
"Bro", this isn't even your own code (https://www.mql5.com/en/forum/136935). If you reuse other people's code, make sure it's at least working.
Sorry for being the a-hole here, but if you didn't put any original thought into it and don't understand what this code is doing, any help is pointless.
double m;if( x2!= 0 && x1!= 0
&& y2!= 0 && y1!=0
) m = (y2-y1)/(x2-x1);
/* Print(GetLastError()); double m = (y2-y1)/(x2-x1); */
I found the zero divide error in this trend line calculation
How can solve this error
I have no experience in this zero divide error.
Can someone guide me .
How can be ok in this trend calculation.
thanks