FF Tunnel Slope





//+------------------------------------------------------------------+
//|                                              FF Tunnel Slope.mq4 |
//|                                                         FFwithFX |
//|                                                                  |
//+------------------------------------------------------------------+
#property  copyright "Financial Freedom with Forex"
#property  link      ""
//---- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Red
#property  indicator_color2  Red
#property indicator_level1   0.0
//---- indicator parameters
//extern bool  AudioAlerts=true;
//extern bool  VisualAlerts=true;
extern int   SMA   =8;
//---- indicator buffers
double     ind_buffer1[];
double     ind_buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexDrawBegin(0,SMA);
   SetIndexDrawBegin(1,SMA);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("FF Tunnel Slope("+SMA+")");
   SetIndexLabel(0,"Slope");
//   SetIndexLabel(1,"SlopeH");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- Slope counted in the 1-st buffer
   for(int i=0; i<limit; i++)
      {
         ind_buffer1[i]=iMA(NULL,0,SMA,0,MODE_SMA,PRICE_CLOSE,i) - iMA(NULL,0,SMA,0,MODE_SMA,PRICE_CLOSE,i+1);
         ind_buffer2[i]=ind_buffer1[i];
      }
      
       //+--------------------------------------------------------------------------+
       //-                          ALERTS    PlaySound("alert.wav");               -
       //+--------------------------------------------------------------------------+
//      if(AudioAlerts)
//      {
//         if(ind_buffer1[i]==0)
//         {
//            PlaySound("alert2.wav");
//         }
//      }
//
//      if(VisualAlerts)
//      {
//         if(ind_buffer1[i]==0)
//         {
//            Alert(Symbol()," ", Period(), "min Tunnel Slope Change - ",Close[i],"\n Time: ", TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
//         }
//      }
//         
//      
//      
//---- done
   return(0);
  }



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_HISTOGRAM


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: