اقتباس:
المشاركة الأصلية كتبت بواسطة وضاح عطار
استخدم الوظيفة التالية : كود PHP: void SetPrice(string name, datetime Tm, double Prc, color clr) { if(ObjectFind(name) == -1) { ObjectCreate(name, OBJ_ARROW, 0, Tm, Prc); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_WIDTH, 1); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } else { ObjectSet(name, OBJPROP_TIME1, Tm); ObjectSet(name, OBJPROP_PRICE1, Prc); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_WIDTH, 1); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } }
ويصبح مؤشرك كالتالي : كود PHP: //+------------------------------------------------------------------+ //| wajdyss lines.mq4 | //| Copyright © 2008, wajdyss| //| wajdyss@yahoo.com | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, wajdyss" #property link "wajdyss@yahoo.com" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Lime #property indicator_color2 Lime #property indicator_color3 Lime #property indicator_color4 Lime #property indicator_color5 Lime #property indicator_color6 Lime #property indicator_color7 Lime #property indicator_color8 Lime extern int how_long=10000; // bars to be counted (-1 - all the bars) extern double pips=125; extern double startprice=1.5000; //---- indicator buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; double ExtMapBuffer7[]; double ExtMapBuffer8[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { Comment("wajdyss_lines"); SetIndexBuffer(0, ExtMapBuffer1); SetIndexStyle(0, DRAW_LINE); SetIndexBuffer(1, ExtMapBuffer2); SetIndexStyle(1, DRAW_LINE); SetIndexBuffer(2, ExtMapBuffer3); SetIndexStyle(2, DRAW_LINE); SetIndexBuffer(3, ExtMapBuffer4); SetIndexStyle(3, DRAW_LINE); SetIndexBuffer(4, ExtMapBuffer5); SetIndexStyle(4, DRAW_LINE); SetIndexBuffer(5, ExtMapBuffer6); SetIndexStyle(5, DRAW_LINE); SetIndexBuffer(6, ExtMapBuffer7); SetIndexStyle(6, DRAW_LINE); SetIndexBuffer(7, ExtMapBuffer8); SetIndexStyle(7, DRAW_LINE); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { Comment(""); return(0); } int start() { int cnt=0; int begin_bar=0; double pips2=pips*Point; if (how_long == -1) { begin_bar = Bars; } else { begin_bar = how_long; } for (cnt = begin_bar; cnt >= 0; cnt--) { ExtMapBuffer1[cnt] = startprice; ExtMapBuffer2[cnt] = startprice+(pips2); ExtMapBuffer3[cnt] = startprice+(pips2*2); ExtMapBuffer4[cnt] = startprice+(pips2*3); ExtMapBuffer5[cnt] = startprice-(pips2); ExtMapBuffer6[cnt] = startprice-(pips2*2); ExtMapBuffer7[cnt] = startprice-(pips2*3); ExtMapBuffer8[cnt] = startprice-(pips2*4); } SetPrice("level1", Time[0],ExtMapBuffer1[0], indicator_color1); SetPrice("level2", Time[0],ExtMapBuffer2[0], indicator_color2); SetPrice("level3", Time[0],ExtMapBuffer3[0], indicator_color3); SetPrice("level4", Time[0],ExtMapBuffer4[0], indicator_color4); SetPrice("level5", Time[0],ExtMapBuffer5[0], indicator_color5); SetPrice("level6", Time[0],ExtMapBuffer6[0], indicator_color6); SetPrice("level7", Time[0],ExtMapBuffer7[0], indicator_color7); SetPrice("level8", Time[0],ExtMapBuffer8[0], indicator_color8); return(0); } void SetPrice(string name, datetime Tm, double Prc, color clr) { if(ObjectFind(name) == -1) { ObjectCreate(name, OBJ_ARROW, 0, Tm, Prc); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_WIDTH, 1); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } else { ObjectSet(name, OBJPROP_TIME1, Tm); ObjectSet(name, OBJPROP_PRICE1, Prc); ObjectSet(name, OBJPROP_COLOR, clr); ObjectSet(name, OBJPROP_WIDTH, 1); ObjectSet(name, OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE); } } //+------------------------------------------------------------------+
| جزاك الله كل خير  |