//+------------------------------------------------------------------+ //| Profit (ZigZag).mq4 | //| cashgrade | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "cashgrade" #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Red extern int ReturnPoint=60; extern bool Sound.Alert = true ; //---- buffers double EBuffer1[]; int Trend=1,InTrend,ttime; double Points,Last_High, Last_Low; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; Points = MarketInfo (Symbol(), MODE_POINT); //---- indicator line SetIndexBuffer(0,EBuffer1); SetIndexStyle(0,DRAW_SECTION,EMPTY,4,Red); SetIndexEmptyValue(0,0); //---- name for DataWindow and indicator subwindow label short_name="Reverspoint"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); //---- SetIndexDrawBegin(0,100); //---- return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(),i,shift; //---- TODO: add your code here i=(Bars-counted_bars)-1; for (shift=i; shift>=0;shift--) { if (Time[shift]!=ttime) InTrend=InTrend+1; ttime=Time[shift]; EBuffer1[shift]=0; if (High[shift+1]>Last_High && Trend==1) InTrend=1; if (Low[shift+1]<Last_Low && Trend==0) InTrend=1; if (High[shift+1]>Last_High) Last_High=High[shift+1]; if (Low[shift+1]<Last_Low) Last_Low=Low[shift+1]; if (Trend==1 && Low[shift+1]<Last_High-ReturnPoint*Points && InTrend>1) { Trend=0; EBuffer1[shift+InTrend]=High[shift+InTrend]; Last_High=Low[shift+1]; Last_Low=Low[shift+1]; InTrend=1; } if (Trend==0 && High[shift+1]>Last_Low+ReturnPoint*Points && InTrend>1) { Trend=1; EBuffer1[shift+InTrend]=Low[shift+InTrend]; Last_Low=High[shift+1]; Last_High=High[shift+1]; InTrend=1; } //---- if(Sound.Alert) { if(Trend==1 && Low[shift+1]<Last_High) { if(Sound.Alert) {Alert("Profit (ZigZag) :: Symbol: "+Symbol()+" :: Zeit: "+TimeToStr(Time[0]));} } if(Trend==0 && High[shift+1]>Last_Low) { if(Sound.Alert) {Alert("Profit (ZigZag) :: Symbol: "+Symbol()+" :: Zeit: "+TimeToStr(Time[0]));} } } } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_SECTION
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen