55 lines
No EOL
3.5 KiB
MQL4
55 lines
No EOL
3.5 KiB
MQL4
//+------------------------------------------------------------------+
|
|
//| KG Average HLCC.mq4 |
|
|
//| Copyright © 2008, MetaQuotes Software Corp. |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Copyright © 2008, Goen"
|
|
#property link "http://www.forexindo.com/forum/showthread.php?t=95"
|
|
|
|
#property indicator_chart_window
|
|
#property indicator_buffers 3
|
|
#property indicator_color3 Lime
|
|
|
|
//---- buffers
|
|
|
|
double AverageDay[];
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Custom indicator initialization function |
|
|
//+------------------------------------------------------------------+
|
|
int init()
|
|
{
|
|
|
|
SetIndexStyle(2,DRAW_LINE,0,2);
|
|
SetIndexBuffer(2,AverageDay);
|
|
SetIndexLabel(2,"Average Day");
|
|
IndicatorShortName("KG Average HLCC,");
|
|
return(0);}
|
|
//----
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| MTF Moving Average |
|
|
//+------------------------------------------------------------------+
|
|
int start()
|
|
{
|
|
datetime TimeArray[];
|
|
int i,shift,limit,y=0,counted_bars=IndicatorCounted();
|
|
|
|
|
|
|
|
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),1440);
|
|
limit=Bars-counted_bars+1440/Period();
|
|
for(i=0,y=0;i<limit;i++)
|
|
{
|
|
if (Time[i]<TimeArray[y]) y++;
|
|
AverageDay[i] = (iHigh(NULL,PERIOD_D1,y+1) + iLow(NULL,PERIOD_D1,y+1) +
|
|
iClose(NULL,PERIOD_D1,y+1) + iClose(NULL,PERIOD_D1,y+1))/4;
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
return(0);
|
|
}
|
|
//+------------------------------------------------------------------+ |