Navigation´╝ÜHome > Content >

Heiken_ashi_binary_+_alerts.mq4

Time: 2012-10-05 | Download file:Heiken_ashi_binary_+_alerts.mq4

//------------------------------------------------------------------
#property copyright "mladen"
#property link      "www.forex-tsd.com"
//------------------------------------------------------------------
#property indicator_separate_window
#property  indicator_buffers 1
#property indicator_color1   PaleVioletRed
#property indicator_width1   2

extern bool  alertsOn        = false;
extern bool  alertsOnCurrent = true;
extern bool  alertsMessage   = true;
extern bool  alertsSound     = false;
extern bool  alertsEmail     = false;

double       haTrend[];

//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//

int init()   { SetIndexBuffer(0,haTrend); return(0); }
int deinit() {                            return(0); }
int start()
{
   int i,r,counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
           int limit=MathMin(Bars-counted_bars,Bars-1);

   //
   //
   //
   //
   //
   
   for (i=limit; i>=0; i--) haTrend[i] = getHaTrend(i);
   manageAlerts();
   return(0);      
}

//------------------------------------------------------------------
//                                                                  
//------------------------------------------------------------------
//
//
//
//
//


double workHa[][4];
double getHaTrend(int i)
{
   if (ArrayRange(workHa,0)!= Bars) ArrayResize(workHa,Bars);

      //
      //
      //
      //
      //
      
      double haOpen; int r = Bars-i-1;

      if (i>0)
             haOpen  = (workHa[r-1][2] + workHa[r-1][3])/2.0;
      else   haOpen  = Open[i]+Close[i];
      double haClose = (Open[i] + High[i] + Low[i] + Close[i]) / 4.0;
      double haHigh  = MathMax(High[i], MathMax(haOpen,haClose));
      double haLow   = MathMin(Low[i] , MathMin(haOpen,haClose));

      if(haOpen  haOpen) return( 1);
      if (haClose        

Recommend