Gator Oscillator

 

Hi!

 How can i check the colour of the previous bar of the gator oscillator?(not the actual bar, it repaints)

 1


See the image link:

I mean, if the colour of the bar of the previous day is totally green(above and below the zero line), trading is enabled.

 

Thank You !

 
Look at the documentation, please. Example of calculation of the indicator - https://www.mql5.com/en/docs/indicators/igator
Documentation on MQL5: Technical Indicators / iGator
Documentation on MQL5: Technical Indicators / iGator
  • www.mql5.com
Technical Indicators / iGator - Reference on algorithmic/automated trading language for MetaTrader 5
 
barabashkakvn:
Look at the documentation, please. Example of calculation of the indicator - https://www.mql5.com/en/docs/indicators/igator

Thank You !

 I have read the documentation, but I still can't understand how to check if the previous bar is green or red.

 

:(

 
memi :

Thank You !

 I have read the documentation, but I still can't understand how to check if the previous bar is green or red.

 

:(

What bar do you need?

1

 
barabashkakvn:

What bar do you need?

This Bar!

This Bar lol!  

 

This sketch. Color of the previous bar in the form of "0" or "1".

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property copyright "nikelodeon"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_plots     0
int   handle;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create handle of the indicator
   handle=iGator(_Symbol,PERIOD_CURRENT,13,8,8,5,
                 5,3,MODE_SMMA,PRICE_MEDIAN);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(
                const int rates_total,       // размер входных таймсерий
                const int prev_calculated,   // обработано баров на предыдущем вызове
                const datetime& time[],      // Time
                const double& open[],        // Open
                const double& high[],        // High
                const double& low[],         // Low
                const double& close[],       // Close
                const long& tick_volume[],   // Tick Volume
                const long& volume[],        // Real Volume
                const int &spread[]          // Spread
                )
  {
   double      ExtUpColorsBuffer[2];
   if(CopyBuffer(handle,1,0,2,ExtUpColorsBuffer)<=0)
     {
      Print("getting handle is failed! Error",GetLastError());
      return(0);
     }
     Comment("                  Gator previous bar has a color ",ExtUpColorsBuffer[0]);
//--- OnCalculate done. Return new prev_calculated.
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
barabashkakvn:

This sketch. Color of the previous bar in the form of "0" or "1".



wonderful !

thanks for the help ;)

Reason: