drawing to graphics screen

 

have a nice day. Below is my code structure. However, I cannot plot this data on the graph screen. Can you help me. I'm new to MQL5.


double   BUFFERTOP[];

////
int ema1;
int ema2;
int ma1;
int ma2;
int highW1;
int highM1;
int loww1;
int lowM1;
int closew1;
int closeM1;



double valueema1[];
double valueema2[];
double valuema1[];
double valuema2[];
double valuehighW1[];
double valuehighM1[];
double valueloww1[];
double valuelowM1[];
double valueclosew1[];
double valuecloseM1[];

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  
  SetIndexBuffer(0,BUFFERTOP, INDICATOR_DATA);
  ArraySetAsSeries(BUFFERTOP,true);
  
  ema1= iMA(_Symbol,PERIOD_CURRENT,8,0,MODE_EMA,PRICE_CLOSE);
  ema2= iMA(_Symbol,PERIOD_CURRENT,13,0,MODE_EMA,PRICE_CLOSE);
  ma1= iMA(_Symbol,PERIOD_CURRENT,50,0,MODE_SMA,PRICE_CLOSE);
  ma2= iMA(_Symbol,PERIOD_CURRENT,100,0,MODE_SMA,PRICE_CLOSE);
  highW1 = iHigh(_Symbol,PERIOD_W1,1);
  loww1  = iLow(_Symbol,PERIOD_W1,1);
  closew1  = iClose(_Symbol,PERIOD_W1,1);
  highM1 = iHigh(_Symbol,PERIOD_MN1,1);
  lowM1  = iLow(_Symbol,PERIOD_MN1,1);
  closeM1  = iClose(_Symbol,PERIOD_MN1,1);
  ArraySetAsSeries(valueema1,true);
  ArraySetAsSeries(valueema2,true);
  ArraySetAsSeries(valuema2,true);
  ArraySetAsSeries(valuema2,true);
  ArraySetAsSeries(valuehighM1,true);
  ArraySetAsSeries(valuehighW1,true);
  ArraySetAsSeries(valuelowM1,true);
  ArraySetAsSeries(valueloww1,true);
  ArraySetAsSeries(valuecloseM1,true);
  ArraySetAsSeries(valueclosew1,true);
  if(ema1==INVALID_HANDLE  || ema2 ==INVALID_HANDLE||ma1 ==INVALID_HANDLE ||ma2==INVALID_HANDLE||highW1==INVALID_HANDLE ||loww1==INVALID_HANDLE ||closew1==INVALID_HANDLE ||closeM1==INVALID_HANDLE||highM1==INVALID_HANDLE||lowM1==INVALID_HANDLE ){
  Print("İndika  calismadi.");
  return(INIT_SUCCEEDED);
  }
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   IndicatorRelease(ema1);
   IndicatorRelease(ema2);
   IndicatorRelease(ma1);
   IndicatorRelease(ma2);
   IndicatorRelease(highM1);
   IndicatorRelease(highW1);
   IndicatorRelease(lowM1);
   IndicatorRelease(loww1);
   IndicatorRelease(closeM1);
   IndicatorRelease(closew1);
  }
int  OnCalculate(
   const int        rates_total,       // size of input time series
   const int        prev_calculated,   // number of handled bars at the previous call
   const datetime&  time[],            // Time array
   const double&    open[],            // Open array
   const double&    high[],            // High array
   const double&    low[],             // Low array
   const double&    close[],           // Close array
   const long&      tick_volume[],     // Tick Volume array
   const long&      volume[],          // Real Volume array
   const int&       spread[]           // Spread array
   ){
   int count = rates_total-prev_calculated;
   if(prev_calculated>0) count++;
   
   if(CopyBuffer(ema1,0,0,count,valueema1)<count) return(0);
   if(CopyBuffer(ema2,0,0,count,valueema2)<count) return(0);
   if(CopyBuffer(ma1,0,0,count,valuema1)<count) return(0);
   if(CopyBuffer(ma2,0,0,count,valuema2)<count) return(0);
   if(CopyBuffer(highM1,0,0,count,valuehighM1)<count) return(0);
   if(CopyBuffer(highW1,0,0,count,valuehighW1)<count) return(0);
   if(CopyBuffer(lowM1,0,0,count,valuelowM1)<count) return(0);
   if(CopyBuffer(loww1,0,0,count,valueloww1)<count) return(0);
   if(CopyBuffer(closeM1,0,0,count,valuecloseM1)<count) return(0);
   if(CopyBuffer(closew1,0,0,count,valueclosew1)<count) return(0);
   
   for (int i=count-1;i>=0;i--){
   double ema11=valueema1[i];
   double ema12=valueema2[i];
   double ma11=valuema1[i];
   double ma12=valuema2[i];
   double high1=valuehighM1[i];
   double high2=valuehighW1[i];
   double close1=valuecloseM1[i];
   double close2=valueclosew1[i];
   double low1=valueloww1[i];
   double low2=valuelowM1[i];
   ///piv haf
   double phaf=(high2+close2+low1)/3;
   //pivay
   double payf=(high1+close1+low2)/3;
   //toplam   
   double top1=MathAbs((ema11+ema12+ma11+ma12+phaf+payf))/6;
   
   BUFFERTOP[i]=top1;   
   }
   return(rates_total);
   }

////////////
 
zeppi23:

have a nice day. Below is my code structure. However, I cannot plot this data on the graph screen. Can you help me. I'm new to MQL5.


you need define the number of buffers and number of plots, as well as their styles. check some examples in the folder Indicators/Examples in your MT5 Terminal