PDA

View Full Version : 群集平均值不会在图表上更新



ylanqita5
09-27-2015 23:21, 11:21 PM
1附件这是这个指标,它用于工作,现在它不是令人耳目一新的(MT4 Build 840)
https://www.forex-pedia.com/attachments/1528662647.png
也许有些灵魂可以看看它!


Inserted Code/ ------------------------------------------------------------------ /| OtherChart.mq4 |/| Copyright © 2008, MetaQuotes Software Corp. |/| http://www.metaquotes.net |/ ------------------------------------------------------------------ #property copyright jax1000 #property link http://www.onix-trade.net/forum/index.php?showtopic=107view=findpostp=383010 #property indior_chart_window #property indior_buffers 8 #property indior_color1 MediumBlue #property indior_color2 LimeGreen #property indior_color3 Crimson #property indior_color4 SaddleBrown #property indior_color5 Yellow #property indior_color6 DeepPink #property indior_color7 BlueViolet #property indior_color8 Turquoise extern bool all_idx_mode=true;//#1056;#1077;#1078;#1080;#1084; #1087;#1086;#1079;#1074;#1086;#1083;#1103;#1077;#1090; #1074;#1099;#1073;#1088;#1072;#1090;#1100;-#1086;#1090;#1086;#1073;#1088;#1072;#1078;#1072;#1090;#1100; #1076;#1074;#1080;#1078;#1077;#1085;#1080;#1077; #1074;#1089;#1077;#1093; #1074;#1086;#1089;#1100;#1084;#1080; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074; #1082;#1083;#1072;#1089;#1090;#1077;#1088;#1072; (#1087;#1086;#1083;#1086;#1078;#1077;#1085;#1080;#1077; true) #1080;#1083;#1080; #1086;#1090;#1086;#1073;#1088;#1072;#1078;#1072;#1090;#1100; #1090;#1086;#1083;#1100;#1082;#1086; #1076;#1074;#1072; #1073;#1091;#1092;#1077;#1088;#1072;-#1089; #1080;#1085;#1076;#1077;#1082;#1089;#1072;#1084;#1080; #1090;#1086;#1083;#1100;#1082;#1086; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; #1080; #1074;#1072;#1083;#1102;#1090;#1099; #1082;#1086;#1090;#1080;#1088;#1086;#1074;#1082;#1080; (#1087;#1086;#1083;#1086;#1078;#1077;#1085;#1080;#1077; false). extern int period=8;//#1087;#1077;#1088;#1080;#1086;#1076; #1089;#1088;#1077;#1076;#1085;#1077;#1081; #1087;#1086; #1087;#1072;#1088;#1077; extern int period1=8;//#1087;#1077;#1088;#1080;#1086;#1076; #1073;#1099;#1089;#1090;#1088;#1086;#1081; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1077;#1081; #1087;#1086; #1080;#1085;#1076;#1077;#1082;#1089;#1091; extern int period2=24;//#1087;#1077;#1088;#1080;#1086;#1076; #1084;#1077;#1076;#1083;#1077;#1085;#1085;#1086;#1081; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1077;#1081; #1087;#1086; #1080;#1085;#1076;#1077;#1082;#1089;#1091; extern int MA_Method=0;//#1084;#1077;#1090;#1086;#1076; #1089;#1075;#1083;#1072;#1078;#1080;#1074;#1072;#1085;#1080;#1103; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1080;#1093; #1087;#1086; #1087;#1072;#1088;#1077; #1080; #1080;#1085;#1076;#1077;#1082;#1089;#1072;#1084;. #1055;#1086; #1091;#1084;#1086;#1083;#1095;#1072;#1085;#1080;#1102;-#1087;#1088;#1086;#1089;#1090;#1086;#1077; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1077;#1077; #1089;#1088;#1077;#1076;#1085;#1077;#1077;. extern int Price=0;//#1094;#1077;#1085;#1072; #1076;#1083;#1103; #1088;#1072;#1089;#1095;#1077;#1090;#1072; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1080;#1093; #1087;#1086; #1087;#1072;#1088;#1077; #1080; #1080;#1085;#1076;#1077;#1082;#1089;#1072;#1084;. #1055;#1086; #1091;#1084;#1086;#1083;#1095;#1072;#1085;#1080;#1102;-#1094;#1077;#1085;#1072; #1079;#1072;#1082;#1088;#1099;#1090;#1080;#1103;. extern int shift=0;//#1089;#1076;#1074;#1080;#1075; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1080;#1093; #1087;#1086; #1087;#1072;#1088;#1077; #1080; #1080;#1085;#1076;#1077;#1082;#1089;#1072;#1084;. extern int width=3; / ------------------------------------------------------------------ /| Custom indior initialization function |/ ------------------------------------------------------------------ double Buffer1#91;#93;,Buffer2#91;#93;,Buffer3#91;#93;,Buffer4#91;#93;,Buffer5#91;#93;,Buffer6#91;#93;,Buffer7#91;#93;,Buffer8#91;#93;; / ------------------------------------------------------------------ /| expert initialization function |/ ------------------------------------------------------------------ int init() { /#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1080; #1082;#1086;#1090;#1080;#1088;#1091;#1077;#1084;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099;, #1089;#1086;#1089;#1090;#1072;#1074;#1083;#1103;#1102;#1097;#1080;#1093; #1074;#1072;#1083;#1102;#1090;#1085;#1091;#1102; #1087;#1072;#1088;#1091;. string s=Symbol(); string k=StringSubstr(Symbol(), 3, 3);//#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; string b=StringSubstr(Symbol(), 0, 3);//#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1082;#1086;#1090;#1080;#1088;#1091;#1077;#1084;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; string buffer1_name; string buffer2_name; if(all_idx_mode==false){buffer1_name=b;buffer2_name=k;}else{buffer1_name=EUR;buffer2_name=USD;} /#1072;#1074;#1090;#1086;#1084;#1072;#1090;#1080;#1095;#1077;#1089;#1082;#1086;#1077; #1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1094;#1074;#1077;#1090;#1072; #1087;#1088;#1080; #1086;#1090;#1082;#1083;#1102;#1095;#1077;#1085;#1080;#1080; all_idx_mode color color1; color color2; if(all_idx_mode==false) {if(b==EUR) {color1=MediumBlue;}else if(b==USD) {color1=LimeGreen;}else if(b==GBP) {color1=Crimson;}else if(b==CHF) {color1=SaddleBrown;}else if(b==CAD) {color1=DeepPink;}else if(b==AUD) {color1=BlueViolet;}else if(b==NZD) {color1=Turquoise;} if(k==JPY) {color2=Yellow;}else if(k==USD) {color2=LimeGreen;}else if(k==GBP) {color2=Crimson;}else if(k==CHF) {color2=SaddleBrown;}else if(k==CAD) {color2=DeepPink;}else if(k==AUD) {color2=BlueViolet;}else if(k==NZD) {color2=Turquoise;} }else {color1=MediumBlue; color2=LimeGreen; } IndiorDigits(Digits); SetIndexStyle(0,DRAW_LINE,0,width,color1); SetIndexBuffer(0,Buffer1); SetIndexStyle(1,DRAW_LINE,0,width,color2); SetIndexBuffer(1,Buffer2); SetIndexStyle(2,DRAW_LINE,0,width); SetIndexBuffer(2,Buffer3); SetIndexStyle(3,DRAW_LINE,0,width); SetIndexBuffer(3,Buffer4); SetIndexStyle(4,DRAW_LINE,0,width); SetIndexBuffer(4,Buffer5); SetIndexStyle(5,DRAW_LINE,0,width); SetIndexBuffer(5,Buffer6); SetIndexStyle(6,DRAW_LINE,0,width); SetIndexBuffer(6,Buffer7); SetIndexStyle(7,DRAW_LINE,0,width); SetIndexBuffer(7,Buffer8); SetIndexLabel(0,buffer1_name); SetIndexLabel(1,buffer2_name); SetIndexLabel(2,GBP); SetIndexLabel(3,CHF); SetIndexLabel(4,JPY); SetIndexLabel(5,CAD); SetIndexLabel(6,AUD); SetIndexLabel(7,NZD); /---- return(0); }/ ------------------------------------------------------------------ /| Custom indior deinitialization function |/ ------------------------------------------------------------------ int deinit() {/---- /---- return(0); }/ ------------------------------------------------------------------ /| Custom indior iteration function |/ ------------------------------------------------------------------ int start() { int i; int limit; int counted_bars=IndiorCounted(); if(counted_barsgt;0) counted_bars--; limit=Bars-counted_bars; for(i=0; ilt;limit; i ) { datetime BarTime = Time#91;i#93;; /#1089;#1080;#1085;#1093;#1088;#1086;#1085;#1080;#1079;#1072;#1094;#1080;#1103; #1088;#1072;#1089;#1095;#1077;#1090;#1086;#1074; #1087;#1086; #1074;#1088;#1077;#1084;#1077;#1085;#1080; int shiftEUR = iBarShift(EURUSD, 0, BarTime); int shiftGBP = iBarShift(GBPUSD, 0, BarTime); int shiftCHF = iBarShift(USDCHF, 0, BarTime); int shiftJPY = iBarShift(USDJPY, 0, BarTime); int shiftCAD = iBarShift(USDCAD, 0, BarTime); int shiftAUD = iBarShift(AUDUSD, 0, BarTime); int shiftNZD = iBarShift(NZDUSD, 0, BarTime); /#1088;#1072;#1089;#1095;#1077;#1090; #1089;#1088;#1077;#1076;#1085;#1077;#1081; #1086;#1090; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074; #1089; #1084;#1077;#1085;#1100;#1096;#1080;#1084; #1087;#1077;#1088;#1080;#1086;#1076;#1086;#1084;. double usd1=MathPow(Ma(USDCHF,0,period1,shift,MA_Method,Price,shiftCHF)*Ma(USDJPY,0,period1,shift,MA_Method,Price,shiftJPY)*Ma(USDCAD,0,period1,shift,MA_Method,Price,shiftCAD)/Ma(EURUSD,0,period1,shift,MA_Method,Price,shiftEUR)/Ma(GBPUSD,0,period1,shift,MA_Method,Price,shiftGBP)/Ma(AUDUSD,0,period1,shift,MA_Method,Price,shiftAUD)/Ma(NZDUSD,0,period1,shift,MA_Method,Price,shiftNZD),1./8.); double eur1=Ma(EURUSD,0,period1,shift,MA_Method,Price,shiftEUR)*usd1; double gbp1=Ma(GBPUSD,0,period1,shift,MA_Method,Price,shiftGBP)*usd1; double chf1=usd1/Ma(USDCHF,0,period1,shift,MA_Method,Price,shiftCHF); double idxjpy1=(Ma(USDJPY,0,period1,shift,MA_Method,Price,shiftJPY))/usd1; double cad1=usd1/Ma(USDCAD,0,period1,shift,MA_Method,Price,shiftCAD); double aud1=Ma(AUDUSD,0,period1,shift,MA_Method,Price,shiftAUD)*usd1; double nzd1=Ma(NZDUSD,0,period1,shift,MA_Method,Price,shiftNZD)*usd1; /#1088;#1072;#1089;#1095;#1077;#1090; #1089;#1088;#1077;#1076;#1085;#1077;#1081; #1086;#1090; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074; #1089; #1073;#1086;#1083;#1100;#1096;#1080;#1084; #1087;#1077;#1088;#1080;#1086;#1076;#1086;#1084;. double usd2=MathPow(Ma(USDCHF,0,period2,shift,MA_Method,Price,shiftCHF)*Ma(USDJPY,0,period2,shift,MA_Method,Price,shiftJPY)*Ma(USDCAD,0,period2,shift,MA_Method,Price,shiftCAD)/Ma(EURUSD,0,period2,shift,MA_Method,Price,shiftEUR)/Ma(GBPUSD,0,period2,shift,MA_Method,Price,shiftGBP)/Ma(AUDUSD,0,period2,shift,MA_Method,Price,shiftAUD)/Ma(NZDUSD,0,period2,shift,MA_Method,Price,shiftNZD),1./8.); double eur2=Ma(EURUSD,0,period2,shift,MA_Method,Price,shiftEUR)*usd2; double gbp2=Ma(GBPUSD,0,period2,shift,MA_Method,Price,shiftGBP)*usd2; double chf2=usd2/Ma(USDCHF,0,period2,shift,MA_Method,Price,shiftCHF); double idxjpy2=(Ma(USDJPY,0,period2,shift,MA_Method,Price,shiftJPY))/usd2; double cad2=usd2/Ma(USDCAD,0,period2,shift,MA_Method,Price,shiftCAD); double aud2=Ma(AUDUSD,0,period2,shift,MA_Method,Price,shiftAUD)*usd2; double nzd2=Ma(NZDUSD,0,period2,shift,MA_Method,Price,shiftNZD)*usd2; /#1088;#1072;#1089;#1095;#1077;#1090; #1086;#1090;#1082;#1083;#1086;#1085;#1077;#1085;#1080;#1103; #1073;#1099;#1089;#1090;#1088;#1086;#1081; #1089;#1088;#1077;#1076;#1085;#1077;#1081; #1086;#1090; #1084;#1077;#1076;#1083;#1077;#1085;#1085;#1086;#1081;, #1087;#1086; #1082;#1072;#1078;#1076;#1086;#1084;#1091; #1080;#1079; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074;. (#1042;#1099;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1079;#1072;#1076;#1072;#1085;#1085;#1086;#1081; #1095;#1072;#1089;#1090;#1086;#1090;#1099;) double usdp=usd1-usd2; double eurp=eur1-eur2; double gbpp=gbp1-gbp2; double chfp=chf1-chf2; double idxjpyp=idxjpy1-idxjpy2; double cadp=cad1-cad2; double audp=aud1-aud2; double nzdp=nzd1-nzd2; string s=Symbol(); string k=StringSubstr(Symbol(), 3, 3);//#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1082;#1086;#1090;#1080;#1088;#1091;#1077;#1084;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; string b=StringSubstr(Symbol(), 0, 3);//#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; /#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074;, #1082;#1086;#1090;#1086;#1088;#1099;#1077; #1092;#1086;#1088;#1084;#1080;#1088;#1091;#1102;#1090; #1074;#1072;#1083;#1102;#1090;#1085;#1091;#1102; #1087;#1072;#1088;#1091; #1080; #1087;#1088;#1080;#1089;#1074;#1086;#1077;#1085;#1080;#1077; #1087;#1077;#1088;#1077;#1084;#1077;#1085;#1085;#1099;#1084; #1079;#1085;#1072;#1095;#1077;#1085;#1080;#1081; #1074;#1099;#1076;#1077;#1083;#1077;#1085;#1085;#1099;#1093; #1095;#1072;#1089;#1090;#1086;#1090; #1101;#1090;#1080;#1093; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074;. double ch1, ch2; if(b==USD){ch1=usdp;} if(b==EUR){ch1=eurp;} if(k==USD){ch2=usdp;} if(b==GBP){ch1=gbpp;} if(k==GBP){ch2=gbpp;} if(b==CHF){ch1=chfp;} if(k==CHF){ch2=chfp;} if(k==JPY){ch2=idxjpyp;} if(b==CAD){ch1=cadp;} if(k==CAD){ch2=cadp;} if(b==NZD){ch1=nzdp;} if(k==AUD){ch2=audp;} if(b==AUD){ch1=audp;} if(k==NZD){ch2=nzdp;} /#1086;#1087;#1088;#1077;#1076;#1077;#1083;#1077;#1085;#1080;#1077; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074;, #1082;#1086;#1090;#1086;#1088;#1099;#1077; #1092;#1086;#1088;#1084;#1080;#1088;#1091;#1102;#1090; #1074;#1072;#1083;#1102;#1090;#1085;#1091;#1102; #1087;#1072;#1088;#1091;; #1088;#1072;#1089;#1095;#1077;#1090; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1077;#1081; #1087;#1086; #1087;#1072;#1088;#1077;, #1089; #1079;#1072;#1076;#1072;#1085;#1085;#1099;#1084; #1087;#1077;#1088;#1080;#1086;#1076;#1086;#1084;; #1089;#1076;#1074;#1080;#1075; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1080;#1093; #1087;#1086; #1087;#1072;#1088;#1077;, #1085;#1072; #1074;#1077;#1083;#1080;#1095;#1080;#1085;#1099; #1095;#1072;#1089;#1090;#1086;#1090; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1080; #1082;#1086;#1090;#1080;#1088;#1091;#1077;#1084;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099;. if(all_idx_mode){//#1086;#1090;#1086;#1073;#1088;#1072;#1078;#1072;#1090;#1100; #1076;#1074;#1080;#1078;#1077;#1085;#1080;#1077; #1074;#1089;#1077;#1093; #1074;#1086;#1089;#1100;#1084;#1080; #1080;#1085;#1076;#1077;#1082;#1089;#1086;#1074; #1082;#1083;#1072;#1089;#1090;#1077;#1088;#1072; if(k==JPY)//#1077;#1089;#1083;#1080; k #1088;#1072;#1074;#1085;#1086; JPY { Buffer1#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) eurp*100; Buffer2#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) usdp*100; Buffer3#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) gbpp*100; Buffer4#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) chfp*100; Buffer5#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i)-idxjpyp; Buffer6#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) cadp*100; Buffer7#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) audp*100; Buffer8#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) nzdp*100; } else { Buffer1#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) eurp; Buffer2#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) usdp; Buffer3#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) gbpp; Buffer4#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) chfp; Buffer5#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i)-idxjpyp/100; Buffer6#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) cadp; Buffer7#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) audp; Buffer8#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) nzdp; } } else /#1086;#1090;#1086;#1073;#1088;#1072;#1078;#1072;#1090;#1100; #1090;#1086;#1083;#1100;#1082;#1086; #1076;#1074;#1072; #1073;#1091;#1092;#1077;#1088;#1072;-#1089; #1080;#1085;#1076;#1077;#1082;#1089;#1072;#1084;#1080; #1090;#1086;#1083;#1100;#1082;#1086; #1073;#1072;#1079;#1086;#1074;#1086;#1081; #1074;#1072;#1083;#1102;#1090;#1099; #1080; #1074;#1072;#1083;#1102;#1090;#1099; #1082;#1086;#1090;#1080;#1088;#1086;#1074;#1082;#1080; {if(k==JPY) { Buffer1#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) ch1*100; Buffer2#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i)-ch2; } else { Buffer1#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) ch1; Buffer2#91;i#93;=Ma(s,0,period,shift,MA_Method,Price,i) ch2; }} }/---- /---- return(0); }/ ------------------------------------------------------------------ /#1092;#1091;#1085;#1082;#1094;#1080;#1103; #1088;#1072;#1089;#1095;#1077;#1090;#1072; #1089;#1082;#1086;#1083;#1100;#1079;#1103;#1097;#1077;#1081; #1089;#1088;#1077;#1076;#1085;#1077;#1081; double Ma(string valuta, int frame, int period, int shift, int MA_Method, int Price, int z) { double res1=0; res1=iMA(valuta,frame,period,shift,MA_Method,Price,z); return(res1); }
https://www.forex-pedia.com/attachments/15286626512020213677.mq4