Make custom indicator parameter editable

 

Does anyone know how to make a paremeter editable by the user. I created a basic indicator to track the a possible maximum ask value using maximum spreads provided by Oanda. Here is the code. Does anyone know how to get the ExtParam1 to be a modifiable option in the custom indicator settings?


//+------------------------------------------------------------------+
//|                                                       MaxAsk.mq4 |
//|                                     Copyright 2013, Ralph Ritoch |
//|                                    http://www.vnetpublishing.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Ralph Ritoch"
#property link      "http://www.vnetpublishing.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red

//--- input parameters
extern double   ExtParam1=0.015;
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   
   int idx = Bars-counted_bars-1;
   
   if (ExtParam1 >= 0) {
       while(idx >= 0) {       
           ExtMapBuffer1[idx] = High[idx] + ExtParam1;                      
           idx--;
       }
   } else {
       while(idx >= 0) {       
           ExtMapBuffer1[idx] = Low[idx] + ExtParam1;                      
           idx--;
       }           
   }
   
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
rritoch:

Does anyone know how to make a paremeter editable by the user. I created a basic indicator to track the a possible maximum ask value using maximum spreads provided by Oanda. Here is the code. Does anyone know how to get the ExtParam1 to be a modifiable option in the custom indicator settings?

It already is,  it's an extern so it's modify-able from the Indicator Inputs.  Why do you say/think it isn't ?
 
RaptorUK:
It already is,  it's an extern so it's modify-able from the Indicator Inputs.  Why do you say/think it isn't ?


RaptorUK,

I've seen a Inputs tab on some example web sites but for some reason my custom indicators don't have that tab. I thought that there may be a setting someplace that I'm missing that is keeping it from displaying.

 
rritoch:

RaptorUK,

I've seen a Inputs tab on some example web sites but for some reason my custom indicators don't have that tab. I thought that there may be a setting someplace that I'm missing that is keeping it from displaying.

There was a post recently about this with an updated file from metaquotes . . . lets see if I can find it.

Found it:  https://www.mql5.com/en/forum/142834 read it all and you should find a file attached by Metaquotes that should help.

 

RaptorUK,

  Thanks again, that solution worked. It didn't work immediately though. After changing the filename to lower case and recompiling the indicator the tab appeared and now functions as expected.  This isn't the first time I've been duped by my Windows 7/AMD 64bit.

 
rritoch:

RaptorUK,

  Thanks again, that solution worked. It didn't work immediately though. After changing the filename to lower case and recompiling the indicator the tab appeared and now functions as expected.  This isn't the first time I've been duped by my Windows 7/AMD 64bit.

Glad it worked for you and thanks for letting us all know  :-)
Reason: