ChartIndicatorAdd doen't show on terminal

 

I found some code that used the following statements which seemed a great idea.

I can see the indicator when a I list the Indicators. 

I have changed the scales - i.e. untick fixed .

I have tried using 10 (just any number) instead of CHART_WINDOWS_TOTAL so I understand this should load a separate window.

The code is excuted (I assume) because it doesn't execute the Print statement and return.

Print Handle shows 10

   iRSI_handle=iRSI(my_symbol,my_timeframe,14,PRICE_CLOSE); //--- apply the indicator and get its handle
   if(iRSI_handle==INVALID_HANDLE)                          //--- check the availability of the indicator handle
     {                                                      //--- no handle obtained, print the error message into the log file, complete handling the error
      Print("Failed to get the indicator handle");
      return(-1);
     }
   if (Symbol()== "GBPUSD" ) Print("iRSI_handle = "+IntegerToString (iRSI_handle));
   ChartIndicatorAdd(0,CHART_WINDOWS_TOTAL,iRSI_handle);

Obviously no problem loading manually

Any help appreciated

 
EAs have no eyes — they don't need to see indicators on the chart. If you want to see it, add it.
 
Peter Williams :

I found some code that used the following statements which seemed a great idea.

I can see the indicator when a I list the Indicators. 

I have changed the scales - i.e. untick fixed .

I have tried using 10 (just any number) instead of CHART_WINDOWS_TOTAL so I understand this should load a separate window.

The code is excuted (I assume) because it doesn't execute the Print statement and return.

Print Handle shows 10

Obviously no problem loading manually

Any help appreciated

First you need to get the number of windows, and then use the resulting value:

//+------------------------------------------------------------------+
//| Initialization function of the expert                            |
//+------------------------------------------------------------------+
int OnInit()
  {
   iRSI_handle=iRSI(Symbol(),Period(),14,PRICE_CLOSE); //--- apply the indicator and get its handle
   if(iRSI_handle==INVALID_HANDLE)                          //--- check the availability of the indicator handle
     {
      //--- no handle obtained, print the error message into the log file, complete handling the error
      Print("Failed to get the indicator handle");
      return(-1);
     }
   if(Symbol()== "GBPUSD")
      Print("iRSI_handle = "+IntegerToString(iRSI_handle));
   int win_total=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL);
   ChartIndicatorAdd(0,win_total,iRSI_handle);
//--- ok
   return(INIT_SUCCEEDED);
  }
Reason: