Getting custom gridline indicator to attach

 
Hi, I'm very new to MT5. I'm trying to have fixed, custom gridlines on my chart, but can't get anything I've found to work. I've been able to get other indicators I've downloaded to work - but since this isn't really an indicator I don't know if there's a different way to go about it? I've attached a couple of the files I've tried to use as a reference
 
Chelsea Edgecombe:
Hi, I'm very new to MT5. I'm trying to have fixed, custom gridlines on my chart, but can't get anything I've found to work. I've been able to get other indicators I've downloaded to work - but since this isn't really an indicator I don't know if there's a different way to go about it? I've attached a couple of the files I've tried to use as a reference

You have attached files for MT4. They will not work in MT5.

 

This is the MT5 version.

Files:
 
Nagisa Unada # :

This is the MT5 version.

You strongly mixed up types of variables 'int' and 'double'. As a result, you have HUGE numbers in your calculations. Recommended: use code debugging


 
Vladimir Karputov #:

You strongly mixed up types of variables 'int' and 'double'. As a result, you have HUGE numbers in your calculations. Recommended: use code debugging

Yes, I know it. It is intentionally done that way to calculate the grid spacing.

 
Nagisa Unada # :

Yes, I know it. It is intentionally done that way to calculate the grid spacing.

You may or may not be doing it on purpose - but that is the cause of the error. Use debugging and observe the code section:

   for(i = price_low; i <= price_high; i++)
     {
      if(MathMod(i, grid_space) == 0)
        {
         obj_name = "Grid_" + IntegerToString(i);

Are you good at code debugging?

 
I understand debugging. But there is no error.
 
Nagisa Unada # :
I understand debugging. But there is no error.

Start debugging on EURUSD, H1. Put a breakpoint here:

You will see the cursor exit the loop.

 

Do you mean that it does not stop at the breakpoint and terminates with an error?

Nothing happens. It works normally without error.
 
Nagisa Unada # :

Do you mean that it does not stop at the breakpoint and terminates with an error?

Nothing happens. It works normally without error.

Start debugging already at last! Your code contains a bug and you just have to see it!

 

I have tried debugging the loop from start to finish and nothing happens.

I can't figure out what the bug is.
Reason: