How to know if an indicator is first run

Back to topics list To post a new topic, please log in or register
avatar
31
wqking 2015.10.13 10: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.

avatar
1110
Ovo 2015.10.13 21:05 #
 
avatar
13006
WHRoeder 2015.10.15 19:13 #
 
  1. OnTick(){
       static bool isFirstRun = true;
       if(isFirstRun){ isFirstRun = false; ...
  2. Use a input string and verify in OnInit.
Back to topics list  

To add comments, please log in or register