//+------------------------------------------------------------------+ //| Rj_FiboAverage.mq4 | //| Copyright © 2011,RJ Rjabkov Alexander | //| rj-a@mail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011,RJ Rjabkov Alexander" #property link "rj-a@mail.ru" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 CLR_NONE extern int NumDay=2; extern color ClrLevel=Yellow; extern color ClrLevelMain=Red; double MainLine[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(1); SetIndexBuffer(0,MainLine); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { for(int d=0; d<=Bars; d++) { for(int k=0; k<=24; k++) { ObjectDelete(d+"fibo"+k); ObjectDelete(d+"value"+k); } } return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { double Fibo[]={423.6,261.8,176.4,138.2,123.6,100,76.4,61.8,50,38.2,23.6,0,-23.6,-38.2,-50,-61.8,-76.4,-100,-123.6,-138.2,-161.8,-176.4,-261.8,-423.6}; int i,cb,j,cDay; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; cb = Bars - counted_bars; if(counted_bars==0) cb--; double point=0.0001; int cauntarr=ArraySize(Fibo); //------------------ for(i=cb; i>=0; i--) MainLine[i]=iMA(NULL,PERIOD_D1,5,0,1,1,i); if (cb>NumDay) for(cDay=0; cDay<=NumDay; cDay++) { for(j=0; j