Performing a function after a change in value of a variable

 

Hellow, I hope somebody can help me :)


I am storing a counter value in a variable. Each tick the value gets checked.

For each time the value of the variable changes I want to perform a function.


For example : 

variable = 0

variable changes to 1 > call to perform the function (one time)

variable changes from 1 to 2 > call to perform the function (one time)

etc


I tried to do it a few times, but i make it way too difficult I think.


thanks for the help!

 
giobenoni: I hope somebody can help me :)

Help you with what? You haven't stated a problem, you stated a vague want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

 
Use a static variable.

Like this:

static int var = NULL;

if((changing_var != var)&&(var != NULL))
{ Call_function(); }
var = changing_var;



Reason: