ArraySetAsSeries not working

 

how does the rsi indicator appear in the lower window of ea ?

input int InpPeriodRSI=14; // Period

//--- indicator buffers
double    ExtRSIBuffer[];
double    ExtPosBuffer[];

ArraySetAsSeries(RSI, true);

RSIHandle=iRSi(Symbol,PRICE_CLOSE);

Improperly formatted code edited by moderator.

 
Good morning
In MQL4 or MQL5?
 
Gerard Willia G J B M Dinh Sy #:
Good morning
In MQL4 or MQL5?

In MQL5 

 
Moatle Thompson:

input int InpPeriodRSI=14; // Period

//--- indicator buffers

double    ExtRSIBuffer[];

double    ExtPosBuffer[];

ArraySetAsSeries(RSI, true);

RSIHandle=iRSi(Symbol,PRICE_CLOSE);

how does the  rsi indicator  appear in the lower window of ea ?


Where is the array RSI declared.  Show all your code. And say what error or why you think it is not working 
 
Moatle Thompson:

input int InpPeriodRSI=14; // Period

//--- indicator buffers

double    ExtRSIBuffer[];

double    ExtPosBuffer[];

ArraySetAsSeries(RSI, true);

RSIHandle=iRSi(Symbol,PRICE_CLOSE);

how does the  rsi indicator  appear in the lower window of ea ?


Hello , try this mql5 code . Instructions included ☕️

#property version   "1.00"
input int rsi_period=14;//RSI period
input ENUM_APPLIED_PRICE rsi_price=PRICE_CLOSE;//RSI price

/* you need an indicator handle */
int RSI_Handle=INVALID_HANDLE;//you leave it at its reset state in decalaration
int RSI_Sub=-1;//for deletion - consult OnDeinit
string RSI_Name="";//for deletion 
bool Loaded=false;//indication of load

int OnInit()
  {
  //reset your handle and the load indication
    Loaded=false;
    RSI_Handle=INVALID_HANDLE;
  //setup a timer to load when the symbol is ready 
    EventSetMillisecondTimer(44);
  return(INIT_SUCCEEDED);
  }

//Timer handler for load
void OnTimer(){
//if we have not loaded
  if(!Loaded){
  //if the symbol is synchronized 
  if(SymbolIsSynchronized(_Symbol)){
      //create the indicator (rsi) handle
        RSI_Handle=iRSI(_Symbol,_Period,rsi_period,rsi_price);
      //if the handle is created 
        if(RSI_Handle!=INVALID_HANDLE){
        //kill the timer 
          EventKillTimer();
        //set loaded to true
          Loaded=true;
        //plug the indicator on the chart
          long id=ChartID();
          RSI_Sub=(int)ChartGetInteger(id,CHART_WINDOWS_TOTAL);
          ChartIndicatorAdd(id,RSI_Sub,RSI_Handle);
          RSI_Name=ChartIndicatorName(ChartID(),RSI_Sub,0);
          ChartRedraw(id);
        }
    }
  }
}

void OnDeinit(const int reason)
  {
  if(RSI_Handle!=INVALID_HANDLE){
    ChartIndicatorDelete(ChartID(),RSI_Sub,RSI_Name);
    } 
  }
  
void OnTick()
  {
   
  }
 

Please use the CODE button (Alt-S) when inserting code.

Code button in editor

MQL5.community - User Memo
MQL5.community - User Memo
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893