//+------------------------------------------------------------------+ //| Candle Signal.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Bryant" #property link "youngwarm@live.cn" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_width1 3 #property indicator_width2 3 //---- input parameters extern double FastMA=12; extern double SlowMA=26; extern double SMA =9; extern int MacdPrevious=5; extern bool alerton= false; //---- buffers double Up[]; double Down[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(2); //---- indicator buffers SetIndexBuffer(0,Up); SetIndexBuffer(1,Down); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,67); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,68); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); SetIndexLabel(0,"Up"); SetIndexLabel(1,"Down"); //---- name for DataWindow and indicator subwindow label IndicatorShortName("Candle Signal"); return(0); } int start() { int limit = Bars- IndicatorCounted(),i; double body,length,macd; for ( i=limit ; i>=0; i--) { body=MathAbs(Close[i]-Open[i]); length=(High[i]-Low[i])/2; macd=iMACD(NULL,0,FastMA,SlowMA,SMA,0,0,i+MacdPrevious); Up[i]=EMPTY_VALUE; Down[i]=EMPTY_VALUE; if( body<=length&&macd>0&&High[i]>High[i+1]&&Low[i]>Low[i+1])Up[i]=Low[i]; if( body<=length&&macd<0&&High[i]<High[i+1]&&Low[i]<Low[i+1])Down[i]=High[i]; } for(i=limit; i>=1; i--) { if(Up[i]==Low[i]&&alerton==true) { Alert("Buy Signal Showed Up Last Bar!!!"); break; } if(Down[i]==High[i]&&alerton==true) { Alert("Sell Signal Showed Up Last Bar!!!"); break; } } } return(0);
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Series array that contains open prices 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_ARROW
Indicators Used:
MACD Histogram
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen