Navigation:Home > Content >

ADX_HDSqz_mtf_2.mq4

Time: 2018-02-09 | Download file:ADX_HDSqz_mtf_2.mq4

//+------------------------------------------------------------------+
//| ADX_HDSqueeze_mtf                                        ADX.mq4 |
//|                                      Copyright © 2006, Keris2112 |
//|DI levelShift; +DI-(-DI)Hist; MTF keris ki  www.forex-tsd.com 2007|
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Keris2112"
#property link      "http://www.forex-tsd.com"

#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 SlateGray
#property indicator_color2 Green
#property indicator_color3 Red
#property indicator_color4 DodgerBlue
#property indicator_color5 Red
#property indicator_color6 Gold
#property indicator_width2 2
//#property indicator_width3 2

#property indicator_level1  30
#property indicator_level2  20
#property indicator_level3 -20
#property indicator_levelcolor DarkSlateGray
#property indicator_levelstyle 4
//#property indicator_maximum  100
//#property indicator_minimum -100


//---- input parameters
/*************************************************************************
PERIOD_M1   1
PERIOD_M5   5
PERIOD_M15  15
PERIOD_M30  30 
PERIOD_H1   60
PERIOD_H4   240
PERIOD_D1   1440
PERIOD_W1   10080
PERIOD_MN1  43200
You must use the numeric value of the timeframe that you want to use
when you set the TimeFrame' value with the indicator inputs.
---------------------------------------
PRICE_CLOSE    0 Close price. 
PRICE_OPEN     1 Open price. 
PRICE_HIGH     2 High price. 
PRICE_LOW      3 Low price. 
PRICE_MEDIAN   4 Median price, (high+low)/2. 
PRICE_TYPICAL  5 Typical price, (high+low+close)/3. 
PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4. 
You must use the numeric value of the Applied Price that you want to use
when you set the 'applied_price' value with the indicator inputs.
**************************************************************************/
extern int TimeFrame=0;
extern int ADXperiod=14;
extern int DIperiod =14;
       int DI_vertShift = 0;
extern int       BBsqueezArwShift=-15;
extern int       bolPrd=20;
extern double    bolDev=2.0;
extern int       keltPrd=20;
extern double    keltFactor=1.5;



extern int BarsToCount = 1200;
//extern string  note__MaMode_Price = "Price(OCHLMTF)ModeMa(SMA0,EMA1,SmmMA2,LWMA3";
extern string  note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double arrowBuffer[];
double DVertShift;
double diff,std,bbs;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicator line
    SetIndexEmptyValue(0,EMPTY_VALUE);
    SetIndexEmptyValue(1,EMPTY_VALUE);
    SetIndexEmptyValue(2,EMPTY_VALUE);
    SetIndexEmptyValue(3,EMPTY_VALUE);
    SetIndexEmptyValue(4,EMPTY_VALUE);
 
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(2,ExtMapBuffer3);
   
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexBuffer(4,ExtMapBuffer5);


   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE);
  
    SetIndexEmptyValue(5,EMPTY_VALUE);
    SetIndexBuffer    (5,arrowBuffer);
    SetIndexStyle     (5,DRAW_ARROW);
    SetIndexArrow     (5,158); //159

   SetIndexLabel(0,"ADX ("+ADXperiod+"["+TimeFrame+"]");
   SetIndexLabel(1,"");
   SetIndexLabel(2,"");
   SetIndexLabel(3,"ADX+DI ("+DIperiod+"["+TimeFrame+"]");
   SetIndexLabel(4,"ADX-DI ("+DIperiod+"["+TimeFrame+"]");
   SetIndexLabel(5,"BBsquise ("+bolPrd+"["+TimeFrame+"]");

//---- name for DataWindow and indicator subwindow label
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="M1"; break;
      case 5 : TimeFrameStr="M5"; break;
      case 15 : TimeFrameStr="M15"; break;
      case 30 : TimeFrameStr="M30"; break;
      case 60 : TimeFrameStr="H1"; break;
      case 240 : TimeFrameStr="H4"; break;
      case 1440 : TimeFrameStr="D1"; break;
      case 10080 : TimeFrameStr="W1"; break;
      case 43200 : TimeFrameStr="MN"; break;
      default : TimeFrameStr="TF0";
   }
   IndicatorShortName("ADX ("+ADXperiod+") ["+TimeFrameStr+"] ");

  }
//----
   return(0);
 
//+------------------------------------------------------------------+
//| MTF                                                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   limit=Bars-counted_bars;
   limit=MathMax(limit,TimeFrame/Period());
   limit=MathMin(limit,BarsToCount );  

   for(i=0,y=0;i        

Recommend