عرض مشاركة واحدة
قديم 15-02-2013, 03:48 PM   المشاركة رقم: 262
الكاتب
MOVING_AVERAGE
عضو فضى
الصورة الرمزية MOVING_AVERAGE

البيانات
تاريخ التسجيل: Feb 2012
رقم العضوية: 8190
الدولة: algeria
العمر: 42
المشاركات: 2,213
بمعدل : 0.46 يوميا

الإتصالات
الحالة:
MOVING_AVERAGE غير متواجد حالياً
وسائل الإتصال:

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

للتحكم في اضهار او عدم اضهار خطوط الموفينج

سنستعمل متغير من النوع المنطقي

وهذا النوع كما قلنا من قبل يحمل قيمتين

سنجعل الخطوط تضهر علي حسب قيمة هذا المتغير

[PHP]
extern bool showMA=true
[/PHP]

ويكون كود الاضهار او عدم الاضهار كالتالي

[PHP]
if(showMA==true)
{
FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i );
SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i );
}
[/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


extern bool showMA=true;

double CrossUp1[];
double CrossDown1[];

double FastMA[];
double SlowMA[];

extern int ExtPeriodFastMA = 7;
extern int ExtPeriodSlowMA = 15;
extern int ExtModeFastMA = 1;
extern int ExtModeSlowMA = 1;
extern int ExtPriceFastMA = 0;
extern int ExtPriceSlowMA = 0;



//+------------------------------------------------------------------+
//| 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;
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 );
}

}

return(0);
}

[/PHP]

انا تعبت من الكتابة ساخذ شوية راحة ونكمل ان شاء الله



التوقيع

نقره لعرض الصورة في صفحة مستقلة







عرض البوم صور MOVING_AVERAGE  
رد مع اقتباس
  #262  
قديم 15-02-2013, 03:48 PM
MOVING_AVERAGE MOVING_AVERAGE غير متواجد حالياً
عضو فضى
افتراضي رد: دورة تعلم البرمجة باحتراف

للتحكم في اضهار او عدم اضهار خطوط الموفينج

سنستعمل متغير من النوع المنطقي

وهذا النوع كما قلنا من قبل يحمل قيمتين

سنجعل الخطوط تضهر علي حسب قيمة هذا المتغير

[PHP]
extern bool showMA=true
[/PHP]

ويكون كود الاضهار او عدم الاضهار كالتالي

[PHP]
if(showMA==true)
{
FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i );
SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i );
}
[/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


extern bool showMA=true;

double CrossUp1[];
double CrossDown1[];

double FastMA[];
double SlowMA[];

extern int ExtPeriodFastMA = 7;
extern int ExtPeriodSlowMA = 15;
extern int ExtModeFastMA = 1;
extern int ExtModeSlowMA = 1;
extern int ExtPriceFastMA = 0;
extern int ExtPriceSlowMA = 0;



//+------------------------------------------------------------------+
//| 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;
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 );
}

}

return(0);
}

[/PHP]

انا تعبت من الكتابة ساخذ شوية راحة ونكمل ان شاء الله




رد مع اقتباس