![]() |
رد: دورة تعلم البرمجة باحتراف
الكتابة التالية تكون كالتالي
[PHP] #property indicator_color1 Red #property indicator_color2 Blue كتابة الاسهم السابقة #property indicator_color3 Yellow #property indicator_color4 Lime كتابة الكائنات الجديدة لخطوط الموفينجات [/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 [/PHP] |
رد: دورة تعلم البرمجة باحتراف
كتابة مصفوفتين لخطوط الموفينج
[PHP] double FastMA[]; double SlowMA[]; [/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 double CrossUp1[]; double CrossDown1[]; double FastMA[]; double SlowMA[]; [/PHP] |
رد: دورة تعلم البرمجة باحتراف
الكائن الثالث يحمل الرقم 2 ولونه اصفر
الكائن الرابع يحمل الرقم 3 ولونه اخضر |
رد: دورة تعلم البرمجة باحتراف
تحديد نوع الكائن 3 و 4
كما قلنا الكائن 3 و 4 عبارة عن خطوط لذا سيكون النوع هذه المرة خط [PHP] SetIndexStyle( 2, DRAW_LINE ); SetIndexStyle( 3, DRAW_LINE ); [/PHP] |
رد: دورة تعلم البرمجة باحتراف
لاتوجد اشكال للخطوط
ربط الخط بالمصفوقة سيكون كالتالي [PHP] SetIndexBuffer( 2, FastMA ); SetIndexBuffer( 1, SlowMA ); [/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 double CrossUp1[]; double CrossDown1[]; double FastMA[]; double SlowMA[]; //+------------------------------------------------------------------+ //| 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( 1, SlowMA ); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } [/PHP] |
رد: دورة تعلم البرمجة باحتراف
الان ندخل الي الدالة start
ونكتب حلقة for لاتكرارية [PHP] 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++) { } return(0); } [/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 double CrossUp1[]; double CrossDown1[]; double FastMA[]; double SlowMA[]; //+------------------------------------------------------------------+ //| 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++) { } return(0); } [/PHP] |
رد: دورة تعلم البرمجة باحتراف
نضع خطوط الموفينجات
وهنا خط الموفينج سياخذ اخر قيمة يعني سيكون بدلالة i يجب ان نترك الموفينج مرن اي ممكن نتحكم باعدداته الخارجية له الاعددات الخارجية التي تهمنا في الموفينج 1- دور الموفينج سنستعمل متغيرين خارجيين للتعبير عم دور الموفينج [PHP] extern int ExtPeriodFastMA = 7; extern int ExtPeriodSlowMA = 15; [/PHP]سنكتب هذين المتغيرين خارج الدالة ستار 2-الاعتماد نوع الموفينج هل هو سمبل اكسبنشل او غيرها سنستعمل ايضا متغيرين للتعبير عن النوع [PHP] extern int ExtModeFastMA = 1; extern int ExtModeSlowMA = 1; [/PHP]فرضنا اننا سنستخدم الاكسبنشل في النوعين 3- الاغلقات او الافتتحات وكما سبق سنستعمل متغيرين خارجيين لتحديد هذ المتغير [PHP] extern int ExtPriceFastMA = 0; extern int ExtPriceSlowMA = 0; [/PHP]فرضا اننا استعملنا الاغلاقات في كلا الموفينجين |
رد: دورة تعلم البرمجة باحتراف
تكون كتابة الموفينجين داخل الحلقة التكرارية كالتالي
[PHP] 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 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++) { FastMA[i] = iMA( NULL, 0, ExtPeriodFastMA, 0, ExtModeFastMA, ExtPriceFastMA, i ); SlowMA[i] = iMA( NULL, 0, ExtPeriodSlowMA, 0, ExtModeSlowMA, ExtPriceSlowMA, i ); } return(0); } [/PHP] |
الساعة الآن 03:23 PM |
Powered by vBulletin® Copyright ©2000 - 2025
جميع الحقوق محفوظة الى اف اكس ارابيا www.fx-arabia.com