Questions from Beginners MQL5 MT5 MetaTrader 5 - page 811

 
SILVERPRINT:
Mql4 when referring to the indicator instead of the tester data the last data inMql5 came outthe same?

I don't understand anything. Try to rephrase and put punctuation marks.

 

All indicators created using methods from the standard library need to be updatedmanually?

There are two methods

RefreshCurrent
Refresh


I understand that the first one is needed ifI needautomatic refresh?

And the second, justRefresh, tomanually refresh once at the tick of the entire data array?

 
SILVERPRINT:

All indicators created using methods from the standard library need to be updatedmanually?

There are two methods


I understand that the first one is needed ifyou wantautomatic refresh?

And the second, justRefresh, tomanually refresh once at the tick of the entire data array?


Please show the code how you create an indicator in your Expert Advisor.

 
Vladimir Karputov:

I don't understand anything. Try to rephrase and put punctuation marks.


In mql4 the information from the indicators on index zero in the tester gave a flipper date from the history. Have you had to ibarshift the same in mql5?

 
SILVERPRINT:

In mql4 the information from the indicators on index zero in the tester was giving a date flipper from the history. Have you had to ibarshift the same in mql5?


Rephrase. Put punctuation marks. Write in Russian.

 
Vladimir Karputov:

Show the code how you create the indicator in the EA.

#include <Indicators\Trend.mqh>
#include <Indicators\Oscilators.mqh>
#include <Indicators\TimeSeries.mqh>

MqlTick infotick;
MqlDateTime currentTime;
CiMA ValueofMA200;
CiMA ValueofMA20;
CiMA ValueofMAHour;
CiATR atr;
CiTime timeh1;
CiTime timeD1;


   sym=_Symbol;
   ValueofMA200.Create(sym,PERIOD_D1,slowma,0,MODE_SMA,PRICE_CLOSE);
   ValueofMA20.Create(sym,PERIOD_D1,fastwma,0,MODE_SMA,PRICE_CLOSE);
   ValueofMAHour.Create(sym,PERIOD_H1,mahours,0,MODE_SMA,PRICE_CLOSE);
   atr.Create(sym,PERIOD_H1,200);
   timeh1.Create(sym,PERIOD_H1);
   timeD1.Create(sym,PERIOD_H1);
   
   timeh1.BufferResize(25);
   timeD1.BufferResize(200);
   
   timeh1.Refresh(PERIOD_H1);
   timeD1.Refresh(PERIOD_D1);

         ValueofMA200.Main(0);
         ValueofMA20.Main(0);
         ValueofMAHour.Main(0);    
         atr.Main(0);
Approximately like this
 
SILVERPRINT:
Like this

Yes, if you use the standard library class to create indicators, then you must useRefresh methods to retrieve the data

 
Vladimir Karputov:

Yes, if you use the standard library class to create indicators, then you need to useRefresh methods to retrieve the data

How do these methods work? What is better to use?

RefreshCurrent
Refresh
I understandRefreshCurrent is a costly method on every tick.
 
SILVERPRINT:

1) How do these methods work? 2) Which is better to use?


1) Navigate to this method in the editor (middle-clicking on the method name will jump you to this method) - this will show you HOW the method works. The recipe is universal: middle-clicking on any method or function will jump to the function or method code itself.

2) There is no two ways about it. Some people use creation of indicators through classes, others use creation of handles (iMA, iMACD ...).

 
Vladimir Karputov:

1) Navigate to this method in the editor (middle-clicking on the method name will take you to this method), so you can see HOW the method works. The recipe is universal: middle-clicking on any method or function will jump to the function or method code itself.

2) There is no two ways about it. Some people use creation of indicators through classes, others use creation of handles (iMA, iMACD ...).


My mouse doesn't have middle button, it's made of pure silver)).Probably my problems with optimal calling have already been solved over the years. I wouldn't want to update the whole array with every tick.

Reason: