Big problems with iATR and MQL5

 

Hi guys,

I am trying to convert all my stuff from MQL4 to MQL5 and I have a big problem with iATR (and a lot of other stuff).

Firstly, the MQL5-iATR-function returns a handle. Why? It was so easy with MQL4. Just returned the number and you're done. Ok, but I found a code which returns the number. I am just asking myself why MetaQuotes made MQL5 unnecessary complex...?

But now the real problem occurs. How can I get the ATR(20) starting at bar 100? In MQL4 is was simply:

double ATR20 = iATR(_Symbol, _Period, 20, 100);

As I said I found a code which gives me the real ATR here: https://www.mql5.com/en/forum/12642#comment_528305

But how can I modify it when I don't need the current ATR but the ATR 100 bars ago?

I am totally frustrated with this MQL4 to MQL5 stuff.... :(

Script to get value of indicator ATR
Script to get value of indicator ATR
  • 2013.06.21
  • www.mql5.com
Hi, I try to program a simple script. My question: How do I get the value of the ATR (average true range) indicator in a script...
 
Marbo:

Hi guys,

I am trying to convert all my stuff from MQL4 to MQL5 and I have a big problem with iATR (and a lot of other stuff).

Firstly, the MQL5-iATR-function returns a handle. Why? It was so easy with MQL4. Just returned the number and you're done. Ok, but I found a code which returns the number. I am just asking myself why MetaQuotes made MQL5 unnecessary complex...?

But now the real problem occurs. How can I get the ATR(20) starting at bar 100? In MQL4 is was simply:

As I said I found a code which gives me the real ATR here: https://www.mql5.com/en/forum/12642#comment_528305

But how can I modify it when I don't need the current ATR but the ATR 100 bars ago?

I am totally frustrated with this MQL4 to MQL5 stuff.... :(

Mql5 is object oriented... so you have to use lot of classes trade classes and see what object properties have those classes
 
Marius Ovidiu Sunzuiana:
Mql5 is object oriented... so you have to use lot of classes trade classes and see what object properties have those classes

I read in the documents that you can use object orientated programming but you don't have to. MQL5 works fine without it. And I think there is a "normal" solution for my problem. At least I hope so.

 
Marbo:

I read in the documents that you can use object orientated programming but you don't have to. MQL5 works fine without it. And I think there is a "normal" solution for my problem. At least I hope so.

It has been discussed a hundred times at least on this forum, please use the search engine.
 
Marbo:

Hi guys,

I am trying to convert all my stuff from MQL4 to MQL5 and I have a big problem with iATR (and a lot of other stuff).

Firstly, the MQL5-iATR-function returns a handle. Why? It was so easy with MQL4. Just returned the number and you're done. Ok, but I found a code which returns the number. I am just asking myself why MetaQuotes made MQL5 unnecessary complex...?

But now the real problem occurs. How can I get the ATR(20) starting at bar 100? In MQL4 is was simply:

As I said I found a code which gives me the real ATR here: https://www.mql5.com/en/forum/12642#comment_528305

But how can I modify it when I don't need the current ATR but the ATR 100 bars ago?

I am totally frustrated with this MQL4 to MQL5 stuff.... :(

This might help: https://learnmql5.com/courses/133054/lectures/1996236

Getting Indicator Data
Getting Indicator Data
  • learnmql5.com
Build a 8-Currency Hedging Trading Robot
 

This is awesome! Very helpful, thank you!!!

 

hello,

I am Aleksandar, I have problem with market on MT5 platform for desktop. is not displayed simply.

 I inserted pictures of the problem. I buy some product and cant use it. Please help me

Files:
Reason: