Download MetaTrader 5
To add comments, please log in or register
Having a great idea? Share it on the traders' Forum!
memi
49
memi 2015.03.05 15:02 

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 !

Vladimir Karputov
Moderator
33554
Vladimir Karputov 2015.03.05 18:17  
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
memi
49
memi 2015.03.06 22:57  
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.

 

:(

Vladimir Karputov
Moderator
33554
Vladimir Karputov 2015.03.07 06:59  
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

memi
49
memi 2015.03.07 23:15  
barabashkakvn:

What bar do you need?

This Bar!

This Bar lol!  

Vladimir Karputov
Moderator
33554
Vladimir Karputov 2015.03.08 06:38  

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);
  }
//+------------------------------------------------------------------+
memi
49
memi 2015.03.08 22:35  
barabashkakvn:

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



wonderful !

thanks for the help ;)

/
To add comments, please log in or register