//+------------------------------------------------------------------+ //| | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, FX Sniper " #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Lime //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[],ma[]; extern int MAType = 1; extern int MAPeriod = 34; extern int MAShift = 0; extern int PriceType=0; extern bool Turn_ON_Alert =True; extern bool send_mail = False; int signal =0, signalUp =0, signalDown =0; datetime PreviousBar; bool init_variables; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { init_variables = true; //---- 2 additional buffers are used for counting. IndicatorBuffers(5); //---- drawing settings SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ma); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,3); //---- initialization done return(0); } int start() { string Message; for(int i = Bars-10; i >= 0; i--) { ma[i]=iMA(NULL,0,MAPeriod,MAShift,MAType,PriceType,i); } for(int shift = Bars-10; shift >= 0; shift--) { ExtMapBuffer1[shift] = ma[shift]; ExtMapBuffer2[shift] = ma[shift]; //Print (ma[shift]); if (ma[shift] > ma[shift+1]) { ExtMapBuffer1[shift] = EMPTY_VALUE; ExtMapBuffer2[shift+1] = ma[shift+1]; signal =1; } else if (ma[shift] < ma[shift+1]) { ExtMapBuffer2[shift] = EMPTY_VALUE; ExtMapBuffer1[shift+1] = ma[shift+1]; signal =2; } } if(init_variables == true) { PreviousBar = Time[0]; init_variables = false; } if(PreviousBar<Time[0]) { PreviousBar = Time[0]; if(signal ==1 && signalUp !=1) { signalUp = 1; signalDown = 0; Message=" Signal indicate "+Symbol()+" M"+Period()+" going UP"; if(Turn_ON_Alert == True) { Alert (Message); } if(send_mail ==True) { SendMail("[Signal Alert]", "[" + Symbol() +" M"+Period()+" going UP"); } return(0); } if(signal ==2 && signalDown !=1) { signalDown = 1; signalUp = 0; Message=" Signal indicate "+Symbol()+" M"+Period()+" going DOWN"; if(Turn_ON_Alert == True) { Alert (Message); } if(send_mail ==True) { SendMail("[Signal Alert]", "[" + Symbol() +" M"+Period()+" going DOWN"); } return(0); } } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features:
It sends emails