Download MetaTrader 5

Problem with Technical Indicators in Standard Library

To add comments, please log in or register
meisme
39
meisme  

Hello,

I have problem to use technical indicators class in standard library.  I have scanned through this forum, but no one have similar problem as me.

Basically i want to use technical indicator from standard library, but my outputs are very strange.

Please take look my snippet code:

      CiStochastic ciStochastic;
      ciStochastic.Create("EURUSD", PERIOD_H4, 14, 3, 4, MODE_EMA, STO_CLOSECLOSE);      
      double dbGetMain_0 = ciStochastic.Main(0);
      double dbGetMain_1 = ciStochastic.Main(1);
      double dbGetMain_2 = ciStochastic.Main(2);
      
      double dbGetSignal_0 = ciStochastic.Signal(0);
      double dbGetSignal_1 = ciStochastic.Signal(1);
      double dbGetSignal_2 = ciStochastic.Signal(2);      
      
      Comment("dbGetMain_0: ", dbGetMain_0, "\ndbGetMain_1: ", dbGetMain_1, "\ndbGetMain_2: ", dbGetMain_2,
              "\ndbGetSignal_0: ", dbGetSignal_0, "\ndbGetSignal_1: ", dbGetSignal_1, "\ndbGetSignal_2: ", dbGetSignal_2
      );

And here's the output:

dbGetMain_0: 1.797693134862316e+308
dbGetMain_1: 1.797693134862316e+308
dbGetMain_2: 1.797693134862316e+308
dbGetSignal_0: 1.797693134862316e+308
dbGetSignal_1: 1.797693134862316e+308
dbGetSignal_2: 1.797693134862316e+308

Same thing happened when i use other indicator:

      CiMA ciMA;
      ciMA.Create("EURUSD", PERIOD_H4, 10, 0, MODE_EMA, PRICE_CLOSE);
      
      double dbGetMain_0 = ciMA.Main(0);
      double dbGetMain_1 = ciMA.Main(1);
      double dbGetMain_2 = ciMA.Main(2);
      
      Comment("dbGetMain_0: ", dbGetMain_0, "\ndbGetMain_1: ", dbGetMain_1, "\ndbGetMain_2: ", dbGetMain_2);

Output:

dbGetMain_0: 1.797693134862316e+308
dbGetMain_1: 1.797693134862316e+308
dbGetMain_2: 1.797693134862316e+308

Do i miss something so that this class cannot be used?  FYI, i am using MetaEditor 5.00 Build 489 (12 Aug 2011).

Please advice.

Thanks.

Documentation on MQL5: Standard Library
  • www.mql5.com
Standard Library - Documentation on MQL5
Victor Kirillin
491
Victor Kirillin  
meisme:

Hello,

I have problem to use technical indicators class in standard library.  I have scanned through this forum, but no one have similar problem as me.

Basically i want to use technical indicator from standard library, but my outputs are very strange.

Please take look my snippet code:

And here's the output:

Same thing happened when i use other indicator:

Output:

Do i miss something so that this class cannot be used?  FYI, i am using MetaEditor 5.00 Build 489 (12 Aug 2011).

Please advice.

Thanks.






      CiMA ciMA;
      ciMA.Create("EURUSD", PERIOD_H4, 10, 0, MODE_EMA, PRICE_CLOSE);
      ciMA.Refresh(-1);
      double dbGetMain_0 = ciMA.Main(0);
meisme
39
meisme  

Hi uncleVic,

Thank you for your answer. It's working now.  But i am curious what is  '-1'  means? It's not working when i replace '-1' with other value like '0' or '1'.

Refer to the manual, refresh method has passing parameter flags.

void Refresh( int flags //flags
)

flags : [in] Timeframe update flags.

There is no further explanation what is flags , how to get flags and what kind of  flags that is accepted by Refresh method.

If you don't mind, please give me pointer about this.

Thank you again.





Victor Kirillin
491
Victor Kirillin  
meisme:

Hi uncleVic,

Thank you for your answer. It's working now.  But i am curious what is  '-1'  means? It's not working when i replace '-1' with other value like '0' or '1'.

Refer to the manual, refresh method has passing parameter flags.

There is no further explanation what is flags , how to get flags and what kind of  flags that is accepted by Refresh method.

If you don't mind, please give me pointer about this.

Thank you again.


I'd gladly explain you what these flags are, but it will be hard to understand and will take a lot of time. Definitely you don't need it.

Flags are used by the CIndicators class to optimize data downloading for "multi-timeframes" indicators.

To add comments, please log in or register