Navigation:Home > Content >

TDI-RT-H-MBL_v1.mq4

Time: 2011-07-28 | Download file:TDI-RT-H-MBL_v1.mq4

//+------------------------------------------------------------------+
//|			                                    TDI-RT-H-MBL.mq4     |
//|         						          Copyright © 2012 Zoidy |
//+------------------------------------------------------------------+

#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_width1  4
#property indicator_width2  4
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100

extern int signal_level = 50;

extern string TDI_RT_Indicator_Name = "TDI_RT";

double MBLup[];
double MBLdown[];

int init()
  {
   IndicatorShortName("TDI - Market Base Line");
   SetIndexBuffer(0,MBLup);
   SetIndexBuffer(1,MBLdown);
   
   SetIndexStyle(0,DRAW_HISTOGRAM); 
   SetIndexStyle(1,DRAW_HISTOGRAM); 
   
   SetIndexLabel(0, "Market Base Line Up" ); 
   SetIndexLabel(1, "Market Base Line Down" ); 

   return(0);
  }

double marketBaseLine0, marketBaseLine1;

int start()
  {
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;

   for (int i=limit;i>=0;i--)  
      {
		/*
		   SetIndexBuffer(1,UpZone); SetIndexLabel(1,"VB High"); 
		   SetIndexBuffer(2,marketBaseLineBuf); SetIndexLabel(2,"Market Base Line"); 
		   SetIndexBuffer(3,DnZone); SetIndexLabel(3,"VB Low"); 
		   SetIndexBuffer(4,rsiPriceLineBuf); SetIndexLabel(4,"RSI Price Line");
		   SetIndexBuffer(5,tradeSignalLineBuf); SetIndexLabel(5,"Trade Signal Line");
		*/
      	
      marketBaseLine0 = iCustom(NULL, 0, TDI_RT_Indicator_Name, 2, i);
      marketBaseLine1 = iCustom(NULL, 0, TDI_RT_Indicator_Name, 2, i+1);
       
	  // work out histograms
	  MBLup[i] = 0;
	  MBLdown[i] = 0;
	  
	  // MBL going up
	  if(marketBaseLine0 > marketBaseLine1) {
	      MBLup[i] = signal_level;
	  }
	  // MBL going down
	  else if(marketBaseLine0 < marketBaseLine1) {
	      MBLdown[i] = signal_level;
 	  }
    } 
//----
   return(0);
  }

//+------------------------------------------------------------------+

Recommend