How to use the value of a variable from one function into another?

 
Hi, I have a variable called switch_action in my OnTick function, you can see below how it is calculated.

void OnTick()
  {
   int switch_action;
   int ticket=-1;
   double price;
   double TradeSize;
   double SL;

//---

//Open Buy Order, instant signal is tested first
   RefreshRates();
   if(Cross(0,iStochastic(NULL,PERIOD_CURRENT,34,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,PERIOD_CURRENT,34,3,3,MODE_SMA,0,MODE_SIGNAL,0)) //Stochastic Oscillator crosses above Stochastic Oscillator
      && iStochastic(NULL,PERIOD_CURRENT,34,3, 3, MODE_SMA, 0, MODE_MAIN, 0) < 20 //Stochastic Oscillator < fixed value
      && Bid < iBands(NULL, PERIOD_CURRENT, 34, 2, 0, PRICE_CLOSE, MODE_LOWER, 0) //Price < Bollinger Bands
      && iRSI(NULL,PERIOD_CURRENT,14,PRICE_CLOSE,0)<32 //Relative Strength Index < fixed value
      )
     {
      RefreshRates();
      price=Ask;
      if(IsTradeAllowed())
        {
         switch_action=1;
         if(ticket <= 0) return;
        }
     }

//Open Sell Order, instant signal is tested first
   RefreshRates();
   if(Cross(1,iStochastic(NULL,PERIOD_CURRENT,34,3,3,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,PERIOD_CURRENT,34,3,3,MODE_SMA,0,MODE_SIGNAL,0)) //Stochastic Oscillator crosses below Stochastic Oscillator
      && iStochastic(NULL,PERIOD_CURRENT,34,3, 3, MODE_SMA, 0, MODE_MAIN, 0) > 80 //Stochastic Oscillator > fixed value
      && Bid > iBands(NULL, PERIOD_CURRENT, 34, 2, 0, PRICE_CLOSE, MODE_UPPER, 0) //Price > Bollinger Bands
      && iRSI(NULL,PERIOD_CURRENT,14,PRICE_CLOSE,0)>58 //Relative Strength Index > fixed value
      )
     {
      RefreshRates();
      price=Bid;
      if(IsTradeAllowed())
        {
         switch_action=2;
         if(ticket <= 0) return;
        }

      //myOrderModifyRel(ticket, SL, 0);
     }


  }
So how can I take the value of switch_action here and use it in the function below?

<Decompiled code removed>
 
QuantCoder:
Hi, I have a variable called switch_action in my OnTick function, you can see below how it is calculated.

So how can I take the value of switch_action here and use it in the function below?

You should realize that if you use decompiled code you are a thief.

 
if(switch_action==2) 
instead of 
if(switch_action=2)
 
Petr Nosek:

You should realize that if you use decompiled code you are a thief.

Petr, how can you see it is a decompilated code?
 
Petr Nosek:

You should realize that if you use decompiled code you are a thief.

What on earth?!? This isnt decompiled code?! who deleted my code snippet?
 
Luc Levesque:
This did not work

@Luc Levesque
 
QuantCoder:
What on earth?!? This isnt decompiled code?! who deleted my code snippet?
Your function2 is decompiled code.
 
Alain Verleyen:
Your function2 is decompiled code.
really?? I never knew. I even got this ea from a trusted friend..


Are you sure? Even if so, how could I use a value of one variable from one function into another?
 
QuantCoder:
What on earth?!? This isnt decompiled code?! who deleted my code snippet?

You even don't have very basic knowledge about coding (your question) but you are sure your code isn't decompiled. Are you kidding?!?! If you got this code snippet from your friend. You should stop trusting him. I assume that your code was deleted by a moderator and he/she should delete it again.

 
Alain Verleyen:
Your function2 is decompiled code.

Alain,

How can we see if it is a decompilated code?

 
Freelance, decompilation, the rules, examples of the decompiled code:
https://www.mql5.com/en/forum/203200  
Can not use Freelance Service last 2 days.
Can not use Freelance Service last 2 days.
  • 2017.06.04
  • www.mql5.com
I have been registered as a seller last 2 years, but last 2 days it looks like i can not use Freelance service...