النتائج 1 إلى 9 من 9
- 23-02-2018, 05:03 PM #1
اعاني من مشكلة في المؤشر الذي صنعته واحتاج مساعدة الخيراء
لدي اربع موفينجات استعملهم كمستويات فايبوناتشي على المؤشر و 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]
لاحظوا من فظلكم كل دالات 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: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;
}
- 24-02-2018, 02:28 PM #2
تم الاطلاع
لتحصل على جودة عالية لابد نحن نفهم 100% كما تفهم انت
اعتبر فهمي الان 0%
نأخذها من الاول
كود: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);
- 24-02-2018, 03:02 PM #3
فيلسوف البادية
كود PHP:espace=up[Lastbar]-down[Lastbar];
lineforsell=(espace*78.6)/100;
lineaverage=(espace/2;
linetakeprofite=(espace*16.7)/100;
linestoploss=(espace*3)/100;
///////////////////////////////////////////////////////////////////////////الان انا واضع اربع موفينجات بقيمة 1 فقط وستعرف الآن لماذا
if(lineforsell>High[i-1] && first<second)
{
espace=lineforsell-High[i-1];///////////////////الان انا حسبت المسافة بين لاينفورسال وهاي الشمعة الاولى
////////////////////////////////////////////////وهاي الشمعة الاولى هو نفسه الموفنج 78 لأني اعطيته سرعة 1 فقط
moving78[i-1]=High[i-1]+espace;/////////الان انا اضفت الفارق بين لاين فور سال والهاي الاولى الى الشمعة الاولى مرة اخرة ولكن هذه المرة سميتها موفينج78
}else if (first<second){espace=lineforsell-High[i-1];
moving78[i-1]=High[i-1]+espace;/////////
}
/////////////////////////////////////////////////////////طبق هذا كله على الموفينجات الاخرى
- 24-02-2018, 03:10 PM #4
المتغيرات الاربعة هي موحدة القيمة حتى تكون مثل الهاي الشمعة الاولى اي الموفنجات الاربعة والهاي الشمعة الاولى نفس الشيئ
- 24-02-2018, 04:17 PM #5
نبدأ بالمشاكل البسيطة ليكون برنامج دون مشاكل
perB = Time[0]; f
perB يفترض تعرفها datetime
- 24-02-2018, 04:22 PM #6
انظر الى جميع القيم في الجلوبل آريا
كود PHP:input int Points = 50;
input bool ByClose = False;
double ZZ_Orlova[];
double LastUp;
double LastDn;
bool LastIsUp;
datetime LastPicTime=0,tim;
int perB;
int Zbar[3];
double Zval[3];
int ZObar[6];
double ZOval[6];
//////
double up[] ;
double down[],a,b,c,e;
int ma_priode=1;
double moving78[],moving50[],moving103[],moving16[];
int index=0;
double first,second,third,fourth,five,sixth,lineforsell,espace,espaceprofit,lineforprofit ,lineforstoploss,lineforbuy,lineforaverage,espacestoploss,espaceaverage;
int firstcandel,secondcandel,thirdcandel,fourthcandel,fivecandel,sixthcandel,limit,fstBar;
كود PHP:datetime FindZigZag(int bar, int nP )
{
int ExtDepth=3;
int ExtDeviation=3;
int ExtBackstep=3;
int n; datetime res;
for(int i=bar;i<Bars;i++)
{
double zz=iCustom(NULL,0,"ZigZag",3,3,3,0,i);
if(zz!=0 && zz!=EMPTY_VALUE)
{
Zbar[n]=i;
Zval[n]=zz;
if(n==1) res=Time[Zbar[n]];
n++;
if(n>=nP) break;
}
}
return(res);
}
كود PHP://+------------------------------------------------------------------+
//| zzzzzzz.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| [email protected] |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "[email protected]"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 clrYellow
#property indicator_width1 2
#property indicator_color2 clrGreen
#property indicator_width2 2
#property indicator_color3 clrRed
#property indicator_width3 2
#property indicator_color4 clrRed
#property indicator_width4 2
input int Points = 50;
input bool ByClose = False;
double ZZ_Orlova[];
double LastUp;
double LastDn;
bool LastIsUp;
datetime LastPicTime=0,tim;
int perB;
int Zbar[3];
double Zval[3];
int ZObar[6];
double ZOval[6];
//////
double up[] ;
double down[],a,b,c,e,first,second;
int firstcandel,secondcandel;
double moving78[],moving50[],moving103[],moving16[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexStyle(0,DRAW_SECTION);
SetIndexBuffer(0,ZZ_Orlova);
SetIndexEmptyValue(0,0.0);
////////////////////////////////
SetIndexBuffer(1,up);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,233);
////////////////////////////////
SetIndexBuffer(2,down);
SetIndexStyle(2,DRAW_ARROW);
SetIndexArrow(2,234);
/////////////////////////
SetIndexBuffer(3,moving78);
SetIndexStyle (3,DRAW_LINE,STYLE_SOLID,2,clrRed);
SetIndexDrawBegin(3,1);
SetIndexLabel (3,"auto ma_adjuster");
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---- Alert(LastDn," the indicator is run ",LastUp);
if(perB== Time[0]) return(0);
perB = Time[0];
double upPrice, dnPrice;
int limit;
int counted_bars=IndicatorCounted();
limit=Bars-counted_bars-1;
int fstBar=1;
for(int i =limit; i>=fstBar; i--)
{
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];
first=ZZ_Orlova[i];
firstcandel=LastBar;
} else if((LastUp-dnPrice)/Point>=Points)
{
LastDn=dnPrice;
LastIsUp=False;
ZZ_Orlova[i]=dnPrice;
LastPicTime=Time[i];
a=MathAbs(High[LastBar]-High[1]);
down[LastBar]=High[LastBar];
firstcandel=LastBar;
first=High[LastBar];
down[1]=High[1]+a;
}
}
else if(!LastIsUp)
{
if(dnPrice<=LastDn)
{
LastDn=dnPrice;
ZZ_Orlova[LastBar]=0.0;
ZZ_Orlova[i]=dnPrice;
LastPicTime=Time[i];
second=ZZ_Orlova[i];
secondcandel=LastBar;
}
else
if((upPrice-LastDn)/Point>=Points)
{
LastUp=upPrice;
LastIsUp=True;
ZZ_Orlova[i]=upPrice;
LastPicTime=Time[i];
a=MathAbs(Low[LastBar]-Low[1]);
up [LastBar]=Low[LastBar];
secondcandel=LastBar;
second=Low[LastBar];
up[1]=Low[1]-a;
///////////////////////////
}
}
}
/*
ObjectCreate("MOHAMMED",OBJ_FIBO,0,iTime(NULL,0,firstcandel),b,iTime(NULL,100,secondcandel),c);
ObjectSet("MOHAMMED",OBJPROP_FIBOLEVELS,7);
*/
//+------------------------------------------------------------------+
//---
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
}
//+------------------------------------------------------------------+
datetime FindZigZag(int bar, int nP )
{
int ExtDepth=3;
int ExtDeviation=3;
int ExtBackstep=3;
int n; datetime res;
for(int i=bar;i<Bars;i++)
{
double zz=iCustom(NULL,0,"ZigZag",3,3,3,0,i);
if(zz!=0 && zz!=EMPTY_VALUE)
{
Zbar[n]=i;
Zval[n]=zz;
if(n==1) res=Time[Zbar[n]];
n++;
if(n>=nP) break;
}
}
return(res);
}
- 24-02-2018, 04:23 PM #7
- 24-02-2018, 04:25 PM #8
- 26-02-2018, 03:47 AM #9
تم حل المشكلة
جزاكم الله خيرا