بسم الله الرحمن الرحيم
ارجوا منكم يا اخواني المساعدة في الغاء هذه الدالة
#include <stdlib.mqh>
#include <WinUser32.mqh>
ارجوا منكم يا اخواني المساعدة في الغاء هذه الدالة
#include <stdlib.mqh>
#include <WinUser32.mqh>
كود:
//------------------------------------------------------------- // Etasoft Inc. Forex EA and Script Generator version 4.1 EA //------------------------------------------------------------- // Keywords: MT4, Forex EA builder, create EA, expert advisor developer #property copyright "Copyright © 2011, Etasoft Inc. Forex EA Generator v4.1" #property link "http://www.forexgenerator.com/" #include <stdlib.mqh> #include <WinUser32.mqh> // exported variables extern double BuyLots25 = 5; extern int BuyStoploss25 = 25; extern int BuyTakeprofit25 = 100; extern double SellLots24 = 5; extern int SellStoploss24 = 25; extern int SellTakeprofit24 = 100; // local variables double PipValue=1; // this variable is here to support 5-digit brokers bool Terminated = false; string LF = "\n"; // use this in custom or utility blocks where you need line feeds int NDigits = 4; // used mostly for NormalizeDouble in Flex type blocks int ObjCount = 0; // count of all objects created on the chart, allows creation of objects with unique names int current = 0; int Count4 = 0; bool FirstTime27 = true; bool FirstTime20 = true; int init() { NDigits = Digits; if (false) ObjectsDeleteAll(); // clear the chart Comment(""); // clear the chart } // Expert start int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (Terminated == true) { Comment("EA Terminated."); return (0); } OnEveryTick3(); } void OnEveryTick3() { if (true == false && true) PipValue = 10; if (true && (NDigits == 3 || NDigits == 5)) PipValue = 10; PrintInfoToChart4(); TechnicalAnalysis29(); TechnicalAnalysis22(); TechnicalAnalysis30(); TechnicalAnalysis31(); } void PrintInfoToChart4() { string temp = "Some Text\nExecuted : " + Count4 + "\n" + "Spread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2)+ "\n" + "------------------------------------------------\n" + "ACCOUNT INFORMATION:\n" + "\n" + "Account Name: " + AccountName()+ "\n" + "Account Leverage: " + DoubleToStr(AccountLeverage(), 0)+ "\n" + "Account Balance: " + DoubleToStr(AccountBalance(), 2)+ "\n" + "Account Equity: " + DoubleToStr(AccountEquity(), 2)+ "\n" + "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2)+ "\n" + "Used Margin: " + DoubleToStr(AccountMargin(), 2)+ "\n" + "------------------------------------------------\n"; Comment(temp); Count4++; } void TechnicalAnalysis29() { if (iRVI(NULL, PERIOD_M5,21,MODE_SIGNAL,0) < 0) { CloseOrder2(); } } void CloseOrder2() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[30][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis22() { if (iRVI(NULL, PERIOD_M5,21,MODE_SIGNAL,0) > 0) { CloseOrder23(); } } void CloseOrder23() { int orderstotal = OrdersTotal(); int orders = 0; int ordticket[30][2]; for (int i = 0; i < orderstotal; i++) { OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) { continue; } ordticket[orders][0] = OrderOpenTime(); ordticket[orders][1] = OrderTicket(); orders++; } if (orders > 1) { ArrayResize(ordticket,orders); ArraySort(ordticket); } for (i = 0; i < orders; i++) { if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true) { bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 4, Red); if (ret == false) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void TechnicalAnalysis30() { if (iMA(NULL, PERIOD_M5,14,0,MODE_EMA,PRICE_CLOSE,0) > iMA(NULL, PERIOD_M5,28,0,MODE_SMA,PRICE_CLOSE,0)) { TechnicalAnalysis28(); } } void TechnicalAnalysis28() { if (iRVI(NULL, PERIOD_M5,21,MODE_SIGNAL,0) > 0) { CheckLastOrderType27(); } } void CheckLastOrderType27() { int orderType = -1; datetime lastCloseTime = 0; int cnt = OrdersHistoryTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue; if (OrderSymbol() == Symbol() && lastCloseTime < OrderCloseTime()) { lastCloseTime = OrderCloseTime(); orderType = OrderType(); } } if (orderType == OP_SELL || FirstTime27) { FirstTime27 = false; IfOrderDoesNotExist26(); } } void IfOrderDoesNotExist26() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { BuyOrder25(); } } void BuyOrder25() { double SL = Ask - BuyStoploss25*PipValue*Point; if (BuyStoploss25 == 0) SL = 0; double TP = Ask + BuyTakeprofit25*PipValue*Point; if (BuyTakeprofit25 == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_BUY, BuyLots25, Ask, 0, 0, 0, "My Expert", 1, 0, Blue); else ticket = OrderSend(Symbol(), OP_BUY, BuyLots25, Ask, 0, SL, TP, "My Expert", 1, 0, Blue); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Blue); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } void TechnicalAnalysis31() { if (iMA(NULL, PERIOD_M5,14,0,MODE_EMA,PRICE_CLOSE,0) < iMA(NULL, PERIOD_M5,28,0,MODE_SMA,PRICE_CLOSE,0)) { TechnicalAnalysis21(); } } void TechnicalAnalysis21() { if (iRVI(NULL, PERIOD_M5,21,MODE_SIGNAL,0) < 0) { CheckLastOrderType20(); } } void CheckLastOrderType20() { int orderType = -1; datetime lastCloseTime = 0; int cnt = OrdersHistoryTotal(); for (int i=0; i < cnt; i++) { if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue; if (OrderSymbol() == Symbol() && lastCloseTime < OrderCloseTime()) { lastCloseTime = OrderCloseTime(); orderType = OrderType(); } } if (orderType == OP_BUY || FirstTime20) { FirstTime20 = false; IfOrderDoesNotExist15(); } } void IfOrderDoesNotExist15() { bool exists = false; for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (exists == false) { SellOrder24(); } } void SellOrder24() { double SL = Bid + SellStoploss24*PipValue*Point; if (SellStoploss24 == 0) SL = 0; double TP = Bid - SellTakeprofit24*PipValue*Point; if (SellTakeprofit24 == 0) TP = 0; int ticket = -1; if (true) ticket = OrderSend(Symbol(), OP_SELL, SellLots24, Bid, 0, 0, 0, "My Expert", 1, 0, Red); else ticket = OrderSend(Symbol(), OP_SELL, SellLots24, Bid, 0, SL, TP, "My Expert", 1, 0, Red); if (ticket > -1) { if (true) { OrderSelect(ticket, SELECT_BY_TICKET); bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0, Red); if (ret == false) Print("OrderModify() error - ", ErrorDescription(GetLastError())); } } else { Print("OrderSend() error - ", ErrorDescription(GetLastError())); } } int deinit() { if (false) ObjectsDeleteAll(); }