Download MetaTrader 5

Ichimoku indicator class

To add comments, please log in or register
Marco Aurelio da Costa Carlos
58
Marco Aurelio da Costa Carlos  

About use of CiIchimoku class.

Above a code of EA intended for test.

When print values of ichimoku lines ChinkouSpan, TenkanSen or KinjunSen, a value is the same 1.797693134862316e+308

Thanks for help.

#include <Indicators/Trend.mqh>
MqlTick     m_tick    ;
CiIchimoku* m_ichimoku;

int OnInit()  {
   m_ichimoku = new CiIchimoku();
   
   if ( !m_ichimoku.Create(_Symbol,PERIOD_CURRENT,9,26,52) ){
      Print("ERROR ON CREATE ICHIMOKU INDICATOR");
      return(1);
   }
   
   return(0);   
}

void OnTick(){
   Print("Nome  :" ,m_ichimoku.Name  ());
   Print("Status:" ,m_ichimoku.Status());
   Print("symb:"   ,m_ichimoku.Symbol(),
         " cs="    ,m_ichimoku.ChinkouSpan(0),
         " ts="    ,m_ichimoku.TenkanSen(0),
         " ks="    ,m_ichimoku.KijunSen(0),
         " last="  ,m_tick.last,
         " ask="   ,m_tick.ask,
         " bid="   ,m_tick.bid);
   return;
}

void OnDeinit(const int reason)  {
   return;
}
Ilyas
1214
Ilyas  
You should call m_ichimoku.Refresh(-1) before query data

Marco Aurelio da Costa Carlos
58
Marco Aurelio da Costa Carlos  
Thanks Shaparov. Calling Refresh(-1), TenkanSen and KinjunSen works fine. This solution not works for ChinkouSpan and SenkouSpan A and B. My problem may be the basis of mql5 documentation. You indicate same book or exemple of code?
amin_mohammadi
87
amin_mohammadi  

Hello,

I'm trying to get the time when a new value in Kijun sen or Tenkan sen appears.

As I'm developing an Expert Advisor I can't use Time[] parameter of OnCalculate() in indicators.

can anyone help me?
Alain Verleyen
Moderator
33780
Alain Verleyen  
amin_mohammadi:

Hello,

I'm trying to get the time when a new value in Kijun sen or Tenkan sen appears.

As I'm developing an Expert Advisor I can't use Time[] parameter of OnCalculate() in indicators.

can anyone help me?
Try CopyTime()
To add comments, please log in or register