Why is the "variable not defined"?

 

This happens to me occasionally and I can't figure out why. I've searched throughout the forum and tried numerous changes for the last hour and can't figure it out:

I keep getting a "Open_Short - variable not defined" error...whereas my Open_Long variable works perfectly. Obviously they're both supposed to be booleans, but MT4 is not recognizing Open_Short as a variable.

Please help!

   if (...certain parameters are met...)                                      // Buy criteria
      {
      bool Open_Long=true                                                     // Then open a long position
      }
   if (...certain parameters are met...)                                      // Sell criteria
      {
      bool Open_Short=true                                                    // Then open a short position
      }
// ------ Placing Opening Orders      
   if(Open_Long==true)
      {
      RefreshRates();                                                                        // Refresh Market Info
      int ticket=OrderSend(Symb,OP_BUY,Lots(),Ask,2*points,Ask-Long_SL,10000," ",Magic);     // Send order with custom parameters for SL,TP and Lots
      if (ticket<0) Alert("OrderSend failed: ", GetLastError());                             // Error with order execution?
      Open_Long=false                                                                        // No longer need to open long
      }
   if (Open_Short==true)
      {
      RefreshRates();                                                                // Refresh Market Info
      ticket=OrderSend(Symb,OP_SELL,Lots(),Bid,2*points,Bid+Short_SL,0," ",Magic);   // Send order with custom parameters for SL,TP and Lots
      if (ticket<0) Alert("OrderSend failed: ", GetLastError());                     // Error with order execution?
      Open_Short=false;                                                              // No longer need to open short
      }     
   
 
Here, you need these ; ; ;
 

To be precise . . . .

if (...certain parameters are met...)                                      // Buy criteria
      {
      bool Open_Long=true ;  <--------

                                                    // Then open a long position
      }
   if (...certain parameters are met...)                                      // Sell criteria
      {
      bool Open_Short=true ;  <--------  

                                                 // Then open a short position
      }

                            // Error with order execution?
      Open_Long=false ;  <--------   
 

...duh.


Thanks, I figured it was something obvious I was overlooking!

Reason: