/*-----------------------------+ | | | Shared by www.Aptrafx.com | | | +------------------------------*/ //+------------------------------------------------------------------+ //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Black #property indicator_color2 Lime #property indicator_color3 Red double ExtMapBuffer0[]; double ExtMapBuffer1[]; double ExtMapBuffer2[]; extern int Rperiod = 34; int width; int Draw4HowLong; int shift; int i; int loopbegin; int length; double lengthvar; double tmp ; double sum[]; double wt[]; int c; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(5); SetIndexBuffer(2,ExtMapBuffer0); SetIndexBuffer(1,ExtMapBuffer1); SetIndexBuffer(0,ExtMapBuffer2); SetIndexBuffer(3,sum); SetIndexBuffer(4,wt); // Start line => dot changes /* SetIndexStyle(0,DRAW_ARROW,0,1); SetIndexStyle(1,DRAW_ARROW,0,1); SetIndexStyle(2,DRAW_ARROW,0,1); SetIndexArrow(0,159); SetIndexArrow(1,159); SetIndexArrow(2,159); SetIndexLabel(0,"MAnone"); SetIndexLabel(1,"MAup"); SetIndexLabel(1,"MAdown"); */ // End line => dot changes, Start old code: SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2); // End old code return(0); } int start() { Draw4HowLong = Bars - Rperiod - 5; length = Rperiod; loopbegin = Draw4HowLong - length - 1; for(shift = loopbegin; shift >= 1; shift--) { sum[1] = 0; for(i = length; i >= 1 ; i--) { lengthvar = length + 1; lengthvar /= 3; tmp = 0; tmp = ( i - lengthvar)*Close[length-i+shift]; sum[1]+=tmp; } wt[shift] = sum[1]*6/(length*(length+1)); ExtMapBuffer2[shift] = wt[shift]; //red ExtMapBuffer1[shift] = wt[shift]; //green ExtMapBuffer0[shift] = wt[shift]; //yellow if (wt[shift+1] > wt[shift]) { ExtMapBuffer1[shift+1] = EMPTY_VALUE; } else if (wt[shift+1] < wt[shift]) { ExtMapBuffer0[shift+1] = EMPTY_VALUE; } else { ExtMapBuffer0[shift+1]=CLR_NONE; ExtMapBuffer1[shift+1]=CLR_NONE; } } return(0); }
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Indicator Curves created:
Implements a curve of type DRAW_ARROW
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: