| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Can someone please check this indicator?
Hi,
I put this MACD signal indicator together from various pieces/parts others had already done but it doesn't seem to be working. I get no up/down arrows nor alerts when I load it to a chart. Could someone please take a quick look and let me know what I've done wrong? Thanks! - Ian //+------------------------------------------------------------------+ //| MACD Signal.mq4 | //| Ian Boersma | //| iboersma@gmail.com | //+------------------------------------------------------------------+ #property copyright "Ian Boersma" #property link "iboersma@gmail.com" #property indicator_buffers 2 #property indicator_color1 LimeGreen #property indicator_color2 Red #property indicator_chart_window double MACDUp[]; double MACDDown[]; extern int FastEMA=12; extern int SlowEMA=26; extern int SignalSMA=9; extern int MATrendPeriod=26; extern int MACDOpenLevel=4; extern int MACDCloseLevel=2; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(0,MACDUp); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(0,MACDDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i, counter; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(i = 0; i <= limit; i++) //---- double MacdCurrent = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,PRICE_C LOSE,MODE_MAIN,i); double SignalCurrent = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,PRICE_C LOSE,MODE_SIGNAL,i); double MacdPrevious = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,PRICE_C LOSE,MODE_MAIN,i+1); double SignalPrevious = iMACD(Symbol(),0,FastEMA,SlowEMA,SignalSMA,PRICE_C LOSE,MODE_SIGNAL,i+1); double MaCurrent=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRIC E_CLOSE,i); double MaPrevious=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRI CE_CLOSE,i+1); if(MacdCurrent<0 && MacdCurrent>SignalCurrent && MacdPrevious<SignalPrevious && MathAbs(MacdCurrent)>(MACDOpenLevel*Point) && MaCurrent>MaPrevious) { MACDUp[i] = Close[i]; Alert(Symbol()+" MACD moving UP!"); SendMail(Symbol()+" MACD moving UP!","Better enter a BUY order!"); } else if(MacdCurrent>0 && MacdCurrent<SignalCurrent && MacdPrevious>SignalPrevious && MacdCurrent>(MACDOpenLevel*Point) && MaCurrent<MaPrevious) { MACDDown[i] = Close[i]; Alert(Symbol()+" MACD moving DOWN!"); SendMail(Symbol()+" MACD moving DOWN!","Better enter a SELL order!"); } //---- return(0); } //+-------------- |
|
||||
|
This part of code must have this look:
//---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(0,MACDUp); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,159); SetIndexBuffer(1,MACDDown); //----
__________________
Let's improve trade skills together http://finance.groups.yahoo.com/group/TrendLaboratory |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Check this out!!! | tznef | Non Related Discussions | 15 | 12-17-2007 08:16 AM |
| newdigital check !! | Baba_master | Expert Advisors - Metatrader 4 | 8 | 06-21-2007 04:23 PM |
| How to check for check for currency symbol | tak145 | Expert Advisors - Metatrader 4 | 1 | 05-12-2007 01:16 PM |
| Can someone check if this EA is done correctly please !! | pikachucom | Expert Advisors - Metatrader 4 | 6 | 04-04-2006 10:34 PM |