فهل هكذا صحيح ؟؟كود PHP:}
int CloseBuyOrdersHiddenTP()
{
int total=OrdersTotal();
for (int cnt=total;cnt>=0;cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
[COLOR="red"]if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{<font color="blue">
وجدت هذا الشرط موجود في دالة الترلينج ستوب و البريك إيفين فأضفته لباقي الدوال هكذا
</font>
if(OrderType()==OP_BUY&&Bid>(OrderOpenPrice()+TakeProfit*point))
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3*D);
}
}
}
}
void CloseBuyOrdersHiddenSL()
{
int total=OrdersTotal();
for (int cnt=total;cnt>=0;cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
[COLOR="red"]if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY&&Bid<(OrderOpenPrice()-StopLoss*point))
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),3*D);
}
}
}
}
void CloseSellOrdersHiddenTP()
{
int total=OrdersTotal();
for(int cnt=total;cnt>=0;cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
[COLOR="red"]if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{[/COLOR]
if(OrderType()==OP_SELL&&Ask<(OrderOpenPrice()-TakeProfit*point))
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3*D);
}
}
}
}
void CloseSellOrdersHiddenSL()
{
int total=OrdersTotal();
for(int cnt=total;cnt>=0;cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
[COLOR="red"]if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{[/COLOR]
if(OrderType()==OP_SELL&&Ask>(OrderOpenPrice()+StopLoss*point))
{
OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),3*D);
}
}
}
}
//+------------------------------------------------------------------+
//| FUNCTION DEFINITIONS TrailingStop |
//+------------------------------------------------------------------+
//|---------trailing stop
void MoveTrailingStop()
{
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL[COLOR="red"]&&OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
{[/COLOR]
if(OrderType()==OP_BUY)
{
if(TrailingStop>0&&NormalizeDouble(Ask-TrailingStep*point,digits)>NormalizeDouble(OrderOpenPrice()+TrailingStop*point,digits))
{
if((NormalizeDouble(OrderStopLoss(),digits)<NormalizeDouble(Bid-TrailingStop*point,digits))||(OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid-TrailingStop*point,digits),OrderTakeProfit(),0,Blue);
}
}
}
else
{
if(TrailingStop>0&&NormalizeDouble(Bid+TrailingStep*point,digits)<NormalizeDouble(OrderOpenPrice()-TrailingStop*point,digits))
{
if((NormalizeDouble(OrderStopLoss(),digits)>(NormalizeDouble(Ask+TrailingStop*point,digits)))||(OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask+TrailingStop*point,digits),OrderTakeProfit(),0,Red);
}
}
}
}
}
}
void MoveBreakEven()
{
int cnt,total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL&&OrderSymbol()==Symbol()[COLOR="red"]&&OrderMagicNumber()==MagicNumber)
{[/COLOR]
if(OrderType()==OP_BUY)
{
if(BreakEven>0)
{
if(NormalizeDouble((Bid-OrderOpenPrice()),digits)>BreakEven*point)
{
if(NormalizeDouble((OrderStopLoss()-OrderOpenPrice()),digits)<0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()+movestopto*point,digits),OrderTakeProfit(),0,Blue);
}
}
}
}
else
{
if(BreakEven>0)
{
if(NormalizeDouble((OrderOpenPrice()-Ask),digits)>BreakEven*point)
{
if(NormalizeDouble((OrderOpenPrice()-OrderStopLoss()),digits)<0)
{
OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(OrderOpenPrice()-movestopto*point,digits),OrderTakeProfit(),0,Red);
}
}
}
}
}
}
}
وهل لن أحتاج إلى تغيير الماجيك نمبر حتى لو فتحت شارتين لنفس العمله بنفس الفريم ؟؟؟
وبارك الله فيك ...
ولدي سؤال بعد إذنك .. أحيانا عندما أقوم بتفعيل الإكسبيرت أجده قد قام بفتح صفقه مباشرة و عندما أبحث أجد أن الشروط كانت محققة في الشمعه السابقة والحالية لم تغلق لكن الحاليه مثلا قد تكون إبتعدت بعدد نقاط كثيره ... فهل أجعل رقم الشمعه في الشروط 0 بدلا من 1 حتى لا يحدث هذا أم ماذا ؟؟؟
وجزاك الله عنا كل خير .[/COLOR][/COLOR]

