//+------------------------------------------------------------------+ //| 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); }
//+------------------------------------------------------------------+ //| 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); }
المواضيع المتشابهه | ||||
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
مشكل بعد الإنتهاء من برمجة اكسبيرت بصيط | babouche | منتدى المؤشرات و الاكسبرتات | 3 | 16 - 11 - 2015 06:15 PM |
مشكل عند إنتهاء من برمجة اكسبيرت تقاطع موفنجين | babouche | منتدى المؤشرات و الاكسبرتات | 3 | 05 - 11 - 2015 04:22 PM |
طلب برمجة اكسبيرت | fadi39000 | منتدى المؤشرات و الاكسبرتات | 10 | 08 - 07 - 2014 06:06 PM |
طلب برمجة اكسبيرت | mahmoudmsk | منتدى المؤشرات و الاكسبرتات | 8 | 08 - 01 - 2013 03:58 PM |
طلب برمجة اكسبيرت مهم | يحيى راكع | منتدى المؤشرات و الاكسبرتات | 4 | 03 - 10 - 2012 02:27 PM |