Questions from Beginners MQL5 MT5 MetaTrader 5 - page 269

 
tol64:
Tick and real volume (if any).

and what is the difference between tick and real???

 
soroko:

What's the difference between a teak and a real one?

Tick is the number of trades, real is based on size
 
zfs:
tick is the number of trades, real is based on the size of the trade

then why does the real one show 0 everywhere ?

 
soroko:

then why does the real one show 0 everywhere ?

no data, forex real volumes are not known, this is for other exchanges like forts
 
zfs:
no data, in forex the real volumes are not known, this is for other exchanges like forts

Thank you for saving me the time I would have spent looking for it)

 
How about my main question. Which function can I use to fill in the array with the last 5 prices in order to find out which side the price crosses the line? Thanks in advance.
 
soroko:
I understand that, but how to shift the price within the array. I tried it with ArrayCopy function, it passes 0,0 or the same Bid. And I'm also worried about massive code, can't I do it all with one function?
Element by element in a loop.
 
soroko:
How about my main question. Which function can I use to fill in the array with the last 5 prices in order to find out which side the price crosses the line? Thanks in advance.
You need to get a basic knowledge of programming.
 

I can't get the parameters of an indicator that is not on the chart. Below is the code with all unnecessary things removed, lines for getting indicator parameters are copied from the help. The indicator itself is attached to one hour chart, but I want to work with five minutes. GetLastError() generates error 4006, but nothing seems to be wrong...

int m_MA_M5;

int OnInit()
  {
  
m_MA_M5 = iMA(NULL, PERIOD_M5, 12, 0, MODE_SMA, PRICE_CLOSE);

if (m_MA_M5 <=0 )
{
   Print("Error create MA");
   return (INIT_FAILED);
}
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
//---

   if (prev_calculated == rates_total)
      return (rates_total);

   
          MqlParam parameters[];
          ENUM_INDICATOR indicator_type;
          int params=IndicatorParameters(m_MA_M5,indicator_type,parameters);
          
          if (params<0)
          {
            Print("Error geted data Last Error=", GetLastError());
          }else{
          
         	 //--- заголовок сообщения
	          string par_info="Short name M5"+", type "
                          +EnumToString(ENUM_INDICATOR(indicator_type))+"\r\n";
        	  //--- 
	          for(int p=0;p<params;p++)
        	    {
	             par_info+=StringFormat("parameter %d: type=%s, long_value=%d, double_value=%G,string_value=%s\r\n",
                                    p,
                                    EnumToString((ENUM_DATATYPE)parameters[p].type),
                                    parameters[p].integer_value,
                                    parameters[p].double_value,
                                    parameters[p].string_value
                                    );
        	    }
	          Print(par_info);
    
   	}
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Hello! I have an EA written in mt4 can be converted to mt5
Reason: