Inserted Code
#property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ extern int HMA_Period = 21; extern int History = 500; double hma[]; int init() { IndicatorBuffers(1); SetIndexBuffer(0, hma); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(), i = Bars - counted_bars - 1; double temp; if (i > History - 1) i = History - 1; while ( i >= 1 ) { hma[i] = iMA(NULL,0,MathFloor (HMA_Period/2),0,MODE_LWMA,PRICE_CLOSE,i)*2- iMA(NULL,0,HMA_Period,0,MODE_LWMA,PRICE_CLOSE,i); i--; } i = Bars - counted_bars - 1; while ( i >= 1 ) { temp = iMAOnArray(hma,0,MathFloor(MathSqrt (HMA_Period)),0,MODE_LWMA,i); hma[i] = temp; i--; } return(0); } //+------------------------------------------------------------------+
The problem in my hull moving average is that some bars show those peaks like the image shows, and it comes from a problem in the code which I can't find... If I put another hull moving average indicator, it matches my hull moving average except since that bar where the peak happens...
Attached Image