Download MetaTrader 5

How do I call value from a function

To add comments, please log in or register
Tony Chavez
236
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);

}

Mohammad Soubra
30869
Mohammad Soubra  
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