Expiry date in EA

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
1316
jjc 2009.05.06 14:59 #
 
fbj:

from what I see of current public code, there is always a dll and/or server involved when running an EA and of course the obligatory infamous key/serNo/jibberish/...

...and the DLL route is non-trivial because the DLL has to do something integral to the functionality of the EA/indicator. It can't just handle the expiry. Otherwise, you can decompile the ex4 file, remove the call to the DLL, and then recompile. I.e. the DLL must also do something like calculating part of an entry signal/indicator, passing back values which are then used by the MQL code.


Similarly, locking against something like an account number is hard. If the DLL relies on being given the account number by the MQL code, then that's vulnerable. The ex4 can be decompiled, and the MQL code can be changed so that it passes to the DLL an account number which is known to be valid, rather than the real AccountNumber().

 
avatar
5
FireHawk 2009.09.13 00:08 #
 
jjc:

...and the DLL route is non-trivial because the DLL has to do something integral to the functionality of the EA/indicator. It can't just handle the expiry. Otherwise, you can decompile the ex4 file, remove the call to the DLL, and then recompile. I.e. the DLL must also do something like calculating part of an entry signal/indicator, passing back values which are then used by the MQL code.


Similarly, locking against something like an account number is hard. If the DLL relies on being given the account number by the MQL code, then that's vulnerable. The ex4 can be decompiled, and the MQL code can be changed so that it passes to the DLL an account number which is known to be valid, rather than the real AccountNumber().


there is a way however to ensure that the decompiler returns an error and fails to show the MQL code

i have seen it myself as one of my friends attempted to decompile FapTurbo

i am currently working on developing locking mechanism to prevent that


unfortunately i don't have any decompilers and are not too keen to buy any

but will have to test it one way or another


 
avatar
86
fly7680 2016.07.21 19:25 #
 
Hello I can not integrate your code. This is my code could you give me some help?

Thank you

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

#property indicator_type1 DRAW_ARROW
#property indicator_width1 1
#property indicator_color1 Yellow
#property indicator_label1 "Sell"

#property indicator_type2 DRAW_ARROW
#property indicator_width2 1
#property indicator_color2 Yellow
#property indicator_label2 "Buy"

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




extern string RSI             ="Setting RSI";
extern int Periodo            = 2;
extern double RSI_Max         = 70;
extern double RSI_Min         = 30;
datetime time_alert; //used when sending alert
extern bool Audible_Alerts = true;
double myPoint; //initialized in OnInit

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

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {   
   IndicatorBuffers(2);
   SetIndexBuffer(0, Buffer1);
   SetIndexEmptyValue(0, 0);
   SetIndexArrow(0, 159);
   SetIndexBuffer(1, Buffer2);
   SetIndexEmptyValue(1, 0);
   SetIndexArrow(1, 159);
   //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++;
   
   //--- 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  
      
      
int start()
  {
   
   datetime expiry=D'2016.07.20 00:00';
   bool YesStop = false;

   if(TimeCurrent()>expiry)
   {
   Alert("The EA has expired...");
   bool YesStop = true;
   }

   if(YesStop != true)
   {
      // Indicator Buffer 1
      if(iRSI(NULL, PERIOD_CURRENT, Periodo, PRICE_CLOSE, i) > RSI_Max //Relative Strength Index > fixed value
            )
        {
         Buffer1[i] = High[i] + 1 * myPoint; //Set indicator value at Candlestick High + fixed value
         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Sell"); //Alert on next bar open
         time_alert = Time[1];
        }
      else
        
      //Indicator Buffer 2
      if(iRSI(NULL, PERIOD_CURRENT, Periodo, PRICE_CLOSE, i) < RSI_Min //Relative Strength Index < fixed value
      )
        {
         Buffer2[i] = Low[i] - 1 * myPoint; //Set indicator value at Candlestick Low - fixed value
         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Buy"); //Alert on next bar open
         time_alert = Time[1];
        }  
      }
      
  return(0);
  } 
   
  
   
//+------------------------------------------------------------------+
avatar
2017
gooly 2016.07.21 19:45 #
 

just do:

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( TimeCurrent() > D'2016.07.20 00:00'  ) {
          Comment(" ..expired :(");
          return(rates_total);
      }
   ...

btw. yours is not an EA but an indicator!


avatar
86
fly7680 2016.07.21 19:59 #
 
Right, so this code for expired dates will not do ? How can I fix ?
avatar
86
fly7680 2016.07.21 22:41 #
 
It seems to work well ... okay?
       // Indicator Buffer 1
      if(iRSI(NULL, PERIOD_CURRENT, Periodo, PRICE_CLOSE, i) > RSI_Max //Relative Strength Index > fixed value
      && (Year()<2017 && Month()<8) // Is possible solution?
            )
        {
         Buffer1[i] = High[i] + 1 * myPoint; //Set indicator value at Candlestick High + fixed value
         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Sell"); //Alert on next bar open
         time_alert = Time[1];
        }
      else
        
      //Indicator Buffer 2
      if(iRSI(NULL, PERIOD_CURRENT, Periodo, PRICE_CLOSE, i) < RSI_Min //Relative Strength Index < fixed value
      && (Year()<2017 && Month()<8)   //Is possibile solution?
      )
        {
         Buffer2[i] = Low[i] - 1 * myPoint; //Set indicator value at Candlestick Low - fixed value
         if(i == 1 && Time[1] != time_alert) myAlert("indicator", "Buy"); //Alert on next bar open
         time_alert = Time[1];
        }  
      }
      
  return(0);
  } 
   
  
   
//+------------------------------------------------------------------+
Back to topics list   | 1 2  

To add comments, please log in or register