Download MetaTrader 5
To add comments, please log in or register
Interested in social trading? Read the article!
Paul
784
Paul 2010.01.09 02:32 

I would like to use the classes derived from CIndicator (CiMA, CiStochastic etc) but have had no success.

The code below always shows DBL_MAX

#include <Indicators/trend.mqh>

CiMA extMA;
int OnInit()
  {
   extMA.Create(Symbol(),Period(),10,0,MODE_SMA,PRICE_CLOSE);
   return(0);
  }

void OnTick()
  {
   Comment(extMA.Main(0));
  }

Perhaps I need to use extMA.Refresh(flags), but if so I can't find a value of flags that will work.

Paul

http://paulsfxrandomwalk.blogspot.com/ 

Regularly emailing the status of an account
  • 2012.06.14
  • Paul
  • paulsfxrandomwalk.blogspot.com
Prompted by a query, I thought I'd post a useful little utility that I have used for ages which emails the status of the account every hour.  After lengthy deliberation I decided to call it .... EmailStatus.  With only a small modification it could be used to log the status to a file, and the time...
Rashid Umarov
Admin
11809
Rashid Umarov 2010.01.12 12:21  

Try this, it should be more properly:

#include <Indicators/trend.mqh>

CiMA extMA;
int OnInit()
  {
   extMA.Create(Symbol(),Period(),10,0,MODE_SMA,PRICE_CLOSE);
   // setup length of indicator buffer as you need
   extMA.BuffSize(neededNumber);
   return(0);
  }

void OnTick()
  {
   extMA.Refresh(-1); // update all MA values
   Comment(extMA.Main(0));
  }

/
To add comments, please log in or register