اف اكس ارابيا..الموقع الرائد فى تعليم فوركس Forex

اف اكس ارابيا..الموقع الرائد فى تعليم فوركس Forex (https://fx-arabia.com/vb/index.php)
-   منتدى المؤشرات و الاكسبيرتات (https://fx-arabia.com/vb/forumdisplay.php?f=6)
-   -   دورة تعليم برمجة الاكسبريت (https://fx-arabia.com/vb/showthread.php?t=29378)

imaddine 28-03-2013 05:02 PM

رد: دورة تعليم برمجة الاكسبريت
 
اقتباس:

المشاركة الأصلية كتبت بواسطة MOVING_AVERAGE (المشاركة 486762)
هنا عرفنا متغيرين واسندنا الهم قيم المؤشر الخارجي الذي اسمه imad

ياريت ترفق المؤشر الخارجي لكي نفحصه ايضا

[PHP]
double indigreen=iCustom(0,0,"imad ",1,1);
double indired=iCustom(0,0,"imad ",0,1);
[/PHP]

هذا هو الكود استاذ موفنج
[PHP]#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
#property indicator_color4 Lime
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2

double CrossUp1[];
double CrossDown1[];
double FastMA[];
double SlowMA[];
int width=EMPTY;
color clr=CLR_NONE;

extern int ExtPeriodFastMA = 8;
extern int ExtPeriodSlowMA = 14;

extern int ExtModeFastMA = 0;
extern int ExtModeSlowMA = 0;

extern int ExtPriceFastMA = 0;
extern int ExtPriceSlowMA = 0;
extern bool showMA=true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

//---- indicators
SetIndexStyle( 0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 234);
SetIndexBuffer(0, CrossDown1);

SetIndexStyle( 1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 233);
SetIndexBuffer(1, CrossUp1);

SetIndexStyle( 2, DRAW_LINE );
SetIndexBuffer( 2, FastMA );
SetIndexStyle( 3, DRAW_LINE );
SetIndexBuffer( 3, SlowMA );


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int x,i, counter;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
x=Bars-counted_bars;

for(i =0 ; i<x ; i++)
{
if(showMA==true)
{
FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i );
SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i );
}
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
double fasterEMAprevious=iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i+1 );
double fasterEMAprevious1=iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i+2 );
double slowerEMAprevious =iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i+1 );
double slowerEMAprevious1 =iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i+2 );
if(fasterEMAprevious<slowerEMAprevious&&fasterEMAp revious1>slowerEMAprevious1)
{
CrossDown1[i+1]=High[i+1]+Range*0.5;
}
if(fasterEMAprevious>slowerEMAprevious&&fasterEMAp revious1<slowerEMAprevious1)
{
CrossUp1[i+1]=Low[i+1]-Range*0.5;

}


}

//----

//----
return(0);
}
//+------------------------------------------------------------------+[/PHP]

MOVING_AVERAGE 28-03-2013 05:18 PM

رد: دورة تعليم برمجة الاكسبريت
 
اقتباس:

المشاركة الأصلية كتبت بواسطة imaddine (المشاركة 486763)
هذا هو الكود استاذ موفنج
[PHP]#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Yellow
#property indicator_color4 Lime
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2

double CrossUp1[];
double CrossDown1[];
double FastMA[];
double SlowMA[];
int width=EMPTY;
color clr=CLR_NONE;

extern int ExtPeriodFastMA = 8;
extern int ExtPeriodSlowMA = 14;

extern int ExtModeFastMA = 0;
extern int ExtModeSlowMA = 0;

extern int ExtPriceFastMA = 0;
extern int ExtPriceSlowMA = 0;
extern bool showMA=true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

//---- indicators
SetIndexStyle( 0, DRAW_ARROW, EMPTY);
SetIndexArrow(0, 234);
SetIndexBuffer(0, CrossDown1);

SetIndexStyle( 1, DRAW_ARROW, EMPTY);
SetIndexArrow(1, 233);
SetIndexBuffer(1, CrossUp1);

SetIndexStyle( 2, DRAW_LINE );
SetIndexBuffer( 2, FastMA );
SetIndexStyle( 3, DRAW_LINE );
SetIndexBuffer( 3, SlowMA );


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int x,i, counter;
double Range, AvgRange;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
x=Bars-counted_bars;

for(i =0 ; i<x ; i++)
{
if(showMA==true)
{
FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i );
SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i );
}
Range=0;
AvgRange=0;
for (counter=i ;counter<=i+9;counter++)
{
AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
}
Range=AvgRange/10;
double fasterEMAprevious=iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i+1 );
double fasterEMAprevious1=iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i+2 );
double slowerEMAprevious =iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i+1 );
double slowerEMAprevious1 =iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i+2 );
if(fasterEMAprevious<slowerEMAprevious&&fasterEMAp revious1>slowerEMAprevious1)
{
CrossDown1[i+1]=High[i+1]+Range*0.5;
}
if(fasterEMAprevious>slowerEMAprevious&&fasterEMAp revious1<slowerEMAprevious1)
{
CrossUp1[i+1]=Low[i+1]-Range*0.5;

}


}

