Скачать MetaTrader 5

MQL II to MQL IV

Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
Есть возможность протестировать программу перед покупкой. Узнай как!
Forex Trader
114257
Forex Trader 2005.10.27 12:24 
Переведите, пожалуйста, этот индикатор!
/*[[
	Name := CCM
	Author := Keny, coding for MT - GOODMAN
	Link := info@goodman.ru
	Separate Window := No
	First Color := Red
	First Draw Type := Histogram
	First Symbol := 217
	Use Second Data := Yes
	Second Color := Blue 
	Second Draw Type := Histogram
	Second Symbol := 218
]]*/
//Èíäèêàòîð ñâå÷íàÿ ìîäåëü
Inputs:StdUp(0.5),StdDown(-0.5),len(9),n(9),dK(1),CountBars(500);
Variables : shift(0),firstTime(True),AccountedBars(0),value1(0),value2(0),val1(0),val2(0),cnt(0);
Variables: b1(0),b2(0),u1(0),u2(0),l1(0),l2(0),code(0),i(0),V0(0),V1(0),V2(0),V3(0),MyBars(0);
Variables: xOC(0),xHMOC(0),xMOCL(0),len1(0);
Arrays: code1[61](0),OC[61](0),HMOC[61](0),MOCL[61](0),MAxOC[61](0),MAxHMOC[61](0),MAxMOCL[61](0);
//&#207;&#224;&#240;&#224;&#236;&#229;&#242;&#240; dK-&#243;&#225;&#232;&#240;&#224;&#229;&#242; &#225;&#224;&#240;&#251; &#241; &#228;&#226;&#232;&#230;&#229;&#237;&#232;&#229;&#236; &#241;&#240;&#229;&#228;&#237;&#229;&#233; < dK
SetLoopCount(0);
If firstTime then
 {//&#239;&#229;&#240;&#226;&#238;&#237;&#224;&#247;&#224;&#235;&#252;&#237;&#251;&#229; &#237;&#224;&#241;&#242;&#240;&#238;&#233;&#234;&#232;
   len1=len;
   If len1>60 Then len1=60;
   AccountedBars = CountBars;
   firstTime=False;
   MyBars=Bars-AccountedBars-1;
 };
For  shift = AccountedBars DownTo 0 Begin

If MyBars<Bars  Then
	{
	For i=len1-1 DownTo 1
		Begin //&#239;&#229;&#240;&#229;&#239;&#232;&#241;&#251;&#226;&#224;&#229;&#236; &#236;&#224;&#241;&#241;&#232;&#226;&#251; - &#228;&#235;&#255; &#225;&#238;&#235;&#235;&#232;&#237;&#228;&#230;&#229;&#240;&#224;
			OC[i]=OC[i-1];
			HMOC[i]=HMOC[i-1];
			MOCL[i]=MOCL[i-1];
			MAxOC[i]=MAxOC[i-1];
			MAxHMOC[i]=MAxHMOC[i-1];
			MAxMOCL[i]=MAxMOCL[i-1];
		End;
	For i=38 DownTo 1
		Begin
			code1[i]=code1[i-1];
		End;
	value1=value2;	
	MyBars=MyBars+1;
	};


OC[0]=Abs(O[shift]-C[shift]);  
HMOC[0]=H-Max(O[shift],C[shift]);
MOCL[0]=Min(O[shift],C[shift])-L[shift];
MAxOC[0]=MAxOC[1]-OC[len1-1]+OC[0];
MAxHMOC[0]=MAxHMOC[1]-HMOC[len-1]+HMOC[0];
MAxMOCL[0]=MAxMOCL[1]-MOCL[len1-1]+MOCL[0];

xOC=MAxOC[0]/len1;
xHMOC=MAxHMOC[0]/len1;
xMOCL=MAxMOCL[0]/len1;
V1=0;
V2=0;
V3=0;
For i=0 To len1-1
	Begin
		V0=OC[i]-xOC;
		V0=V0*V0;
		V1=V1+V0;
		V0=HMOC[i]-xHMOC;
		V0=V0*V0;
		V2=V2+V0;
		V0=MOCL[i]-xMOCL;
		V0=V0*V0;
		V3=V3+V0;
	End;
V1=V1/len1;
V1=Sqrt(V1);
V2=V2/len1;
V2=Sqrt(V2);
V3=V3/len1;
V3=Sqrt(V3);
b1=xOC+StdDown*V1; //b1,b2-BB &#228;&#235;&#255; &#242;&#229;&#235;
b2=xOC+StdUp*V1;
u1=xHMOC+StdDown*V2;//u1,u2-BB &#228;&#235;&#255; &#226;&#229;&#240;&#245;&#237;&#229;&#233; &#242;&#229;&#237;&#232;
u2=xHMOC+StdUp*V2;
l1=xMOCL+StdDown*V3;//l1,l2-BB &#228;&#235;&#255; &#237;&#232;&#230;&#237;&#229;&#233; &#242;&#229;&#237;&#232;
l2=xMOCL+StdUp*V3;
code1[0]=0;
for i=0 to n-1 //&#234;&#238;&#228;&#232;&#240;&#243;&#229;&#236; &#241;&#226;&#229;&#247;&#243;
begin
code=0;
if O[shift+i]>C[shift] then code=0;
if O[shift+i]<C[shift] then code=64;
if C[shift]=O[shift+i] then
 begin
  if H[Highest(MODE_HIGH,shift,i)]-max(C[shift],O[shift+i])>=min(C[shift],O[shift+i])-L[Lowest(MODE_LOW,shift,i)] then code=64;
  if H[Highest(MODE_HIGH,shift,i)]-max(C[shift],O[shift+i])<min(C[shift],O[shift+i])-L[Lowest(MODE_LOW,shift,i)] then code=0;
 end;
