Navigation:Home > Content >

IP(BBS-m)v.8e1.mq4

Time: 2013-03-28 | Download file:IP(BBS-m)v.8e1.mq4

//+------------------------------------------------------------------+
//|                                                  Total_Power.mq4 |
//|                               Copyright © 2012, Gehtsoft USA LLC |
//|                                            http://fxcodebase.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2012, Gehtsoft USA LLC"
#property link      "http://fxcodebase.com"


//#property indicator_chart_window
#property indicator_separate_window

#property indicator_buffers 6
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
#property indicator_color4 Red
#property indicator_color5 Black
#property indicator_color6 White



extern int LookbackPeriod=10; // Period of indicator
extern int PowerPeriod=128;    // Period of EMA
extern int LookbackPeriod1=10; // Period of indicator
extern int PowerPeriod1=128;    // Period of EMA
extern int EMA5=10;
extern int EMA2=10;
extern int PriceMode=0;

double Power[], BearPower[], BullPower[],Power1[], BearPower1[], BullPower1[];
string fast_name;

int init()
  {
   IndicatorShortName("IP(BBS-m)v.8e1");
   SetIndexStyle(0,DRAW_NONE);
   SetIndexBuffer(0,Power);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,BearPower);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,BullPower);
   SetIndexStyle(3,DRAW_NONE);
   SetIndexBuffer(3,Power1);
   SetIndexStyle(4,DRAW_NONE);
   SetIndexBuffer(4,BearPower1);
   SetIndexStyle(5,DRAW_NONE);
   SetIndexBuffer(5,BullPower1);
   switch(PriceMode)
   {
   case 1 : fast_name="Open"; break;
   case 2 : fast_name="High"; break;
   case 3 : fast_name="Low"; break;
   case 4 : fast_name="Median"; break;
   case 5 : fast_name="Typical"; break;
   case 6 : fast_name="Weighted"; break;
   default: PriceMode=0; fast_name="Close";
   }      


   return(0);
  }

int deinit()
  {

   return(0);
  }

int start()
  {
  
   if(Bars<=LookbackPeriod) return(0);
   int ExtCountedBars=IndicatorCounted();
   if (ExtCountedBars<0) return(-1);
   int    pos=Bars-2;
   if(ExtCountedBars>2) pos=Bars-ExtCountedBars-1;
   while(pos>=0)
   {
    double BullCount=0;
    double BearCount=0;
    double BullCount1=0;
    double BearCount1=0;
    for (int i=1;i<=LookbackPeriod-1;i++)
    for ( i=1;i<=LookbackPeriod1-1;i++)
    
    {
     double EMA=iCustom(NULL,0,"!Ultra ADX(1)~",EMA5,PriceMode,pos-i);
     double EMA1=iCustom(NULL,0,"!Ultra ADX(1)~",EMA5,PriceMode,pos-i);
     if (High[pos-i]  >EMA) BullCount++;
     if (Low[pos-i]  EMA1) BullCount++; else BearCount++;
     double EMA3=iCustom(NULL,0,"!Ultra ADX(1)~",EMA2,PriceMode,pos);
     double EMA4=iCustom(NULL,0,"!Ultra ADX(1)~",EMA2,PriceMode,pos);
     if (High[pos-i] >EMA3) BullCount1++;
     if (Low[pos-i]         

Recommend