//----

//----
return(0);
}
//+------------------------------------------------------------------+[/PHP]

تمام هذا نفس المؤشر الذي شرحناه

MOVING_AVERAGE 28-03-2013 05:21 PM

رد: دورة تعليم برمجة الاكسبريت
 
[PHP]
double indigreen=iCustom(0,0,"imad ",1,1);

هذا يرمز للسهم الازرق في الشمعة السابقة


double indired=iCustom(0,0,"imad ",0,1);

وهذا يرمز للسهم الاحمر في الشمعة السابقة


[/PHP]

و نداء المؤشر صحيح اذا كان اسم المؤشر الذي واضعه مع المؤشرات imad

MOVING_AVERAGE 28-03-2013 05:22 PM

رد: دورة تعليم برمجة الاكسبريت
 
يعني الفكرة انك تشتري او تبيع بضهور احد السهمين

الا هنا كل شئ صحيح

MOVING_AVERAGE 28-03-2013 05:24 PM

رد: دورة تعليم برمجة الاكسبريت
 
ننتقل الي السطر الموالي

[PHP]
if(orderstotal()<MaxTrades&&indigreen<4000)
if(orderstotal()<MaxTrades&&indired<4000)

[/PHP]وضعنا شرط ضهور السهم لاكن لم نضع بعده اي عمل يقوم به الاكسبريت يعني هنا هذه الكتابة غير صحيحة نحذفها تماما

MOVING_AVERAGE 28-03-2013 05:26 PM

رد: دورة تعليم برمجة الاكسبريت
 
هنا ايضا هذه الكتابة غير صحيحة

[PHP]
double TP;
double SL;
TP=Ask+TakeProfit*point;
SL=Ask-StopLoss*point;
TP=Bid-TakeProfit*point;
SL=Bid+StopLoss*point;

[/PHP]

لماذا الكتابه غير صحيحة

سنشرحها خطوة بخطوة

MOVING_AVERAGE 28-03-2013 05:34 PM

رد: دورة تعليم برمجة الاكسبريت
 
[PHP]

double TP;

هنا التعريف صحيح
double SL;
هنا التعريف صحيح

المشكلة في التالي

TP=Ask+TakeProfit*point;

جعلنا قيمة TP تساوي السعر الحالي Ask واضفنا له عدد النقاط التي نريدها

SL=Ask-StopLoss*point;


جعلنا قيمة SL تساوي السعر الحالي Ask وانقصنا منه عدد النقاط التي نريدها

هذه الكتابة صحيحة فقط عند تنفيذ اوامر buy اولا

وعند تنفيذ اوامر sell فهي غير صحيحة



TP=Bid-TakeProfit*point;

هنا يقوم الاكسبريت بمسح القيمة السابقة ويضع قيمة جديدة وهي السعر الحالي Bid ناقص عدد النقاط

SL=Bid+StopLoss*point;

نفس الشئ يقوم الاكسبريت بمسح الاسناد الاول ووضع اسناد اخر

وهنا تداخل في وضع الاهداف والستوب لوز



[/PHP]

بالمختصر نمسح هذه الكتابة ايضا ونرتب الكتابة اكثر

MOVING_AVERAGE 28-03-2013 05:37 PM

رد: دورة تعليم برمجة الاكسبريت
 
نفس الامر بنسبة لهذه الكتابات

هي غير مرتبه وغير دقيقة

[PHP]
if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*point;}
if(TakeProfit==0){TP=0;}else{TP=Ask+TakeProfit*poi nt;}
if(StopLoss==0){SL=0;}else{SL=Bid+StopLoss*point;}
if(TakeProfit==0){TP=0;}else{TP=Bid-TakeProfit*point;}
OrderSend(Symbol(),OP_BUY,Lots,Ask,3*Q,SL,TP,"",Ma gicNumber,0,Blue);
OrderSend(Symbol(),OP_SELL,Lots,Bid,3*Q,SL,TP,"",M agicNumber,0,Red);
[/PHP]

MOVING_AVERAGE 28-03-2013 05:39 PM

رد: دورة تعليم برمجة الاكسبريت
 
سنعيد كتابة ما سبق بترتيب اكثر

MOVING_AVERAGE 28-03-2013 05:41 PM

رد: دورة تعليم برمجة الاكسبريت
 
اولا نعرف المتغير الذي سنضع فيه الستوب لوز والتيك بروفيت

[PHP]
double TP;

double SL;
[/PHP]


الساعة الآن 08:54 PM

Powered by vBulletin® Copyright ©2000 - 2025

جميع الحقوق محفوظة الى اف اكس ارابيا www.fx-arabia.com