How to edit the name of the indicator (.mq.4) ? and to put a cord that only i can allow anyone to use this indicator by putting his LOG IN id .

 

Hello my dear friends as am new here in forum i need a help and hope to be helped by you all expert over here.

 

As i want to know that how can i change the name of the custom indicator  

for example if the name of the indicator is MACD and i want to change its name to NONAME how can i do this ?

secondly i want that this indicator only used by one whom i allow to use . for example his account number(log in id ) is 12345 , and the second person whom i allowed to use his account number(log in id) is 78910.

(i want that my indicator only to be used by one whom i select. and they are more than 70 or even more than in my group)

waiting for your help  

 
ankit_fx:

As i want to know that how can i change the name of the custom indicator  

for example if the name of the indicator is MACD and i want to change its name to NONAME how can i do this ?

 

int OnInit()
  {
   IndicatorShortName("NONAME");
   return(INIT_SUCCEEDED);
  }

 

ankit_fx:

secondly i want that this indicator only used by one whom i allow to use . for example his account number(log in id ) is 12345 , and the second person whom i allowed to use his account number(log in id) is 78910.

(i want that my indicator only to be used by one whom i select. and they are more than 70 or even more than in my group)

 Lots of different ways. Here is one example:

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   if(!ValidAcc()) { return(rates_total); }
   
   // rest of your code

   return(rates_total);
  }

bool ValidAcc()
  {
   switch(AccountNumber())
     {
      case 12345: return(true);
      case 78910: return(true);
      // add more account numbers here
     }   
   return(false);
  }
 
honest_knave:

 

 

 Lots of different ways. Here is one example:

  

thanks dear but its not compiled error. please send me mail on ankitkumarsjs@gmail.com 

or comment your mail so that i can contact you. please setup it 

 
ankit_fx:

thanks dear but its not compiled error. please send me mail on ankitkumarsjs@gmail.com 

or comment your mail so that i can contact you. please setup it 

The code compiles without error at my end:

 

 

 

I'm afraid I don't offer support by email, but if you post up your code here (using SRC) the community should be able to help

 

 
honest_knave:

 

 

 Lots of different ways. Here is one example:

  Sir as i am new in this i put your pasted your cord at the end of the mq.4 flie. Shall i paste at the staring of the file , middle of it or at bottom.

Thanks 

 
i am getting this error can you say where to insert the code you gave ?
 
honest_knave:

The code compiles without error at my end:

 

 

 

I'm afraid I don't offer support by email, but if you post up your code here (using SRC) the community should be able to help

 

 

am getting this error can you please say where to insert the cord ? for example i tried in macd
 

That error tells you that your indicator already has OnCalculate. There can only be one in an indicator.

If you are using the standard MACD indicator, it would look like this (new code highlighted in yellow):

 

//+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "https://www.mql4.com"
#property description "Moving Averages Convergence/Divergence"
#property strict

#include <MovingAverages.mqh>

//--- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  Red
#property  indicator_width1  2
//--- indicator parameters
input int InpFastEMA=12;   // Fast EMA Period
input int InpSlowEMA=26;   // Slow EMA Period
input int InpSignalSMA=9;  // Signal SMA Period
//--- indicator buffers
double    ExtMacdBuffer[];
double    ExtSignalBuffer[];
//--- right input parameters flag
bool      ExtParameters=false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   IndicatorDigits(Digits+1);
//--- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,InpSignalSMA);
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtMacdBuffer);
   SetIndexBuffer(1,ExtSignalBuffer);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
//--- check for input parameters
   if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,
                 const int prev_calculated,
                 const datetime& time[],
                 const double& open[],
                 const double& high[],
                 const double& low[],
                 const double& close[],
                 const long& tick_volume[],
                 const long& volume[],
                 const int& spread[])
  {
   if(!ValidAcc()) { return(rates_total); }
   int i,limit;
//---
   if(rates_total<=InpSignalSMA || !ExtParameters)
      return(0);
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;
//--- macd counted in the 1-st buffer
   for(i=0; i<limit; i++)
      ExtMacdBuffer[i]=iMA(NULL,0,InpFastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
                    iMA(NULL,0,InpSlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//--- signal line counted in the 2-nd buffer
   SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+

bool ValidAcc()
  {
   switch(AccountNumber())
     {
      case 12345: return(true);
      case 78910: return(true);
      // add more account numbers here
     }   
   return(false);
  }
 
honest_knave:

That error tells you that your indicator already has OnCalculate. There can only be one in an indicator.

If you are using the standard MACD indicator, it would look like this (new code highlighted in yellow):

 

 

please do in this 4 indicator am unable to compile succesfully
 

AM UNABLE TO TO IN THIS PLEASE DO IN THIS AS I DID IN MACD 

THANKS 

Files:
 
ankit_fx:

AM UNABLE TO TO IN THIS PLEASE DO IN THIS AS I DID IN MACD 

THANKS 

Files:
sidusv3.mq4  4 kb
Reason: