- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
Oke, sorry I didn't realize I pasted only a part of it. Here it is:
class kakarates
{
public:
double GetShit(string,datetime,int );
kakarates()
{
}
};
double kakarates::GetShit(string symbol,datetime sdate, int bla)
{
string theid,type;
double raetzor=-1;
double wtf=-1;
int poss;
switch (bla)
{
case 1:
type="High";
break;
case 2:
type="Low";
break;
case 3:
type="Open";
break;
}
theid=symbol+TimeToString(sdate)+type;
poss=check(theid);
int amount=0;
double myarray[];
if (poss<0)
{
int count=0;
switch (bla)
{
case 1:
count = CopyHigh(symbol, PERIOD_M1, sdate, TimeCurrent(),myarray);
break;
case 2:
count = CopyLow(symbol, PERIOD_M1, sdate, TimeCurrent() ,myarray);
break;
case 3:
count = CopyOpen(symbol, PERIOD_M1, sdate,1,myarray);
break;
}
if (count>0)
{
raetzor=myarray[0];
switch (bla)
{
case 1:
for (int zzz=0;zzz<count;zzz++)
{
if (raetzor<myarray[zzz])
{
raetzor= myarray[zzz];
}
}
break;
case 2:
// Ok. It doesnt work.
// So as this: raetzor=ArrayMinimum(myarray,WHOLE_ARRAY);
for (int zzz=0;zzz<count;zzz++)
{
if (raetzor>myarray[zzz])
{
raetzor= myarray[zzz];
}
}
break;
case 3:
raetzor= myarray[0];
break;
}
raetzor= myarray[ArrayMaximum(myarray,0,WHOLE_ARRAY)];
add(theid,raetzor);
}
else
{
return 0;
}
}
else
{
raetzor=containzamassiv[poss].value;
switch (bla)
{
case 1:
CopyHigh(symbol, PERIOD_M1, 0, 1,myarray);
if (myarray[0]>raetzor)
{
raetzor=myarray[0];
containzamassiv[poss].value=raetzor;
};
break;
case 2:
CopyLow(symbol, PERIOD_M1, 0, 1,myarray);
if (myarray[0]<raetzor)
{
raetzor=myarray[0];
containzamassiv[poss].value=raetzor;
};
break;
case 3:
//отдыхаем
break;
}
};
return kakarates::raetzor;
};
To the function the time, the symbol and the mode are passed. It should calculate the Maximum and Minimum since the specified date, and also pass the Open price. Then it will store these values and then it will be checking and updating it if necessary.
So, we can see the Copy* commands fill out the array thoughroughtly, and the count is over hunders, but its all being useless.
Thanks.
- www.mql5.com
whoops, Actually I'm retarded! I missed the line after switch when it gets it back to maximum again. Sorry for disturbance...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
if (poss<0)
{
int count=0;
//Alert("Copying");
switch (bla)
{
case 1:
// count = CopyHigh(symbol, PERIOD_M1, sdate, TimeCurrent(),myarray);
break;
case 2:
count = CopyLow(symbol, PERIOD_M1, sdate, TimeCurrent() ,myarray);
break;
case 3:
count = CopyOpen(symbol, PERIOD_M1, sdate,1,myarray);
break;
}
if (count>0)
{
Alert(count);
raetzor=myarray[0];
switch (bla)
{
case 1:
for (int zzz=0;zzz<count;zzz++)
{
if (raetzor<myarray[zzz])
{
raetzor= myarray[zzz];
}
}
break;
case 2:
for (int zzz=0;zzz<count;zzz++)
{
wtf=myarray[zzz];
if (raetzor>wtf)
{
----------------------------------------------------------------
raetzor= myarray[zzz];}
}
Alert(raetzor);
break;
case 3:
raetzor= myarray[0];
break;
}
raetzor= myarray[ArrayMaximum(myarray,0,WHOLE_ARRAY)];
add(theid,raetzor);
}
else
{
return 0;
}
}
else
{
raetzor=containzamassiv[poss].value;
switch (bla)
{
case 1:
CopyHigh(symbol, PERIOD_M1, 0, 1,myarray);
if (myarray[0]>raetzor)
{
raetzor=myarray[0];
containzamassiv[poss].value=raetzor;
};
break;
case 2:
CopyLow(symbol, PERIOD_M1, 0, 1,myarray);
if (myarray[0]<raetzor)
{
raetzor=myarray[0];
containzamassiv[poss].value=raetzor;
};
break;
case 3:
//отдыхаем
break;
}
};
return kakarates::raetzor;
};
IF i compare directly raetzor and myarray[zzz] the IF condition will not execute; The comparison will not work; As well as if use ArrayMimum function, it doesn't work!!
So i was getting lowest value bigger than the opening. Im very disappointed, it took me hours away1! to spot this.