Problem dividing doubles/floats

 
I tried dividing numbers (doubles/floats) but my indicator stop moving in strategy tester.

double FirstNumber = NumberArray[0];
double SecondNumber = NumberArray[10];

Comment("First : "+FirstNumber+"\n Second : "+SecondNumber);

//This comment part above works just fine

double Divided = FirstNumber/SecondNumber;

I didn't put "Divided" variable in any further operation, but the indicator stops and in the journal shows warning "OnTicks critical error"

I tried with all float variable and not working to

I searched about this problem but didn't found any similar problem, all of them have a problem from integer to doubles


UPDATE:

I changed the SecondNumber with any number, and it works

double Divided = FirstNumber/123;
//or
double Divided = FirstNumber/1.425;


But when I changed the FirstNumber with any number, the error still occured

double Divided = 0.243/SecondNumber;
//or
double Divided = 123.45/SecondNumber;


I also change the array count number for both FirstNumber and SecondNumber, but still showing the same error

NB: both variable was never 0

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
double FirstNumber = NumberArray[0];
double SecondNumber = NumberArray[10];

Show the code where you

a) Size the arrays.

b) assign values to the arrays and check that the value is not zero.

 
Keith Watford:

Show the code where you

a) Size the arrays.

b) assign values to the arrays and check that the value is not zero.

I've found the solution, I add a condition to check the value is not zero like you said, and doubling everything (again) just to make sure

if(SecondNumber > 0)
        Divider = double(FirstNumber)/double(SecondNumber);


Thank you

Reason: