//+------------------------------------------------------------------+ //| MagicOscillator.mq4 | //+------------------------------------------------------------------+ #property copyright "©ZFS" #property link "vasbsm@mail.ru" //---- indicator settings #property indicator_separate_window #property indicator_buffers 4 #property indicator_color3 clrBlue #property indicator_color4 clrRed #property indicator_width3 5 #property indicator_width4 5 //---- indicator buffers double AOBuffer[]; double TempBuffer[]; double OscBuyBuffer[]; double OscSellBuffer[]; int init() { SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_NONE); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexStyle(3,DRAW_HISTOGRAM); IndicatorDigits(Digits+1); SetIndexDrawBegin(0,34); SetIndexDrawBegin(1,34); SetIndexDrawBegin(2,34); SetIndexDrawBegin(3,34); SetIndexBuffer(0,AOBuffer); SetIndexBuffer(1,TempBuffer); SetIndexBuffer(2,OscBuyBuffer); SetIndexBuffer(3,OscSellBuffer); IndicatorShortName("MAGICOSCILLATOR©ZFS"); SetIndexLabel(2,NULL); SetIndexLabel(3,NULL); return(0); } int start() { int limit; int counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i(high1+low1)/2.0)deltab=close0-high1; if (close1<(high1+low1)/2.0)deltas=low1-close0; if (close2>(high2+low2)/2.0)deltab2=close1-high2; if (close2<(high2+low2)/2.0)deltas2=low2-close1; if (ao0>ao1) { if (deltas>0||deltas2>0)TempBuffer[i]=-1; else TempBuffer[i]=1; } if (ao00||deltab2>0)TempBuffer[i]=1; else TempBuffer[i]=-1; } } for(i=0; i0) { OscBuyBuffer[i]=TempBuffer[i]; OscSellBuffer[i]=0; } if (TempBuffer[i]<0) { OscSellBuffer[i]=TempBuffer[i]; OscBuyBuffer[i]=0; } } return(0); }