Global Variable not updating when conditions are met.

 

Gap classifications not updating the Global variable Status;


//--- Global Decalaration;
int GapSignature;
//--- OnItnit 
//---Variable 
GapSignature = GapFinder();




//--- Function
int GapFinder()
   {
   int GSTemp = 0;
   int GeneratedGapSignature = 0;
   bool GapCondition1 = (RatesSymbol_0[1].close < RatesSymbol_0[0].open);  // Sell Position
   bool GapCondition2 = (RatesSymbol_0[1].close > RatesSymbol_0[0].open);  // Buy Position
   bool GapCondition3 = (RatesSymbol_0[1].low > RatesSymbol_0[0].open);    // Buy Position
   bool GapCondition4 = (RatesSymbol_0[1].high < RatesSymbol_0[0].open);   // Sell Position
 
        if (GapCondition1 && GapCondition4) GSTemp = 1;
   else if (GapCondition2 && GapCondition3) GSTemp = 2;
   else if (GapCondition1)                  GSTemp = 3;
   else if (GapCondition2)                  GSTemp = 4;
   
   GeneratedGapSignature = GSTemp;
   return(GeneratedGapSignature);
   }
 
Global Variable always display 0 as the output;
 

If I'm correct,  your conditions check for gaps between candles. If there are no gaps, all 4 conditions will be false and total result will be 0.

Did you check on the chart if there are gaps? 

 
Drazen Penic:

If I'm correct,  your conditions check for gaps between candles. If there are no gaps, all 4 conditions will be false and total result will be 0.

Did you check on the chart if there are gaps? 

Yes, In debug i set the conditions to EURUSD todays date Daily Timeframe;

On the chart displayed on the version of MT5 I currently have there is a gap.

- Bar OHLCV are printed; via the Print Function also indicating there is a gap;

Indicator i-Gap is loaded to showing there is a gap;

The Global Variable is just not Updating;

// Is in the OnTick();
Print(GapSignature); 


// Used to get the OHLCV
MqlRates        RatesSymbol_0[10];

This is how i am testing to see if the Global variable is being updated;

 
Then you should print RatesSymbol_0[] values just before those 4 comparison statements and check if values in that array are correct.
 
Drazen Penic:
Then you should print RatesSymbol_0[] values just before those 4 comparison statements and check if values in that array are correct.
Nice Probing; Ill give it a go;
 
Drazen Penic:
Then you should print RatesSymbol_0[] values just before those 4 comparison statements and check if values in that array are correct.
Thank you I forgot: ArraySetAsSeries
Reason: