//+------------------------------------------------------------------+ //| Heiken Ashi.mq4 | //| Copyright c 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ //| For Heiken Ashi we recommend next chart settings ( press F8 or | //| select on menu 'Charts'->'Properties...'): | //| - On 'Color' Tab select 'Black' for 'Line Graph' | //| - On 'Common' Tab disable 'Chart on Foreground' checkbox and | //| select 'Line Chart' radiobutton | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Crimson #property indicator_color2 DodgerBlue #property indicator_color3 Crimson #property indicator_color4 DodgerBlue #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 2 #property indicator_width4 2 // // // // // double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; // // // // // int init() { SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(3, ExtMapBuffer4); SetIndexStyle(3,DRAW_HISTOGRAM); return(0); } // // // // // int start() { int counted_bars=IndicatorCounted(); int i,limit; // // // // // if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit = Bars-counted_bars; // // // // // for(int pos=limit; pos >= 0; pos--) { double haClose = (Open[pos]+High[pos]+Low[pos]+Close[pos])/4; double haOpen = (ExtMapBuffer3[pos+1]+ExtMapBuffer4[pos+1])/2; double haHigh = MathMax(High[pos], MathMax(haOpen,haClose)); double haLow = MathMin(Low[pos], MathMin(haOpen,haClose)); if (haOpen