Licensing

 

i am trying to understand the licensing concept for mt4 indicators 

please have a look at the code and tell me if its the right and effective way of using the account number and time protection

i have highlighted the license code


//+------------------------------------------------------------------+
//|                                          Indicator: multivts.mq4 |
//|                                       Created with EABuilder.com |
//|                                             http://eabuilder.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
#property version   "1.00"
#property description ""






//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

//const string allowed_broker = "Hugosway";
const long allowed_accounts[] = {2101181434};
                             
int status = -1;


datetime allowed_until = D'2019.07.22 13:05'; 
                             
int password_status = -1;

//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT






#include <stdlib.mqh>
#include <stderror.mqh>

//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 2

#property indicator_type1 DRAW_HISTOGRAM
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
#property indicator_color1 0xB3FF00
#property indicator_label1 "Buy"

#property indicator_type2 DRAW_HISTOGRAM
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
#property indicator_color2 0x8800FF
#property indicator_label2 "Sell"

//--- indicator buffers
double Buffer1[];
double Buffer2[];

double myPoint; //initialized in OnInit

void myAlert(string type, string message)
  {
   if(type == "print")
      Print(message);
   else if(type == "error")
     {
      Print(type+" | multivts @ "+Symbol()+","+IntegerToString(Period())+" | "+message);
     }
   else if(type == "order")
     {
     }
   else if(type == "modify")
     {
     }
  }

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
  
  
  
  
 //TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
 
   long account = AccountInfoInteger(ACCOUNT_LOGIN);
   
   printf("Account number =  %d", account);
   
      for (int i=0; i<ArraySize(allowed_accounts); i++)
       if (account == allowed_accounts[i]) { 
            status = 1;
         Print("indicator account verified");
         break;
       }
   if (status == -1) Print("indicator is not allowed to run on this account.");   
   
   
   
   
   printf("This indicator is valid until %s", TimeToString(allowed_until, TIME_DATE|TIME_MINUTES));
   datetime now = TimeCurrent();
   
   if (now < allowed_until) 
         Print("indicator time limit verified, indicator init time : " + TimeToString(now, TIME_DATE|TIME_MINUTES));
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT

  
  
  
  
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   //initialize myPoint
   myPoint = Point();
   if(Digits() == 5 || Digits() == 3)
     {
      myPoint *= 10;
     }
   return(INIT_SUCCEEDED);
  }   
  
  
  
  
  

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
   int limit = rates_total - prev_calculated;
   //--- counting from 0 to rates_total
   ArraySetAsSeries(Buffer1, true);
   ArraySetAsSeries(Buffer2, true);
   //--- initial zero
   if(prev_calculated < 1)
     {
      ArrayInitialize(Buffer1, 0);
      ArrayInitialize(Buffer2, 0);
     }
   else
      limit++;
      
   




//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT   
  if (TimeCurrent() < allowed_until)
    {  
    if (status == 1) 

//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT



 {
   //--- main loop
   for(int i = limit-1; i >= 0; i--)
   
   
   
   
     {
      if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation   
      //Indicator Buffer 1
      if(iMA(NULL, PERIOD_CURRENT, 5, 0, MODE_EMA, PRICE_CLOSE, i) > iMA(NULL, PERIOD_CURRENT, 15, 0, MODE_EMA, PRICE_CLOSE, i) //Moving Average > Moving Average
      && iRSI(NULL, PERIOD_CURRENT, 21, PRICE_CLOSE, i) > 50 //Relative Strength Index > fixed value
      && iMACD(NULL, PERIOD_CURRENT, 8, 17, 9, PRICE_CLOSE, MODE_MAIN, i) > iMACD(NULL, PERIOD_CURRENT, 8, 17, 9, PRICE_CLOSE, MODE_SIGNAL, i) //MACD > MACD
      && iADX(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, MODE_PLUSDI, i) > iADX(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, MODE_MINUSDI, i) //Average Directional Movement Index > Average Directional Movement Index
      && iDeMarker(NULL, PERIOD_CURRENT, 14, i) > 0.5 //DeMarker > fixed value
      && iForce(NULL, PERIOD_CURRENT, 14, MODE_SMA, PRICE_CLOSE, i) > 0 //Force Index > fixed value
      && iMomentum(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, i) > 100 //Momentum > fixed value
      )
        {
         Buffer1[i] = Low[i]; //Set indicator value at Candlestick Low
        }
      else
        {
         Buffer1[i] = 0;
        }
      //Indicator Buffer 2
      if(iMA(NULL, PERIOD_CURRENT, 5, 0, MODE_EMA, PRICE_CLOSE, i) < iMA(NULL, PERIOD_CURRENT, 15, 0, MODE_EMA, PRICE_CLOSE, i) //Moving Average < Moving Average
      && iRSI(NULL, PERIOD_CURRENT, 21, PRICE_CLOSE, i) < 50 //Relative Strength Index < fixed value
      && iMACD(NULL, PERIOD_CURRENT, 8, 17, 9, PRICE_CLOSE, MODE_MAIN, i) < iMACD(NULL, PERIOD_CURRENT, 8, 17, 9, PRICE_CLOSE, MODE_SIGNAL, i) //MACD < MACD
      && iADX(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, MODE_PLUSDI, i) < iADX(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, MODE_MINUSDI, i) //Average Directional Movement Index < Average Directional Movement Index
      && iDeMarker(NULL, PERIOD_CURRENT, 14, i) < 0.5 //DeMarker < fixed value
      && iForce(NULL, PERIOD_CURRENT, 14, MODE_SMA, PRICE_CLOSE, i) < 0 //Force Index < fixed value
      && iMomentum(NULL, PERIOD_CURRENT, 14, PRICE_CLOSE, i) < 100 //Momentum < fixed value
      )
        {
         Buffer2[i] = High[i]; //Set indicator value at Candlestick High
        }
      else
        {
         Buffer2[i] = 0;
        }
     }
   return(rates_total); 
   
  }
 }
  
 }
//+------------------------------------------------------------------+
Expert Advisor Builder - Create indicators and strategies for MetaTrader 4 & 5 and TradeStation
  • www.eabuilder.com
We maintain this page to demonstrate our firm commitment to the rights and privacy of our users. This page explains how our site collects information from our members. Free newsletter and mailing list: we respect the privacy of our users, and as such we will never share our database of email addresses and names with any third party. Upon...
Reason: