Indicator fro MT4 to MT5

 

Hello Group,

I found this indicator for bar numbering which was written in MT4 

https://www.mql5.com/en/code/19248

I tried to convert it to MT5 however am getting lot of compilation errors, can some of you gurus out here please help convert this MT5, will be greatly appreciated.

Thanks.
BarNumbers
BarNumbers
  • votes: 10
  • 2017.10.13
  • Samuel Beer
  • www.mql5.com
Displays the number of each bar - both, relative to the most current bar and in absolute terms from the beginning of the chart. The text above the candle describes the candles position relative to the current candle, while the text below the candle stands for its position measured from the beginning of the chart. Features Fast performance. It...
 
The code has to be rewritten because it will not recompile.
 

In MT5 first bar is 0, last one is rates_total-1, Bars function is different and open/close/high/low buffers are written without capital letters. All else should work.

Just read the code carefully 20 times and you'll see what and how to fix.

 
kypa:

In MT5 first bar is 0, last one is rates_total-1, Bars function is different and open/close/high/low buffers are written without capital letters. All else should work.

Just read the code carefully 20 times and you'll see what and how to fix.

Kypa,

Thank you for your response. I am new to mql5, learning as we go.

I modified the code as you mentioned however not sure why I am getting this error now. Please take a look and let me know your feedback.

Thanks
Files:
bn.JPG  107 kb
 
Michael Maggi:
The code has to be rewritten because it will not recompile.
Thank you for your feedback Michael. Learning as we go :)
 
Those arrays exist only in OnCalculate, they can't be accessed outside. You must declare something else and replace it in function call or integrate the function in OnCalculate.
 
kypa:
Those arrays exist only in OnCalculate, they can't be accessed outside. You must declare something else and replace it in function call or integrate the function in OnCalculate.

Kypa,

Can you please fix the code and upload it, will be much faster to learn that way rather than me trying to fix it which will take forever :)

Thanks.
 
kypa:

In MT5 first bar is 0, last one is rates_total-1, Bars function is different and open/close/high/low buffers are written without capital letters. All else should work.

Just read the code carefully 20 times and you'll see what and how to fix.

Thanks for the info. I'll have to learn, too.

Long time I did not play with MQL and suddenly everything is weird and confusing - still using MT4 but code lines automatically turned into MQL5.

For example, I just tested "PlotIndexSetInteger(0,PLOT_ARROW_SHIFT,-80); " which I put into "int OnInit()". No error alert but this line seems not working. 

 
kypa:
Those arrays exist only in OnCalculate, they can't be accessed outside. You must declare something else and replace it in function call or integrate the function in OnCalculate.

Kypa,

What say you bud, will you kind enough to do it?

Thanks.

 
kypa:
Those arrays exist only in OnCalculate, they can't be accessed outside. You must declare something else and replace it in function call or integrate the function in OnCalculate.

Kypa, Haven't heard back from you in a while, hopefully you are still alive and not dead

Reason: