why indicator draw only orizontal line ?

 

hi guys  why this  script  draw orizontal line  , if i use imaonarray or ima ??

yhanks  at all

//+------------------------------------------------------------------+
//|                                                     MM2Smoth.mq4 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property description " "
#property strict
#property indicator_separate_window  // indicatore in seprata window
#property indicator_minimum    -100
#property indicator_maximum    100
#property indicator_buffers 1       // Number of buffers
#property indicator_color1 Green     //  

int  barsbackN = 1500;
extern string   b10="=== SET. TIME FRAME ===";
extern int  timeframe = 0;

double ArrayNClose[1];
double ArrayNOpen[1];
double ArrayDifN[1];
double EmaA[1];

double Buf_0[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   ChartSetSymbolPeriod(0,Symbol(),PERIOD_M5);

   IndicatorShortName("S");
   SetIndexBuffer(0,Buf_0);         // Assigning an array to a buffer
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); // Line style

//--- indicator buffers mapping
//--  BLOCK A
   ArrayResize(ArrayNClose,barsbackN);
   ArrayResize(ArrayNOpen,barsbackN);
   ArrayResize(ArrayDifN,barsbackN);
   ArrayResize(EmaA,barsbackN);

   SetIndexDrawBegin(0,barsbackN);
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

// NUMERATOR
   CopyClose(Symbol(),timeframe,0,barsbackN,ArrayNClose);
   CopyOpen(Symbol(),timeframe,0,barsbackN,ArrayNOpen);
   for(int i=0; i<=(barsbackN-1); i++)
     {
      ArrayDifN[i]=(ArrayNOpen[i]);//-ArrayNClose[i]);
     }
   for(int i=0; i<=(barsbackN-1); i++)
     {
      EmaA[i] =  iMAOnArray(ArrayNOpen,0,1500,0,MODE_EMA,i);
     }


// FUNCTION 4 DRAW INDICATOR

   int Counted_bars=barsbackN;
   int J=Bars-Counted_bars-1;
   while(J>=0)
     {
      //Buf_0[J]= (EmaBB[J]/ EmaDD[J])*100;
       // Buf_0[J]= EmaA[J];
         Buf_0[J]= iMA(NULL,0,1500,8,MODE_EMA,PRICE_OPEN,J);
      J--;
     }
   return 0;
  }

//+------------------------------------------------------------------+
 
faustf:

hi guys  why this  script  draw orizontal line  , if i use imaonarray or ima ??

Delete these 2 lines.

#property indicator_minimum    -100
#property indicator_maximum    100
 
thanks  so much I would never get there
Reason: