Download MetaTrader 5

How do I call value from a function

To add comments, please log in or register
Tony Chavez
235
Tony Chavez  

void tick{

//How would I get WantedValue to test against

if(CurrentAsk < PreviousAsk+WantedValue){

OrderSend(XXXXXX);

}

}

//////////////My Functions

double My_Function(double WantedValue){

      WantedValue = 0.051;

      return (WantedValue);

}

soubra2003
34273
soubra2003  
Tony Chavez:

void tick{

//How would I get WantedValue to test against

if(CurrentAsk < PreviousAsk+0.051){

OrderSend(XXXXXX);

}

}

//////////////My Functions

double My_Function(double WantedValue){

      WantedValue = 0.051;

      return (WantedValue);

}

Put tge function name with its parameters in the OnTick()
That's all
In your case you can even call it by a condition:
if(My_Function(Close[0])>0.1) return;
To add comments, please log in or register