//+--------------------------------------------------------------------+
//| MidDay.mq4|
//| Copyright © 2008, Sugeng Pudjiono |
//| http://www.payroll-kita.com/ |
//+--------------------------------------------------------------------+
#property copyright "Copyright © 2007, Sugeng Pudjiono"
#property link "http://www.payroll-kita.com/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_color2 Red
int deinit()
{
GlobalVariablesDeleteAll();
return(0);
}
//---- input parameters
//---- indicator buffers
double ExtTopBuffer[];
double ExtBotBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexShift(0,0);
SetIndexDrawBegin(0,0);
SetIndexBuffer(0,ExtTopBuffer);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,242);
SetIndexLabel(0,"Sell");
SetIndexShift(1,0);
SetIndexDrawBegin(1,0);
SetIndexBuffer(1,ExtBotBuffer);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,241);
SetIndexLabel(1,"Buy");
return(0);
}
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
limit=WindowFirstVisibleBar()+96*2;
int IndexM1, SisaIndex;
SisaIndex = MathMod(TimeMinute(TimeCurrent()),Period());
for(int i=limit; i>-1; i--)
{
IndexM1=i*Period()+SisaIndex;
if(iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,IndexM1)>50)
{
ExtTopBuffer[i]=High[i]+5*Point;
ExtBotBuffer[i]=0;
}
if(iRSI(NULL,PERIOD_M1,14,PRICE_CLOSE,IndexM1)<=50)
{
ExtTopBuffer[i]=0;
ExtBotBuffer[i]=Low[i]-5*Point;
}
}
return(0);
}
Comments