#property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Green input string orario1 = "2015.03.16 0:00"; //extern int year=2014; //extern int month=07; //extern int day=07; //extern int hour=8; //extern int minute=00; input double sup=1.13815; input double inf=1.11265; input double cyclelength=192; input double trend=0; //---- buffers double Hurst[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { year = TimeYear(StrToTime(orario1)); month= TimeMonth(StrToTime(orario1)); day= TimeDay(StrToTime(orario1)); hour= TimeHour(StrToTime(orario1)); minute=TimeMinute(StrToTime(orario1)); //---- indicators IndicatorBuffers(1); SetIndexBuffer(0,Hurst); SetIndexStyle(0,DRAW_LINE,0,1); SetIndexShift(0,cyclelength); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)); IndicatorShortName(WindowExpertName()); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double a,w1,w2,w3,w4,cycle,x,grc,c,b,pi; int i,phase; int flag, m=0; int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); //limit=Bars-counted_bars; if (Bars!=counted_bars+1) { for( i=Bars; i>=0-cyclelength; i--) { m=i+cyclelength; if (day==TimeDay(Time[i]) && month==TimeMonth(Time[i]) && year==TimeYear(Time[i])&& hour==TimeHour(Time[i]) && minute==TimeMinute(Time[i])) { flag=1; } if( flag==0) { Hurst[m]=EMPTY_VALUE; } else { a=a+1; x=(360/cyclelength)*a; phase=-90; pi=3.1415926535; w1=MathSin(((12*x+phase)*pi)/180); w2=2*MathSin(((6*x+phase)*pi)/180); w3=3*MathSin(((3*x+phase)*pi)/180); w4=4*MathSin(((x+phase)*pi)/180); cycle=(w1+w2+w3+w4); grc=0.01029; c=(grc*trend*1); b=b+c; Hurst[m]=(cycle+b+10)*((sup-inf)/15)+inf; } } } return(0); }