|
|||||||
| 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 |
|
|||
|
Macd Hull
Hello,
I try to programer a MACD HULL to see if it is interessant. I am not strong in programming but I began. Somebody could he(it) help me has to finish him(it)? Thank you #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Aqua #property indicator_color2 Green #property indicator_color3 Green //---- input parameters extern int period=20; extern int method=3; // MODE_SMA extern int price=0; // PRICE_CLOSE extern int period2=30; extern int method2=3; // MODE_SMA extern int price2=0; // PRICE_CLOSE //---- buffers double ExtMapBuffer[]; double ExtMapBuffer2[]; double FL[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(3); SetIndexBuffer(0, ExtMapBuffer); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexBuffer(2, FL); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2); IndicatorShortName("Hull Moving Average("+period+")"); return(0); } double WMA(int x, int p) { return(iMA(NULL, 0, p, 0, method, price, x)); } double WMAd(int xd, int pd) { return(iMA(NULL, 0, pd, 0, method2, price2, xd)); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); int x = 0; int p = MathSqrt(period); int e = Bars - counted_bars + period + 1; double vect[]; if(e > Bars) e = Bars; ArrayResize(vect, e); ArraySetAsSeries(vect, true); for(x = 0; x < e; x++) { vect[x] = 2*WMA(x, period/2) - WMA(x, period); } for(x = 0; x < e-period; x++) { ExtMapBuffer[x] = iMAOnArray(vect, 0, p, 0, method, x); } int xd = 0; int pd = MathSqrt(period2); int ed = Bars - counted_bars + period2 + 1; double vectd[]; if(ed > Bars) ed = Bars; ArrayResize(vectd, ed); ArraySetAsSeries(vectd, true); for(xd = 0; xd < ed; xd++) { vectd[xd] = 2*WMAd(xd, period2/2) - WMAd(xd, period2); } for(xd = 0; xd < ed-period2; xd++) { ExtMapBuffer2[xd] = iMAOnArray(vectd, 0, pd, 0, method2, xd); } int limit; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st buffer for(int i=0; i<limit; i++) { FL[i] = ExtMapBuffer2[i]-ExtMapBuffer[i]/10000; } return(0); } //+------------------------------------------------------------------+ |
![]() |
| Bookmarks |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hull MA | newdigital | Indicators - Metatrader 4 | 63 | 08-05-2008 04:26 PM |
| HULL ma of adx .... | hitman | Indicators - Metatrader 4 | 10 | 06-22-2008 10:12 AM |
| Hull Moving Average | TheWicker | Indicators - Metatrader 4 | 8 | 04-10-2008 02:25 PM |
| Hull Ma Outside E-a | GUSDINSALVOFOREX | Suggestions for Trading Systems | 9 | 03-24-2007 05:00 PM |
| there is still a problem with the Hull MA | iGoR | Indicators - Metatrader 4 | 6 | 09-28-2006 11:18 PM |