//+-------------------------------------------------------------------------------------------------+ //| VS_FractalMTF.mq4 | //| Copyright © 2011, Vladimir Sautkin | //| sly_fox@list.ru | //|Построение фракталов со старших ТФ | //+-------------------------------------------------------------------------------------------------+ #property copyright "Copyright © 2010,Vladimir Sautkin" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red extern int TF=0; double Up[], Dn[]; //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ int init() { IndicatorBuffers(2); SetIndexStyle(0,DRAW_ARROW,EMPTY,1); SetIndexArrow(0,167); SetIndexBuffer(0,Up); SetIndexStyle(1,DRAW_ARROW,EMPTY,1); SetIndexArrow(1,167); SetIndexBuffer(1,Dn); SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); if (TF!=1 && TF!=5 && TF!=15 && TF!=30 && TF!=60 && TF!=240 && TF!=1440 && TF!=10080 && TF!=43200) TF=Period(); if (TF ==0 || TF 0) counted_bars--; int Limit = Bars - counted_bars; if(counted_bars==0) Limit-=1+TF/Period()+1; for( i=Limit; i>=0; i-- ) { iTF=iBarShift(NULL,TF,Time[i],false); if (iTF!=iLastTF) { FrUp=iFractals(NULL,TF,MODE_UPPER ,iTF); FrDn=iFractals(NULL,TF,MODE_LOWER ,iTF); if (FrUp>0) Up[i]=FrUp; if (FrDn>0) Dn[i]=FrDn; iLastTF=iTF; } else { Up[i]=Up[i+1]; Dn[i]=Dn[i+1]; } } return(0); } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------