السلام عليكم إخواني
هل توجد طريقة للحصول على معلومات من جدول v1[] و v2[] للمؤشر خاص بي و إستخدامها في إكسبرت
لقد قمت بتصميم مؤشر يعتمذ على fractal و يخزن كل المعلومات داخل الجداول
v2[] ===> support
v1[] ===> Resistance
و إكسبيرت : إذا تم إختراق support ==> بيع
إذا تم إختراق resistance ==> شراء
لكن أريد إستخراج قيمة من الجدول v2[] تكون أصغر من آخر قيمة و لكن بترتيب (آخر قيمة تم لقبلها حتى الوصول لقيمة أصغر من القيمة الحالية) هذا في حالة البيع
مثال : الصورة السهم هي شمعة الدخول الخطوط الحمراء هي الأهذاف التي أريذ إستخراجها
المؤشر
كود:
//+------------------------------------------------------------------+ //| hamza-fractal.mq4 | //| Copyright 2015, hamza Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, hamza Corp." #property link "https://www.mql5.com" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- buffers double v1[]; double v2[]; double val1; double val2; int i; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { //---- drawing settings SetIndexArrow(0, 119); SetIndexArrow(1, 119); //---- SetIndexStyle(0, DRAW_ARROW, STYLE_DOT, 1); SetIndexDrawBegin(0, i-1); SetIndexBuffer(0, v1); SetIndexLabel(0,"Resistance"); //---- SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1); SetIndexDrawBegin(1,i-1); SetIndexBuffer(1, v2); SetIndexLabel(1,"Support"); //---- return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { i = Bars; while(i >= 0) { val1 = iFractals(NULL, 0, MODE_UPPER, i); //---- if(val1 > 0) v1[i] = High[i]; val2 = iFractals(NULL, 0, MODE_LOWER, i); //---- if(val2 > 0) v2[i] = Low[i]; i--; } return(0); } //+------------------------------------------------------------------+
كود:
//+------------------------------------------------------------------+ //| hamza-fractal.mq4 | //| Copyright 2015, hamza Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, hamza Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict input string s1 = "---------Money Management--------------"; input int TP = 10 ; input int SL = 10 ; input double lots = 0.1 ; input int Magic = 532457 ; bool bSupp_Resis = true; double t ; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- double ticksize = MarketInfo (Symbol(),MODE_TICKSIZE); if ( ticksize == 0.00001 || 0.001 ) t = ticksize * 10; else t = ticksize ; //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double SL_buy = Low[0]-0.0010; double SL_Sell = High[0]+0.0010; //--- if ( fSupp_Resis(bSupp_Resis,"Achat") && orderscnt()<=0 ) bool Buy1 = OrderSend(NULL,OP_BUY,lots,Ask,30,SL_buy,Ask+(TP*t),"",Magic,0,Blue); if ( fSupp_Resis(bSupp_Resis,"Vente") && orderscnt()<=0 ) bool Sell1 = OrderSend(Symbol(),OP_SELL,lots,Bid,30,SL_Sell,Bid-(TP*t),"",Magic,0,Red); } //+------------------------------------------------------------------+ bool fSupp_Resis (bool bSupp_Resis , string sOperation ) { double dSupport_1H = iCustom(Symbol(),PERIOD_H1,"teste_trend",0,Blue,1,0); bool bFiltreAutorise = false; if ( bSupp_Resis == false ) bFiltreAutorise = True; //------------------------------------------------ if ( sOperation == "Vente" && bSupp_Resis == true ) { if (dSupport_1H > Bid && dSupport_1H < Low[1] ) bFiltreAutorise = True; if (dSupport_1H < Bid) bFiltreAutorise = False; } //------------------------------------------------ double dResistance_1H = iCustom(Symbol(),PERIOD_H1,"teste_trend",Red,0,1); if ( sOperation == "Achat" && bSupp_Resis == true ) { if (dResistance_1H < Ask && dResistance_1H > High[1] ) bFiltreAutorise = True; if (dResistance_1H > Ask) bFiltreAutorise = False; } //------------------------------------------------ return(bFiltreAutorise); } //===================================================================== int orderscnt(){ int cnt=0; for(int i =0;i<=OrdersTotal();i++){ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){ if(OrderSymbol()==Symbol()&&OrderMagicNumber()==Magic){ cnt++; } } } return(cnt); }
declaration of 'bSupp_Resis' hides global declaration at line 17
و شكرا