//+------------------------------------------------------------------+
//| MTF_Heiken_Ashi[sw].mq4 |
//| S-tf-X. |
//| |
//+------------------------------------------------------------------+
#property copyright "STFX."
#property link "S-tf-X"
//----
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_color4 Lime
extern string S1 ="Graph Reference";
extern int TimeFrame=240;
extern int Shift=0;
extern string S1a ="Settings Heiken Ashi";
extern int MaMetod =2;
extern int MaPeriod=6;
extern int MaMetod2 =3;
extern int MaPeriod2=2;
//----
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0,DRAW_HISTOGRAM, 0, 0, Red);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexShift(0, Shift);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 0, Lime);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexShift(1, Shift);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, 0, Red);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexShift(2, Shift);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, 0, Lime);
SetIndexBuffer(3, ExtMapBuffer4);
SetIndexShift(3, Shift);
//---- 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";
}
IndicatorShortName("MTF_HEikin_Ashi[sw]("+TimeFrameStr+")");
}
//----
return(0);
//+------------------------------------------------------------------+
//| MTF_HEikin_Ashi |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted(),ExtMap Buffer1prev,ExtMapBuffer2prev;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeF rame);
//----
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,0,y);
ExtMapBuffer2[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,1,y);
ExtMapBuffer3[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,2,y);
ExtMapBuffer4[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,3,y);
ExtMapBuffer4[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,4,y);
ExtMapBuffer4[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,5,y);
ExtMapBuffer4[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,6,y);
ExtMapBuffer4[i]=iCustom(NULL,TimeFrame,"Heiken_Ashi_Smoothed",MaM etod,MaPeriod,MaMetod2,MaPeriod2,7,y);
}
//----
return(0);
}
//+------------------------------------------------------------------+