//+------------------------------------------------------------------+
//| Keystone-Histogram.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://www.mql5.com,https,https |
//+------------------------------------------------------------------+
#property version "1.00"
#property copyright "SoeHoe"
#property link "https://soehoe.com/rf/?c=GINUCE8M"
#property description "Free!! Click Copy Right to Get More"
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_separate_window
#property indicator_buffers 3
#property strict
input bool ucci=1;//Use CCI
input int ccip=14;//CCI Periode
input bool ursi=1;//Use RSI
input int rsip=14;//RSI Periode
input bool uadx=1;//Use ADX
input int adxp=14;//ADX Periode
input bool upsar=1;//Use P-Sar
input bool umacd=1;//Use MACD
input color U=LimeGreen;//Up Color
input color D=Red;//Down Color
input color NS=Silver;//No Sig Color
double ExtBuffer0[];
double ExtBuffer1[];
double ExtBuffer2[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void LABEL(string name,string fontname,int besarfont,int jarak_X,int jarak_Y,color a_color,int corner,string text)
{
if(ObjectFind(name)<0) ObjectCreate(name,OBJ_LABEL,0,0,0);
ObjectSetText(name,text,besarfont,fontname,a_color);
ObjectSet(name,OBJPROP_CORNER,corner);
ObjectSet(name,OBJPROP_XDISTANCE,jarak_X);
ObjectSet(name,OBJPROP_YDISTANCE,jarak_Y);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
LABEL("gmail","Californian Fb Italic",10,10,5,clrMaroon,3,"joniweitu@gmail.com");
IndicatorShortName("Keystone-Histogram");
IndicatorBuffers(3);
SetIndexBuffer(0,ExtBuffer0);
SetIndexBuffer(1,ExtBuffer1);
SetIndexBuffer(2,ExtBuffer2);
SetIndexStyle(0,DRAW_HISTOGRAM,0,3,U);
SetIndexStyle(1,DRAW_HISTOGRAM,0,3,D);
SetIndexStyle(2,DRAW_HISTOGRAM,0,2,NS);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
int i,limit;
double adx,cci,rsi,sar,macd,macd1;
limit=rates_total-prev_calculated;
limit=(limit<1)?2:limit=limit;
for(i=1; i<limit; i++)
{
adx = iADX(NULL,0,adxp,0,0,i);
rsi = iRSI(NULL,0,rsip,0,i);
cci = iCCI(NULL,0,ccip,0,i);
sar = iSAR(NULL,0,0.02,0.2,i);
macd = iMACD(NULL,0,12,26,9,0,0,i);
macd1 = iMACD(NULL,0,12,26,9,0,1,i);
if(((uadx && adx>=25) || !uadx) && ((ucci && cci>=160) || !ucci) && ((ursi && rsi>=70) || !ursi) && ((umacd && macd>macd1) || !umacd) &&
((upsar && sar<close[i]) || !upsar))ExtBuffer0[i]=1;
else if(((uadx && adx>=25) || !uadx) && ((ucci && cci<=-160) || !ucci) && ((ursi && rsi<=30) || !ursi) && ((umacd && macd<macd1) || !umacd) &&
((upsar && sar>close[i]) || !upsar))ExtBuffer1[i]=1;
else ExtBuffer2[i]=1;
}
return(rates_total);
}
//+------------------------------------------------------------------+