if code>=64 then
begin
if O[shift+i]=C[shift] then code=code;
if (abs(O[shift+i]-C[shift+i])<b1) and (abs(O[shift+i]-C[shift])>0)  then code=code+16;
if (abs(O[shift+i]-C[shift])>=b1) and ((abs(O[shift+i]-C[shift])<b2)) then code=code+32;
if abs(O[shift+i]-C[shift])>=b2 then code=code+48;
end;

if code<64 then
begin
if O[shift+i]=C[shift] then code=code+48;
if (abs(O[shift+i]-C[shift])<b1) and (abs(O[shift+i]-C[shift])>0) then code=code+32;
if (abs(O[shift+i]-C[shift])>=b1) and ((abs(O[shift+i]-C[shift+i])<b2)) then code=code+16;
if abs(O[shift+i]-C[shift])>=b2 then code=code;
end;

if ((H[Highest(MODE_HIGH,shift,i)]-max(O[shift+i],C[shift]))<u1) and ((H[Highest(MODE_HIGH,shift,i)]-max(O[shift+i],C[shift]))>0) then code=code+4;
if ((H[Highest(MODE_HIGH,shift,i)]-max(O[shift+i],C[shift]))>=u1) and ((H[Highest(MODE_HIGH,shift,i)]-max(O[shift+i],C[shift]))<u2) then code=code+8;
if ((H[Highest(MODE_HIGH,shift,i)]-max(O[shift+i],C[shift]))>=u2) then code=code+12;

if ((min(O[shift+i],C[shift])-L[Lowest(MODE_LOW,shift,i)])=0) then code=code+3;
if ((min(O[shift+i],C[shift])-L[Lowest(MODE_LOW,shift,i)])<l1) and ((min(O[shift+i],C[shift])-L[Lowest(MODE_LOW,shift,i)])>0) then code=code+2;
if ((min(O[shift+i],C[shift])-L[Lowest(MODE_LOW,shift,i)])>=l1) and ((min(O[shift+i],C[shift])-L[Lowest(MODE_LOW,shift,i)])<l2) then code=code+1;

code1[0]=code1[0]+code-63;
end;
code1[0]=code1[0]/n;
code1[0]=code1[1]+2*(code1[0]-code1[1])/(n+1);

cnt=cnt+1;
If cnt>39 Then //&#241;&#227;&#235;&#224;&#230;&#232;&#226;&#224;&#229;&#236; &#241; &#239;&#238;&#236;&#238;&#249;&#252;&#254; FATL &#238;&#242; Finvare
{
value2 = 
0.4360409450*code1[0]
+0.3658689069*code1[1]
+0.2460452079*code1[2]
+0.1104506886*code1[3]
-0.0054034585*code1[4]
-0.0760367731*code1[5]
-0.0933058722*code1[6]
-0.0670110374*code1[7]
-0.0190795053*code1[8]
+0.0259609206*code1[9]
+0.0502044896*code1[10]
+0.0477818607*code1[11]
+0.0249252327*code1[12]
-0.0047706151*code1[13]
-0.0272432537*code1[14]
-0.0338917071*code1[15]
-0.0244141482*code1[16]
-0.0055774838*code1[17]
+0.0128149838*code1[18]
+0.0226522218*code1[19]
+0.0208778257*code1[20]
+0.0100299086*code1[21]
-0.0036771622*code1[22]
-0.0136744850*code1[23]
-0.0160483392*code1[24]
-0.0108597376*code1[25]
-0.0016060704*code1[26]
+0.0069480557*code1[27]
+0.0110573605*code1[28]
+0.0095711419*code1[29]
+0.0040444064*code1[30]
-0.0023824623*code1[31]
-0.0067093714*code1[32]
-0.0072003400*code1[33]
-0.0047717710*code1[34]
+0.0005541115*code1[35]
+0.0007860160*code1[36]
+0.0130129076*code1[37]
+0.0040364019*code1[38];
};
	val1=0;
	val2=0;
	If (value2-value1)<-dK Then //&#229;&#241;&#235;&#232; &#246;&#229;&#237;&#224; &#237;&#232;&#230;&#229; - &#225;&#224;&#240; &#225;&#243;&#228;&#229;&#242; &#234;&#240;&#224;&#241;&#237;&#251;&#233;
		{val1=High[shift];
		val2=Low[shift];
		};
	If (value2-value1)>dK Then //&#229;&#241;&#235;&#232; &#246;&#229;&#237;&#224; &#226;&#251;&#248;&#229; - &#225;&#224;&#240; &#225;&#243;&#228;&#229;&#242; &#241;&#232;&#237;&#232;&#233;
		{val2=High[shift];
		val1=Low[shift];
		};

SetIndexValue(shift,val1); 
SetIndexValue2(shift,val2); 

	If shift>0 then AccountedBars=AccountedBars-1;
End;
Forex Trader
114257
Forex Trader 2005.10.27 13:15  
Дайте, пожалуйста, денег! =))))))))))))))))))))))
Forex Trader
114257
Forex Trader 2005.11.02 16:49  
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий