Please help me, i need to call functions in specific order, but don't know how to do it

 

Hi, i'm having problem to code this indicator, i need to call functions in specific order placed on extern variables, example, if first is 1, second is 2, it should call the 3 functions, functionone first, then function2, and after complete, repeat in a loop, so how can i code it?

Thanks for any help


extern int first; // example if i set on indicator: 1 - call functionone 1 first
extern int second;// example if i set on indicator: 2- call functiontwo 2 after calling function 1
extern int third; // example if i set on indicator: 1 -call functionone 1 again after calling function 2 ...''

// and then after this list complete, repeat the list automatically in a loop
//--------------------------------------------------------------------
int start()                                  
   {

// how can i code this here?
 
   return(0);                                      // Exit start()
   }
//--------------------------------------------------------------------


void functionone ()
{
Comment (1);

}

void functiontwo ()
{
Comment (2);

}

void functionthree ()
{
Comment (3);

}
 
Mrluck07:

Hi, i'm having problem to code this indicator, i need to call functions in specific order placed on extern variables, example, if first is 1, second is 2, it should call the 3 functions, functionone first, then function2, and after complete, repeat in a loop, so how can i code it?

Thanks for any help



functionone();
functiontwo();
functionthree();
 
rod178:


but if i want to set in an extern variable to execute in this order

1- functiontwo

2- functionone

3- functionone again


how can i do it, so the code will follow this order?

 
Mrluck07:

but if i want to set in an extern variable to execute in this order

1- functiontwo

2- functionone

3- functionone again


how can i do it, so the code will follow this order?

I am not sure, if that is what you want, but:

 
switch ( variable )                        
 {                                
      case 1:   functionOne();
                break;

      case 2:   functionTwo();
                break;

      case 3:   functionThree();
                break;
 }

 
Stefan Winter:

I am not sure, if that is what you want, but:

Yes thanks for the advice, i think that using several switches can do it

 
Mrluck07:

Yes thanks for the advice, i think that using several switches can do it

call the external variable from within all the three functions