Download MetaTrader 5
To add comments, please log in or register
Store your source codes in MQL5 Storage. It is secure!
Wang Qi
514
Wang Qi 2015.10.13 08:05 

Hi all,


Before all, let me define "first run". From MQL documentation, https://docs.mql4.com/runtime/running

Loading and Unloading of Indicators

Indicators are loaded in the following cases:

  • an indicator is attached to a chart; (This is first run)
  • terminal start (if the indicator was attached to the chart prior to the shutdown of the terminal); (This is first run)
  • loading of a template (if the indicator attached to a chart is specified in the template);
  • change of a profile (if the indicator is attached to one of the profile charts);
  • change of a symbol and/or timeframe of a chart, to which the indicator is attached;
  • after the successful recompilation of an indicator (if the indicator was attached to a chart);
  • change of input parameters of the indicator.

I add "(This is first run)" in the list, so only the first two cases are first run.

How to detect if an indicator is first run?

What I want to do is, when an indicator is first run, pop up a dialog to ask to input license code. If the dialog is pop up on every parameter change, it will be too annoying.

Or an alternative question, how to let the user input the license code? Maybe an alternative method is to put a button on the chart?

Thanks for your any advice.

Ovo Cz
2951
Ovo Cz 2015.10.13 19:05  
whroeder1
13624
whroeder1 2015.10.15 17:13  
  1. OnTick(){
       static bool isFirstRun = true;
       if(isFirstRun){ isFirstRun = false; ...
  2. Use a input string and verify in OnInit.
/
To add comments, please log in or register