Check_license

Author: Amira Brand
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
Check_license
ÿþ//+------------------------------------------------------------------+

//|                                                 Amira brand      |

//+------------------------------------------------------------------+



#property copyright "Amira Brand"

#property link      "https://www.mql5.com/en/users/amirabrand1998"

#property version   "1.00"

#property strict



//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit() {

   CheckLicense();     

   

   return(INIT_SUCCEEDED);

}



//+------------------------------------------------------------------+

//| Expert check license                                             |

//+------------------------------------------------------------------+

void CheckLicense() 

{

   Print("Account name: ", AccountName());

  

   if (StringFind(StringLower(AccountName()), "account name in lowercase!!") < 0) {

      Alert("No license active!");

      ExpertRemove();

      return;

   }

}



//+------------------------------------------------------------------+

//| Expert string to lower                                           |

//+------------------------------------------------------------------+

string StringLower(string str) 

{

   string outstr = "";

   string lower  = "abcdefghijklmnopqrstuvwxyz";

   string upper  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

   

   for (int i=0; i<StringLen(str); i++) {

      int t1 = StringFind(upper,StringSubstr(str,i,1),0);

      if (t1 >=0) {  

         outstr = outstr + StringSubstr(lower,t1,1);

      } else {

         outstr = outstr + StringSubstr(str,i,1);

      }  

   }

   

   return(outstr);

}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---