يااخي المرجو تعديل هدا الاكسبيرت هو هيدج ويفتح هيدج عند تحقيق الهدف وكداكك الستوب انا اريد ان يفتح هيدج بس عند تحقيق الهدف وشكرا المرجو المساعدة
[PHP]tern bool UseTimeFilter = false;
extern int StartHour = 7;
extern int EndHour = 17;
extern string MM_Parameters = " Money Management";
extern double Lots = 0.1;
extern bool UseMoneyManagement = false;
extern int RiskPercent = 10;
extern string S5=" Order Management";
extern int BuyTakeProfit=0;
extern int SellTakeProfit=0;
extern int StopLoss=0;
int TotalOrders;
datetime Time0;
double point;
int digits,Q;
extern int MagicNumber=2533;
int init()
{
if(Digits==5||Digits==3)Q=10;
else Q=1;
if(Digits<4){point=0.01;digits=2;}
else{point=0.0001;digits=4;}
return(0);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
Comment("");
}
int orderscnt(){
int cnt=0;
for(int i =0;i<OrdersTotal();i++){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)){
if(OrderSymbol()==Symbol() && MagicNumber==OrderMagicNumber()){
cnt++;
}
}
}
return(cnt);
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Start function |
//+------------------------------------------------------------------+
int start()
{
if (UseTimeFilter){
if(!((StartHour < EndHour && TimeHour(TimeCurrent()) >= StartHour && TimeHour(TimeCurrent()) < EndHour) || (StartHour > EndHour && TimeHour(TimeCurrent()) >= StartHour ||
TimeHour(TimeCurrent()) < EndHour))){
Comment("Non-Trading Hours!");
return(0);
}
}
////////////////////////////////////////////////////
double SL,TP;
if(UseMoneyManagement) Lots = LotManage();
////////////////////////////////
if(orderscnt()<TotalOrders||orderscnt()==0){
if(StopLoss==0){SL=0;}else{SL=Ask-StopLoss*point;}
if(BuyTakeProfit==0){TP=0;}else{TP=Ask+BuyTakeProf it*point;}
OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask ,digits),3*Q,SL,TP,"MR.dollar EA",MagicNumber,0,Blue);
if(StopLoss==0){SL=0;}else{SL=Bid+StopLoss*point;}
if(SellTakeProfit==0){TP=0;}else{TP=Bid-SellTakeProfit*point;}
OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(Bi d,digits),3*Q,SL,TP,"MR.dollar EA",MagicNumber,0,Red);
PlaySound("Alert.wav");
TotalOrders=orderscnt();
}
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS Money Managment |
//+------------------------------------------------------------------+
double LotManage()
{
double lot = MathCeil(AccountFreeMargin() * RiskPercent / 1000) / 100;
if(lot<MarketInfo(Symbol(),MODE_MINLOT))lot=Market Info(Symbol(),MODE_MINLOT);
if(lot>MarketInfo(Symbol(),MODE_MAXLOT))lot=Market Info(Symbol(),MODE_MAXLOT);
return (lot);
}
//+---------------------------------------------------------------------------------+
[/PHP]