السلام عليكم إخواني
لقد قمت ببرمجة اكسبيرت لهذه الإستراتيجة
بعد الإنتهاء قمت بتجربته فلاحضت أنه يقوم فقط بالبيع و لا يشتري
بحت جيدا على المشكل لكن بدون جدوى
أرجو المساعدة
كود:
//+------------------------------------------------------------------+ //| bolinger_band.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 = "----Bollinger Band1------"; input int B_period = 25; input int B_deviation= 2; input int B_shift = 0; input int B_applied = 0; input string s2 = "----Bollinger Band2------"; input int B_shift2 = 3; input string s3 = "----Bollinger Band3------"; input int B_shift3= -3; extern string s4 = "---------Money Manage---------"; extern int TP = 50; extern int SL = 70; extern double lot = 0.1; extern int magic = 12345; 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 BH_1 = iBands(NULL,0,B_period,B_deviation,B_shift,B_applied,1,1); double BL_1 = iBands(NULL,0,B_period,B_deviation,B_shift,B_applied,2,1); double BH_2 = iBands(NULL,0,B_period,B_deviation,B_shift2,B_applied,1,1); double BL_2 = iBands(NULL,0,B_period,B_deviation,B_shift2,B_applied,2,1); double BH_3 = iBands(NULL,0,B_period,B_deviation,B_shift3,B_applied,1,1); double BL_3 = iBands(NULL,0,B_period,B_deviation,B_shift3,B_applied,2,1); //--- if(Close[1] < BL_1 && Close[1] < BL_2 && Close[1] < BL_3 ){ if(orderscnt()==0) bool Buy=OrderSend(Symbol(),OP_BUY,lot,Ask,30,Ask-(SL*t),Ask+(TP*t),"",magic,0,Blue); } if (Close[1] > BH_1 && Close[1] > BH_2 && Close[1] > BH_3 ){ if(orderscnt()==0) bool Sell=OrderSend(Symbol(),OP_SELL,lot,Bid,30,Bid+(SL*t),Bid-(TP*t),"",magic,0,Red); } } //+------------------------------------------------------------------+ 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); }