Errors, bugs, questions - page 378

 

Why expression "if(ichi.TenkanSen(i)< ichi.KijunSen(i))" ALWAYS (on all candles) returns false, even when "if(ichi.TenkanSen(i)> ichi.KijunSen(i))"? Seems like a glitch in the standard library. Full code is in the file.

Comment(DoubleToString(ichi.TenkanSen(0),5));

On euro-dollar it outputs

Files:
Ich_1.mq5  3 kb
 
Graff:

Why the expression "if(ichi.TenkanSen(i)< ichi.KijunSen(i))" ALWAYS (on all candles) returns false, even when "if(ichi.TenkanSen(i)> ichi.KijunSen(i))"? Seems like a glitch in the standard library. Full code in the file

First, TerminalInfoInteger(TERMINAL_MAXBARS) - you cannot do that.

replace with rates_total


Second, yes, there is an error which m_data_total all the time =0. Therefore we have no values.

 
sergeev:

firstly TerminalInfoInteger(TERMINAL_MAXBARS) - you cannot do this.

replace with rates_total

I replaced it with for(int i=0; i<=rates_total-1; i++), in fact, nothing has changed.
 
Secondly, yes, there is an error, m_data_total =0 all the time. That's why there are no values.
 
sergeev:

Secondly, yes, there is an error, m_data_total =0 all the time. Therefore there are no values.
Tried to change values in Comment(DoubleToString(ichi.TenkanSen(3),5)); on 1,2,3 in Comment is constantly the same. Maybe prompt that tweak to make it work, and the official fix wait for no opportunity.
 
Graff:
I tried to change values in Comment(DoubleToString(ichi.TenkanSen(3),5)); to 1,2,3 in Comment constantly displays the same thing. Can you suggest that tweak to make it work, then the official fix wait for no opportunity.
Do not use this class. Take the usual Handle.
 
sergeev:
Don't use this class. Take the regular handle.

You're not very comfortable using it...

OK, thanks for your attention, waiting for the fix.

 
Graff:

It's not very comfortable to use...

OK, thanks for your attention, waiting for the fix.

you don't think it's comfortable? :)

int ich;

//+------------------------------------------------------------------+
int OnInit()
  {
   ich=iIchimoku(_Symbol,_Period, TenkanSen, KijunSen, SenkoSpan);
   return(0);
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
    IndicatorRelease(ich);
  }
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   double ten[]; CopyBuffer(ich, 0, 0, rates_total, ten);
   double kij[]; CopyBuffer(ich, 1, 0, rates_total, kij);
   for(int i=0; i<rates_total; i++)
     {
      if(ten[i]<kij[i]) { up.Create(0,"Tenkan>Kijun"+IntegerToString(i),0,time[i],low[i]); up.Color(clrLimeGreen); }
      else { down.Create(0,"Tenkan<Kijun"+IntegerToString(i),0,time[i],high[i]); down.Color(clrTomato); }
     }
   return(rates_total);
  }
 
sergeev:

is that not comfortable? :)


I'm not a programmer and I'm not very comfortable with this arrangement.

Does it make sense to change

CopyBuffer(ich, 1, 0, rates_total, kij);

Replace rates_total with BarsCalculated(ich)?

PS: And what city are you from, if not a secret?

 
Graff:


OK, thanks for the attention, waiting for the fix.

By the way, are you sure you don't need to call any additional functions?

The library has both Refresh and BufferResize. It seems to me that they are necessary for normal functioning.