//+------------------------------------------------------------------+ //| RFractals.mq4 | //| Lizhniyk E | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Lizhniyk E www.expforex.com edit AlertArrow" #property link "http://www.metaquotes.net www.expforex.com edit AlertArrow" #property indicator_chart_window #property indicator_buffers 2 #property indicator_width1 1 #property indicator_width2 1 #property indicator_color1 Blue #property indicator_color2 Red //---- input parameters //extern int rpoint=150; extern int range_fractal=5; //ранг фрактала (нечётные числа не менее 3) //---- buffers double Ext1[]; double Ext2[]; int center=0; //+======================================================================================+ //+================================ www.expforex.com edit AlertArrow ====================+ //+======================================================================================+ extern string Alerts="Алерты и стрелки от www.expforex.com"; extern bool AlerT=true; // Выдавать алерт на экран extern bool Mail=true; // Посылать сообщение extern bool Push=true; // Посылать ПУШ на телефон extern bool Arrow=true; // Ставить стрелки на сигналах extern int shift=1; // На каком баре считать сигнал 0 - на текущем 1 - на закрытом int timeee; // Внутренняя переменная string nameInd; void SetArrow(int cd, color cl, string nm="", datetime t1=0, double p1=0, int sz=3) { if (nm=="") nm=DoubleToStr(Time[0], 0); if (t1<=0) t1=Time[0]; if (p1<=0) p1=Bid; nameInd=WindowExpertName( ); int wind=WindowFind(nameInd); if (wind==-1)wind=0; if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_ARROW, wind, 0,0); ObjectSet(nm, OBJPROP_TIME1 , t1); ObjectSet(nm, OBJPROP_PRICE1 , p1); ObjectSet(nm, OBJPROP_ARROWCODE, cd); ObjectSet(nm, OBJPROP_COLOR , cl); ObjectSet(nm, OBJPROP_WIDTH , sz); } void Expforex_AlertArrow(string text="",int arrowdir=0) { nameInd=WindowExpertName( ); int wind=WindowFind(nameInd); if (wind==-1)wind=0; ObjectCreate("Originalalert",OBJ_LABEL,wind,0,0); ObjectSetText("Originalalert","Модификация AlertArrow www.expforex.com",10,"Arial Bold",Red); ObjectSet("Originalalert",OBJPROP_CORNER,2); ObjectSet("Originalalert",OBJPROP_XDISTANCE,200); ObjectSet("Originalalert",OBJPROP_YDISTANCE,10); if(AlerT) Alert(text); if(Arrow) if (arrowdir==1) SetArrow(241,Blue,nameInd+DoubleToStr(Time[shift],0),Time[shift],Low[shift]); if(Arrow) if (arrowdir==2) SetArrow(242,Red,nameInd+DoubleToStr(Time[shift],0),Time[shift],High[shift]); if (!IsTesting())if(Mail) SendMail(text, text); if (!IsTesting())if(Push) SendNotification(text); } //+======================================================================================+ //+================================ www.expforex.com edit AlertArrow ====================+ //+======================================================================================+ //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators if(range_fractal % 2 == 0) range_fractal++; if(range_fractal<3) range_fractal=3; center=range_fractal/2 + 1 ; //scenter=range_fractal/2; SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,217); SetIndexBuffer(0,Ext1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,218); SetIndexBuffer(1,Ext2); SetIndexEmptyValue(1,0.0); SetIndexLabel(0,"Fractal Up"); SetIndexLabel(1,"Fractal Down"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ double cur=0; bool found=false; int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit-=1+range_fractal; //---- for(int i=limit;i>=0;i--) { //*******create history****** //*******fractal up********** found=false; cur=High[i+center]; if(cur>High[i+1] && cur>High[i+range_fractal]) found=true; else found=false; if(found) { for(int j=1;j