CoeffofLine_true :
//+------------------------------------------------------------------+ //| CoeffofLine_true.mq4 //| Ramdass - Conversion only //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red #property indicator_width1 2 #property indicator_width2 2 extern int ndot = 5; extern int CountBars=300; //---- buffers double Up[]; double Dw[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line IndicatorBuffers(3); SetIndexBuffer(0,Up); SetIndexBuffer(1,Dw); SetIndexStyle(0,DRAW_HISTOGRAM,0,2); SetIndexStyle(1,DRAW_HISTOGRAM,0,2); //---- IndicatorShortName("CoeffofLine_true(" + ndot + ")"); //---- return(0); } //+------------------------------------------------------------------+ //| CoeffofLine_true | //+------------------------------------------------------------------+ int start() { if (CountBars>=Bars) CountBars=Bars; SetIndexDrawBegin(0,Bars-CountBars+ndot+1); SetIndexDrawBegin(1,Bars-CountBars+ndot+1); int i,shift,cnt;//counted_bars=IndicatorCounted(); double TYVar,ZYVar,TIndicatorVar,ZIndicatorVar,M,N,AY,AIndicator,cfl,cfl1; //---- if(Bars<=ndot) return(0); //---- shift=CountBars-ndot-1; while(shift>=0) { cfl1=cfl; TYVar=0; ZYVar=0; N=0; M=0; TIndicatorVar=0; ZIndicatorVar=0; for (cnt=ndot; cnt>=1; cnt--) // n=5 - по пяти точкам { ZYVar=ZYVar+(High[shift+cnt-1]+Low[shift+cnt-1])/2*(ndot-cnt+1); TYVar=TYVar+(High[shift+cnt-1]+Low[shift+cnt-1])/2; N=N+cnt*cnt; //равно 55 M=M+cnt; //равно 15 ZIndicatorVar=ZIndicatorVar+iMA(NULL,0,ndot,3,MODE_SMMA,PRICE_MEDIAN,shift+cnt-1)*(ndot-cnt+1); TIndicatorVar=TIndicatorVar+iMA(NULL,0,ndot,3,MODE_SMMA,PRICE_MEDIAN,shift+cnt-1); } AY=(TYVar+(N-2*ZYVar)*ndot/M)/M; AIndicator=(TIndicatorVar+(N-2*ZIndicatorVar)*ndot/M)/M; if (Symbol()=="EURUSD" || Symbol()=="GBPUSD" || Symbol()=="USDCAD" || Symbol()=="USDCHF" || Symbol()=="EURGBP" || Symbol()=="EURCHF" || Symbol()=="AUDUSD" || Symbol()=="EURAUD" || Symbol()=="GBPCHF" || Symbol()=="NZDUSD") {cfl=(-1000)*MathLog(AY/AIndicator);} else {cfl=(1000)*MathLog(AY/AIndicator);} if (cfl>cfl1) {Up[shift]=cfl; Dw[shift]=0.0;} else {Dw[shift]=cfl; Up[shift]=0.0;} shift--; } return(0); } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
CoeffofLine:
Author: Collector