5 6296500855700983549.mq4
5 6296500855700983549.mq4
5 6296500855700983549.mq4
//| Bheurekso_pattern.mq4 |
//| Nikelodeon |
//| |
//+------------------------------------------------------------------+
#property copyright "Nikelodeon"
#property link ""
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrLime
#property indicator_color2 clrRed
//---- input parameters
extern bool lines = true;
extern bool texts = true;
extern bool arrows = true;
extern int step = 500;
extern bool Dell = true;
extern string ___ = "Alerts";
extern bool displayAlert = true;
extern bool alertsMessage = true;
extern bool alertsSound = true;
extern bool alertsNotify = false;
extern bool alertsEmail = false;
extern string alertsSoundName = "alert1.wav";
extern double arrowDisplacement = 1.0;
extern double textDisplacement = 1.5;
extern color arrowUpColor = clrLimeGreen;
extern color arrowDnColor = clrRed;
extern color lineUpColor = clrLimeGreen;
extern color lineDnColor = clrRed;
string Indi_ID="Bheurekso_";
//----buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,108);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,108);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDelete(Indi_ID);
//----
return(0);
}
//+------------------------------------------------------------------+
//SetArrow(t[shift1],l[shift1]-15*Point,233,LIME);
void SetArrow(int sh, datetime tm, double pr, int cod,color clr)
{
ObjectCreate(Indi_ID+"Arrow-"+sh,OBJ_ARROW,0,tm,pr);
ObjectSet(Indi_ID+"Arrow-"+sh,OBJPROP_ARROWCODE,cod);
ObjectSet(Indi_ID+"Arrow-"+sh,OBJPROP_COLOR,clr);
ObjectSetInteger(0,Indi_ID+"Arrow-"+sh,OBJPROP_ANCHOR,ANCHOR_TOP);
}
void SetArrow1(int sh, datetime tm, double pr, int cod,color clr)
{
ObjectCreate(Indi_ID+"Arrow+"+sh,OBJ_ARROW,0,tm,pr);
ObjectSet(Indi_ID+"Arrow+"+sh,OBJPROP_ARROWCODE,cod);
ObjectSet(Indi_ID+"Arrow+"+sh,OBJPROP_COLOR,clr);
ObjectSetInteger(0,Indi_ID+"Arrow+"+sh,OBJPROP_ANCHOR,ANCHOR_BOTTOM);
}
//SetText(t[shift1],l[shift1]-28*Point,"Engulfing",LIME);
void SetText(int sh,datetime tm,double pr,string text,color clr)
{
ObjectCreate(Indi_ID+"x"+sh,OBJ_TEXT,0,tm,pr);
ObjectSetText(Indi_ID+"x"+sh,text);
ObjectSet(Indi_ID+"x"+sh,OBJPROP_COLOR,clr);
}
void SetText1(int sh,datetime tm,double pr,string text,color clr)
{
ObjectCreate(Indi_ID+"y"+sh,OBJ_TEXT,0,tm,pr);
ObjectSetText(Indi_ID+"y"+sh,text);
ObjectSet(Indi_ID+"y"+sh,OBJPROP_COLOR,clr);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
int myBars=0, StartBar=0;//, Kedip(false);
int shift=0, shift1=0, shift2=0, shift3=0;
bool BullEngulf=False, MorningStar=False, BullPierce=False,
Hammer=False,Name=false,Arrow=false;
bool BearEngulf=False, EveningStar=False, DarkCloud=False,
Shooter=False,Name1=false,Arrow1=false;
bool BullHarami=False, BearHarami=false, BullCross=false, BearCross=false,up=false,down=false;
int limit,n,a,b,x, doji=false;
double l[1000] ,h[1000];
int p3[100],x1[100];
p3[1]=0;
if(myBars!=Bars)
{
myBars=Bars;
}
limit=step;//Bars-counted_bars;
for(shift=limit;shift>=0;shift--)
{
// Manjakan MT
shift1=shift+1;
shift2=shift+2;
shift3=shift+3;
(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift1)>iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift2)) &&
(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift2)>iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift3)))
up=true;
else up=false;
if
((iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift)<iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift1)) &&
(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift1)<iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift2)) &&
(iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift2)<iMA(NULL,0,5,0,MODE_EMA,PRICE_CLOSE,shift3)))
down=true;
else down=false;
// Hammer
if((Open[shift1]-Low[shift1]>MathMax(High[shift1]-Close[shift1],Close[shift1]-
Open[shift1])*3) &&
(Close[shift1]-Low[shift1]>MathMax(High[shift1]-Close[shift1],Close[shift1]-
Open[shift1])*3))
Hammer=True;
else
Hammer=False;
if ((Open[shift2]<Close[shift2]) &&
(Open[shift1]<Close[shift2])&&(Open[shift1]>Open[shift2])&& (Close[shift1]<Open[shift2]))
BearCross=true;
else BearCross=false;
//--- Bearish Dark Cloud (2 bars) cuma cari kalo ga ada BearEngulf
if(!BearEngulf)
{
if((Close[shift2]>Open[shift2]) && ((Open[shift1]>Close[shift2]) /*||
(High[shift1]>High[shift2]*/) &&
(Close[shift1]<Close[shift2]-((Close[shift2]-Open[shift2])/2)))
DarkCloud=True;
else
DarkCloud=False;
}
else
{
DarkCloud=False;
}
// Shooting Star
if((up)&&(High[shift1]-Open[shift1]>MathMax(Close[shift1]-Low[shift1],Open[shift1]-
Close[shift1])*3)&&
(High[shift1]-Close[shift1]>MathMax(Close[shift1]-Low[shift1],Open[shift1]-
Close[shift1])*3))
Shooter=True;
else
Shooter=False;
//ïîäòâåðæäåíèå
if( (BullEngulf || BullPierce || MorningStar || BullHarami || BullCross ) &&
(Close[shift]>Close[shift1])&& Close[shift]>Open[shift1]){
// ExtMapBuffer1[shift] = Low[shift]-7*Point;
Name=true;
Arrow=true;
}
else
{ExtMapBuffer1[shift] = 0.0; Name=false; Arrow=false; }
if (Hammer){
if ((down)) {Name=true;
Arrow=true;}
// ExtMapBuffer1[shift] = Low[shift]-7*Point;}
else {Name=false; Arrow=false;}
if ((up)) {Name1=true;
Arrow1=true;}
// ExtMapBuffer2[shift] = High[shift]+7*Point;}
else {Name1=false; Arrow1=false;}
}
if(BullCross)
{
if(Name){n++;
if(texts) SetText(n,Time[shift1],Low[shift1]-
textDisplacement*iATR(NULL,0,20,shift1),"BullCross",lineUpColor);
l[n]=Low[shift1];
Setline(n,Time[shift1],l[n],Time[shift],l[n],lineUpColor);}
if(Arrow&&arrows)
SetArrow(n,Time[shift1],Low[shift1]-
arrowDisplacement*iATR(NULL,0,20,shift1),233,arrowUpColor);
if (displayAlert == true) DisplayAlert("Bull Cross",shift);
}
if(BullEngulf)
{
if(Name){
n++;
l[n]=Low[shift1];
Setline(n,Time[shift1],l[n],Time[shift],l[n],lineUpColor);
if(texts) SetText(n,Time[shift1],Low[shift1]-
textDisplacement*iATR(NULL,0,20,shift1),"BullEngulf",lineUpColor);}
if(Arrow&&arrows)
SetArrow(n,Time[shift1],Low[shift1]-
arrowDisplacement*iATR(NULL,0,20,shift1),233,arrowUpColor);
if (displayAlert == true) DisplayAlert("Bullish Engulfing",shift);
}
if(BullPierce)
{
if(Name){
n++;
l[n]=Low[shift1];
Setline(n,Time[shift1],l[n],Time[shift],l[n],lineUpColor);
if(texts) SetText(n,Time[shift1],Low[shift1]-
textDisplacement*iATR(NULL,0,20,shift1),"BullPierce",lineUpColor);}
if(Arrow&&arrows)
SetArrow(n,Time[shift1],Low[shift1]-
arrowDisplacement*iATR(NULL,0,20,shift1),233,arrowUpColor);
if (displayAlert == true) DisplayAlert("Bullish Piercing",shift);
}
if(MorningStar)
{
if(Name){
n++;
if(texts) SetText(n,Time[shift2],Low[shift2]-
textDisplacement*iATR(NULL,0,20,shift2),"MorningStar",lineUpColor);
l[n]=Low[shift2];
Setline(n,Time[shift2],l[n],Time[shift],l[n],lineUpColor);}
if(Arrow&&arrows)
SetArrow(n,Time[shift2],Low[shift2]-
arrowDisplacement*iATR(NULL,0,20,shift2),233,arrowUpColor);
if (displayAlert == true) DisplayAlert("Morning Star",shift);
}
if(Hammer)
{
if(Name){
n++;
if(texts) SetText(n,Time[shift1],Low[shift1]-
textDisplacement*iATR(NULL,0,20,shift1),"Hammer",lineUpColor);
l[n]=Low[shift1];
Setline(n,Time[shift1],l[n],Time[shift],l[n],lineUpColor);}
if(Arrow&&arrows)
SetArrow(n,Time[shift1],Low[shift1]-
arrowDisplacement*iATR(NULL,0,20,shift1),233,arrowUpColor);
if (displayAlert == true) DisplayAlert("Bullish Hammer",shift);
}
///
////////////////////////////////////////////////////////////////////////////////////
//
//ìîäåëè ìåäâåäåé
if(BearHarami)
{
if(Name1){
x++;
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"BearHarami",lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Bear Harami",shift);
}
if(BearCross)
{
if(Name1){ x++;
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"BearCross",lineDnColor);
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Bear Cross",shift);
}
if(Hammer)
{
if(Name1){ x++;
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"Hammer",lineDnColor);
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Bearish Hammer",shift);
}
if(BearEngulf)
{
if(Name1){
x++;
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"BearEngulf",lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Bearish Engulfing",shift);
}
if(DarkCloud)
{
if(Name1){x++;
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"DarkCloud",lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Dark Cloud",shift);
}
if(EveningStar)
{
if(Name1){
x++;
h[x]=High[shift2];
Setline1(x,Time[shift2],h[x],Time[shift],h[x],lineDnColor);
if(texts)
SetText1(x,Time[shift2],High[shift2]+textDisplacement*iATR(NULL,0,20,shift2),"EveningStar",lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift2],High[shift2]+arrowDisplacement*iATR(NULL,0,20,shift2),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Evening Star",shift);
}
if((Shooter))
{
if(Name1){ x++;
if(texts)
SetText1(x,Time[shift1],High[shift1]+textDisplacement*iATR(NULL,0,20,shift1),"Shooter",lineDnColor);
h[x]=High[shift1];
Setline1(x,Time[shift1],h[x],Time[shift],h[x],lineDnColor);}
if(Arrow1&&arrows)
SetArrow1(x,Time[shift1],High[shift1]+arrowDisplacement*iATR(NULL,0,20,shift1),234,arrowDnColor);
if (displayAlert == true) DisplayAlert("Shooting Star",shift);
}
//
//
//
//
//
if (lines){
ObjectSetInteger(0,Indi_ID+"-"+n,OBJPROP_TIME2,Time[0]+13*_Period*60);
ObjectSetInteger(0,Indi_ID+"+"+x,OBJPROP_TIME2,Time[0]+13*_Period*60);
for (int i=1; i<50;i++) {
if (Close[shift]<l[i]){ObjectSet(Indi_ID+"-"+i,6,DodgerBlue); ObjectSet(Indi_ID+"-"+i,7,STYLE_DASHDOT);
ObjectSet(Indi_ID+"x"+i,OBJPROP_COLOR,DarkBlue);ObjectSet(Indi_ID+"Arrow-"+i,OBJPROP_COL
OR,DodgerBlue);
if (Dell)
{ObjectDelete(Indi_ID+"-"+i);ObjectDelete(Indi_ID+"x"+i);ObjectDelete(Indi_ID+"Arrow-"+i);}
}
}
for (int q=1; q<50;q++) {
if (Close[shift]>h[q]){ObjectSet(Indi_ID+"+"+q,6,White); ObjectSet(Indi_ID+"+"+q,7,STYLE_DASHDOT);
ObjectSet(Indi_ID+"y"+q,OBJPROP_COLOR,White);ObjectSet(Indi_ID+"Arrow+"+q,OBJPROP_COLO
R,White);
if (Dell)
{ObjectDelete(Indi_ID+"+"+q);ObjectDelete(Indi_ID+"y"+q);ObjectDelete(Indi_ID+"Arrow+"+q);}
}
StartBar-=1;
}
if(IsNewBar(PERIOD_CURRENT))
{
ObjectsDelete(Indi_ID);
}
//Comment(p3[1],p3[2],p3[3],p3[4],p3[5],p3[6],p3[7],) ;
//Comment(x1[1],x1[2],x1[3],x1[4],x1[5],x1[6],x1[7],);
//----
return(0);
}
//+------------------------------------------------------------------+
void DisplayAlert(string doWhat, int shift)
{
string message;
static datetime lastAlertTime;
if(shift <= 2 && Time[0] != lastAlertTime)
{
message = StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," Candlestick
",doWhat);
if (alertsMessage) Alert(message);
if (alertsNotify) SendNotification(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol()," Candlestick "),message);
if (alertsSound) PlaySound(alertsSoundName);
lastAlertTime = Time[0];
}
}
//+------------------------------------------------------------------+
void ObjectsDelete(string name)
{
for(int j=0;j<10;j++)
for(int i=0;i<ObjectsTotal();i++)
{
if(StringFind(ObjectName(i),name,0)>-1)
ObjectDelete(0,ObjectName(i));
}
}
//+------------------------------------------------------------------+
bool IsNewBar(ENUM_TIMEFRAMES per)
{
static datetime Trend_Candle_prevTime1 = -1;
if(Trend_Candle_prevTime1 != iTime(_Symbol,per,6))
{
Trend_Candle_prevTime1 = iTime(_Symbol,per,6);
return(true);
}
return(false);
}
//+------------------------------------------------------------------+
//
//
//
//
//