//+------------------------------------------------------------------+ //| | //| Rodrigo Munhoz | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "*" #property link "*" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Red //---- input parameters extern double Factor=2;// extern int smPeriod=20;// extern int smMethod=1;// 0 - SMA, 1 - EMA, 2 - SMMA, 3 - LWMA //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators IndicatorBuffers(6); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexBuffer(2,ExtMapBuffer3); SetIndexBuffer(3,ExtMapBuffer4); SetIndexBuffer(4,ExtMapBuffer5); SetIndexBuffer(5,ExtMapBuffer6); SetIndexDrawBegin(0,smPeriod); SetIndexDrawBegin(1,smPeriod); SetIndexDrawBegin(2,smPeriod); SetIndexLabel(0,"AB Upper"); SetIndexLabel(1,"AB Lower"); SetIndexLabel(2,"AB Central"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit=Bars-IndicatorCounted(); for(int i=limit-1;i>=0;i--) { ExtMapBuffer4[i]=High[i]*(1+Factor*(High[i]-Low[i])/((High[i]+Low[i])/2)); ExtMapBuffer5[i]=Low[i]*(1-Factor*(High[i]-Low[i])/((High[i]+Low[i])/2)); ExtMapBuffer6[i]=(ExtMapBuffer4[i]+ExtMapBuffer5[i])/2; ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer4,0,smPeriod,0,smMethod,i); ExtMapBuffer3[i]=iMAOnArray(ExtMapBuffer5,0,smPeriod,0,smMethod,i); } for(i=limit-1;i>=0;i--) { if(High[i]>ExtMapBuffer2[i]) { ExtMapBuffer1[i]=1; } if(Low[i]