Firebird-v63H-SafeArea-ind





//+------------------------------------------------------------------+
//|                                          Firebird Indicators.mq4 |
//|                                        Copyright © 2006, Swissly |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Swissly"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red

//---- input parameters
extern int           TimeFrame   = 15;          // this indicatior can only be used in 1, 5, 15min timeframes
extern int           BPeriod     = 20;
extern int           SafeArea    = 40;
//---- buffers
double ExtMapBuffer1[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   string short_name = "Firebird SafeArea ";
   IndicatorShortName(short_name);
//----
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
//----
   
//----
   return(0);
}


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   datetime TimeArray[];
   int   counted_bars=IndicatorCounted();
   int   type, limit, spread, y=0, pos=0;

//---- check for possible errors
   if (counted_bars<0) return(-1);

//---- last counted bar will be recounted
   if (counted_bars>0) counted_bars--;

// Plot defined timeframe on to current timeframe   
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   
//---- main calculation loop

   limit = Bars-counted_bars;
   for(pos=0,y=0;pos<limit;pos++)
   {
      if (Time[pos]<TimeArray[y]) y++; 
   
      double Safe = iBullsPower(NULL,TimeFrame,BPeriod,PRICE_WEIGHTED,y)+iBearsPower(NULL,TimeFrame,BPeriod,PRICE_WEIGHTED,y);
      Safe=Safe/Point;
      ExtMapBuffer1[pos] = SafeArea - MathAbs(Safe);
   }
  
//----
   return(0);
} // end of main program loop
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Bears Power indicator
Bulls Power indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: