//+------------------------------------------------------------------+
//| Z MTF_DoubleWoodies.mq4 |
//| |
//+------------------------------------------------------------------+
#property copyright " Z MTF_DoubleWoodies "
#property link " Z MTF_DoubleWoodies "
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 Red
#property indicator_width1 3
#property indicator_width2 3
#property indicator_color3 Silver
#property indicator_color4 Gold
#property indicator_width3 3
#property indicator_color5 DarkKhaki
#property indicator_color6 White//Magenta
#property indicator_width6 2
#property indicator_color7 Gold
#property indicator_level1 160
#property indicator_level2 250
#property indicator_level4 0
#property indicator_level6 -250
#property indicator_level7 -160
#property indicator_levelcolor Silver
#property indicator_levelstyle STYLE_DOT
#property indicator_levelwidth 1
#property indicator_maximum 280
#property indicator_minimum -280
extern int TimeFrame = 60;//15
extern int TrendCCI_Period = 13; //14
extern int EntryCCI_Period = 5; //3
extern int Trend_period = 1;//2
extern int CountBars = 500;
extern bool Zero_Cross_Alert;
extern int LineSize1 = 2;
extern int LineSize2 = 3;
extern int LineSize3 = 2;//1
double TrendCCI[];
double EntryCCI[];
double CCITrendUp[];
double CCITrendDown[];
double CCINoTrend[];
double CCITimeBar[];
double ZeroLine[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(4, DRAW_LINE, STYLE_SOLID,3);//LimeGreen
SetIndexBuffer(4, TrendCCI);
SetIndexLabel(4, "TrendCCI");
SetIndexStyle(0, DRAW_HISTOGRAM, 0,2);//Red
SetIndexBuffer(0, CCITrendUp);
SetIndexStyle(1, DRAW_HISTOGRAM, 0,2);//Silver
SetIndexBuffer(1, CCITrendDown);
SetIndexStyle(2, DRAW_HISTOGRAM, 0,2);//Gold
SetIndexBuffer(2, CCINoTrend);
SetIndexStyle(3, DRAW_HISTOGRAM, 0,2);//DarkKhaki
SetIndexBuffer(3, CCITimeBar);
SetIndexStyle(5, DRAW_LINE, STYLE_SOLID,2);//Magenta
SetIndexBuffer(5, EntryCCI);
SetIndexLabel(5, "EntryCCI");
SetIndexStyle(6, DRAW_LINE, STYLE_SOLID,2);//Gold
SetIndexBuffer(6, ZeroLine);
//---- name for DataWindow and indicator subwindow label
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
string short_name;
short_name="MTF Woodies ("+TimeFrame+","+TrendCCI_Period+","+EntryCCI_Period+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
}
//----
return(0);
//+------------------------------------------------------------------+
//| MTF Parabolic Sar |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
SetIndexDrawBegin(0,Bars-CountBars);
SetIndexDrawBegin(1,Bars-CountBars);
SetIndexDrawBegin(2,Bars-CountBars);
SetIndexDrawBegin(3,Bars-CountBars);
SetIndexDrawBegin(4,Bars-CountBars);
SetIndexDrawBegin(5,Bars-CountBars);
SetIndexDrawBegin(6,Bars-CountBars);
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;// <<<<<<<<<<<<<<< NB <<<<<<<<<<<<<<<<<<<
if(counted_bars>0) limit++; else if (limit>100) limit=CountBars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
TrendCCI[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,4,y);
CCITrendUp[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,0,y);
CCITrendDown[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,1,y);
CCINoTrend[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,2,y);
CCITimeBar[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,3,y);
EntryCCI[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,5,y);
ZeroLine[i]=iCustom(NULL,TimeFrame,"DoublecciWoody",TrendCCI_Period,EntryCCI_Period,Trend_period,6,y);
}
return(0);
}
//+------------------------------------------------------------------+
//*************************************************************************
//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.
//**************************************************************************/
// Add your main indicator loop below. You can reference an existing
// indicator with its iName or iCustom.
// Rule 1: Add extern inputs above for all neccesary values
// Rule 2: Use 'TimeFrame' for the indicator time frame
// Rule 3: Use 'y' for your indicator's shift value
// **********************************************************/
Comments