اعاني من مشكلة في المؤشر الذي صنعته واحتاج مساعدة الخيراء
لدي اربع موفينجات استعملهم كمستويات فايبوناتشي على المؤشر و ma_peride =1
كود PHP:
for(int i =limit; i>=fstBar; i--)
{
moving78[i]= iMA (NULL,0,ma_priode,0,0,2,i);
moving16[i]= iMA (NULL,0,ma_priode,0,0,2,i);
moving50[i]= iMA (NULL,0,ma_priode,0,0,2,i);
moving103[i]= iMA (NULL,0,ma_priode,0,0,2,i);
الان عندي مؤشر شبيه بالزيجزاج يعطيني قمم وقيعان وهذا هو
كود PHP:
if (LastPicTime==0)
{
FindZigZag(i, 1);
if(Zval[0]==Low[Zbar[0]])
{
LastIsUp=False;
LastUp=Zval[1]; LastDn=Zval[0];
}
else
{
LastIsUp=True;
LastUp=Zval[0]; LastDn=Zval[1];
}
ZZ_Orlova[Zbar[1]]=Zval[1];
ZZ_Orlova[Zbar[0]]=Zval[0];
LastPicTime=Time[Zbar[0]];
}
int LastBar=iBarShift(NULL,0,LastPicTime);
if(ByClose)
{
upPrice=Close[i]; dnPrice=Close[i];
}
else
{
upPrice=High[i]; dnPrice=Low[i];
}
if(LastIsUp)
{
if(upPrice>=LastUp)
{
LastUp=upPrice;
ZZ_Orlova[LastBar]=0.0;
ZZ_Orlova[i]=upPrice;
LastPicTime=Time[i];
third=ZZ_Orlova[i];
thirdcandel=LastBar;
Print("the third is ",third," ",thirdcandel);
} else if((LastUp-dnPrice)/Point>=Points)
{
LastDn=dnPrice;
LastIsUp=False;
ZZ_Orlova[i]=dnPrice;
LastPicTime=Time[i];
five=ZZ_Orlova[i];
fivecandel=i;
second=High[LastBar];
secondcandel=LastBar;
Print("the second is ",second," ",secondcandel);
}
}
else if(!LastIsUp)
{
if(dnPrice<=LastDn)
{
LastDn=dnPrice;
ZZ_Orlova[LastBar]=0.0;
ZZ_Orlova[i]=dnPrice;
LastPicTime=Time[i];
first=ZZ_Orlova[i];
firstcandel=LastBar;
Print("the first is ",first," ",firstcandel);
}
else
if((upPrice-LastDn)/Point>=Points)
{
LastUp=upPrice;
LastIsUp=True;
ZZ_Orlova[i]=upPrice;
sixth=ZZ_Orlova[i];
sixthcandel=i;
Print("the sixth is ",sixth," ",sixthcandel);
LastPicTime=Time[i];
up [LastBar]=Low[LastBar];
//up[1]=Low[1]-a;
fourth=Low[LastBar];
fourthcandel=LastBar;
Print("the fourth is ",fourth," ",fourthcandel);
///////////////////////////
}
}
المشكلة يا اصدقائي هي هنا ولكن لكي تفهموها عليكم المواصلة
[PHP]
[PHP]if(third<second && thirdcandel<secondcandel)
{
second=third;
secondcandel=thirdcandel;
}
if(first<fourth && firstcandel>fourthcandel)
{
first=fourth;
firstcandel=fourthcandel;
}
if(five<second &&fivecandel<secondcandel && first>second)
{
first=five;
firstcandel=fivecandel;
}
if(third>second && secondcandel>thirdcandel )
{
second=third;
secondcandel=thirdcandel;
}
if(sixth>fourth && sixthcandel<fourthcandel && High[1]>second)
{
second=sixth;
secondcandel=sixthcandel;
}
if(third>first && thirdcandel<firstcandel)
{
second=third;
secondcandel=thirdcandel;
}
[/PHP]
[/PHP]
لاحظوا من فظلكم كل دالات print في الكود السابق لان المشكلة تكمن فيهم ............
طيب الان سنواصل وسوف اعطيكم الموفينج مستوى 78.6 في حالة بيع
كود PHP:
if(firstcandel<secondcandel && first<second )
{
counted_bars=IndicatorCounted();
limit=Bars-counted_bars-1;
fstBar=1;
for(int i =limit; i>=fstBar; i--)
{
a=MathAbs(first-second);
lineforprofit=MathAbs(((a*16.7)/100)+first);
lineforaverage=MathAbs(((a*50)/100)+first);
lineforsell=MathAbs(((a*78.6)/100)+first);
lineforstoploss=MathAbs(((a*3)/100)+second);
if(lineforsell>High[i-1] && first<second)
{
espace=lineforsell-High[i-1];
moving78[i-1]=High[i-1]+espace;/////////
}else if (first<second){espace=lineforsell-High[i-1];
moving78[i-1]=High[i-1]+espace;/////////
}
if(lineforaverage>High[i-1])
{
espaceaverage=lineforaverage-High[i-1];
moving50[i-1]=High[i-1]+espaceaverage;
}else {
espaceaverage=lineforaverage-High[i-1];
moving50[i-1]=High[i-1]+espaceaverage;
}
if(lineforprofit<High[i-1])
{
espaceprofit=High[i-1]-lineforprofit;
moving16[i-1]=High[i-1]-espaceprofit;
}else if(lineforprofit>High[i-1]){
espaceprofit=High[i-1]-lineforprofit;
moving16[i-1]=High[i-1]-espaceprofit;
}
if(lineforstoploss>High[i-1])
{
espacestoploss=lineforstoploss-High[i-1];
moving103[i-1]=High[i-1]+espacestoploss;
}else {
espacestoploss=lineforstoploss-High[i-1];
moving103[i-1]=High[i-1]+espacestoploss;
}
}ChartRedraw();
}
else if(first>second){
counted_bars=IndicatorCounted();
limit=Bars-counted_bars-1;
fstBar=1;
for(int i =limit; i>=fstBar; i--)
{
a=MathAbs(first-second);
lineforprofit=MathAbs(((a*16.7)/100)+first);
lineforaverage=MathAbs(((a*50)/100)+first);
lineforsell=MathAbs(((a*78.6)/100)+first);
lineforstoploss=MathAbs(((a*3)/100)+second);
if(lineforsell>High[i-1])
{
espace=lineforsell-High[i-1];
moving78[i-1]=High[i-1]+espace;////////////
}
if(lineforaverage>High[i-1])
{
espaceaverage=lineforaverage-High[i-1];
moving50[i-1]=High[i-1]+espaceaverage;
}
if(lineforprofit<High[i-1])
{
espaceprofit=High[i-1]-lineforprofit;
moving16[i-1]=High[i-1]-espaceprofit;
}
if(lineforstoploss>High[i-1])
{
espacestoploss=lineforstoploss-High[i-1];
moving103[i-1]=High[i-1]+espacestoploss;
}
}ChartRedraw();
}
هذا كله في حالة بيع والان سوف اعطيكم حالة شراء
كود PHP:
/////////////////////////////////////////////////////////////check for buyyyy
if(firstcandel>secondcandel)
{ counted_bars=IndicatorCounted();
limit=Bars-counted_bars-1;
fstBar=1;
for(int i =limit; i>=fstBar; i--)
{
a=(first-second);
a=MathAbs(first-second);
lineforprofit=MathAbs(((a*16.7)/100)-second);
lineforaverage=MathAbs(((a*50)/100)+first);
lineforbuy=MathAbs(((a*78.6)/100)-second);
lineforstoploss=MathAbs(((a*3)/100)-first);
//////////////////////////////////////////////////////
if(lineforbuy<High[i-1])
{
espace=MathAbs(lineforbuy-High[i-1]);////////////
moving78[i-1]=High[i-1]-espace;
}else{
espace=MathAbs(lineforbuy-High[i-1]);
moving78[i-1]=High[i-1]+espace;//////////
}
if(lineforaverage<High[i-1])
{
espaceaverage=MathAbs(lineforaverage-High[i-1]);
moving50[i-1]=High[i-1]-espaceaverage;
}else{
espaceaverage=MathAbs(lineforaverage-High[i-1]);
moving50[i-1]=High[i-1]+espaceaverage;
}
if(lineforprofit>High[i-1])
{
espaceprofit=MathAbs(High[i-1]-lineforprofit);
moving16[i-1]=High[i-1]+espaceprofit;
}else{
espaceprofit=MathAbs(High[i-1]-lineforprofit);
moving16[i-1]=High[i-1]-espaceprofit;
}
if(lineforstoploss<High[i-1])
{
espacestoploss=MathAbs(lineforstoploss-High[i-1]);
moving103[i-1]=High[i-1]-espacestoploss;
}else{
espacestoploss=MathAbs(lineforstoploss-High[i-1]);
moving103[i-1]=High[i-1]+espacestoploss;
}
}ChartRedraw();
}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
else if(firstcandel<secondcandel){
counted_bars=IndicatorCounted();
limit=Bars-counted_bars-1;
fstBar=1;
for(int i =limit; i>=fstBar; i--)
{
a=(first-second);
a=MathAbs(first-second);
lineforprofit=MathAbs(((a*16.7)/100)-first);
lineforaverage=MathAbs(((a*50)/100)-first);
lineforbuy=MathAbs(((a*78.6)/100)-first);
lineforstoploss=MathAbs(((a*3)/100)-second);
//////////////////////////////////////////////////////
if(lineforbuy>High[i-1] && first>second)
{
espace=MathAbs(lineforbuy-High[i-1]);//////////////
moving78[i-1]=High[i-1]+espace;
}else if(High[i-1]>lineforbuy&& first>second){
espace=MathAbs(lineforbuy-High[i-1]);///////////////
moving78[i-1]=High[i-1]-espace;
}
if(lineforaverage<High[i-1] && first>second)
{
espaceaverage=MathAbs(lineforaverage-High[i-1]);
moving50[i-1]=High[i-1]-espaceaverage;
}else if (first>second){
espaceaverage=MathAbs(lineforaverage-High[i-1]);
moving50[i-1]=High[i-1]+espaceaverage;
}
if(lineforprofit>High[i-1] && first>second)
{
espaceprofit=MathAbs(High[i-1]-lineforprofit);
moving16[i-1]=High[i-1]+espaceprofit;
}else if( first>second){
espaceprofit=MathAbs(High[i-1]-lineforprofit);
moving16[i-1]=High[i-1]-espaceprofit;
}
if(lineforstoploss<High[i-1] && first>second)
{
espacestoploss=MathAbs(lineforstoploss-High[i-1]);
moving103[i-1]=High[i-1]-espacestoploss;
}else if (first>second){
espacestoploss=MathAbs(lineforstoploss-High[i-1]);
moving103[i-1]=High[i-1]+espacestoploss;
}
//}
}ChartRedraw();
}
الان كما قلت لكم المشكلة هي هنا[/PHP]
كود PHP:
if(third<second && thirdcandel<secondcandel)
{
second=third;
secondcandel=thirdcandel;
}
if(first<fourth && firstcandel>fourthcandel)
{
first=fourth;
firstcandel=fourthcandel;
}
if(five<second &&fivecandel<secondcandel && first>second)
{
first=five;
firstcandel=fivecandel;
}
if(third>second && secondcandel>thirdcandel )
{
second=third;
secondcandel=thirdcandel;
}
if(sixth>fourth && sixthcandel<fourthcandel && High[1]>second)
{
second=sixth;
secondcandel=sixthcandel;
}
if(third>first && thirdcandel<firstcandel)
{
second=third;
secondcandel=thirdcandel;
}
[/PHP]