عرض مشاركة واحدة
قديم 16-04-2014, 02:29 PM   المشاركة رقم: 350
الكاتب
MohamedFX2014
عضو جديد

البيانات
تاريخ التسجيل: Mar 2014
رقم العضوية: 18774
المشاركات: 1
بمعدل : 0.00 يوميا

الإتصالات
الحالة:
MohamedFX2014 غير متواجد حالياً
وسائل الإتصال:

كاتب الموضوع : اسلام العوامى المنتدى : منتدى المؤشرات و الاكسبيرتات
افتراضي رد: موضوع مخصص للاسئلة والاستفسارات الخاصة بدورة تعليم البرمجة الاحترافية بلغة mql4

السلام عليكم استاذنا اسلام
اولا احب ان اشكرك عن شرح سلسة البرمجة التى استفدت منها شخصيا لفهم الكثير
ثانيا عندى طلب مساعدة فى تصحيح الكود التالى لوظيفة التالية
الوظيفة : تقوم باعادة فتح امر الشراء المغلق بواسطة ال stopTrilling فى حالة ان استمر السعر فى الارتفاع بعد اغلاق امر الشراء
الكود المراد مراجعته و تصحيحه :

void RightBuyEarlyCloseCorrection()
//=====================================
// Right Buy Orders Early Closed By Trilling Stop.
{
double BuySL = Ask-StopLose;
double BuyTP = Ask+TakeProfit;
double SellSL = Bid+StopLose;
double SellTP = Bid-TakeProfit;
if(StopLose==0) BuySL = 0;
else BuySL=Ask-(StopLose*t);
if(TakeProfit==0)BuyTP=0;
else BuyTP=Ask+(TakeProfit*t);
if(StopLose==0) SellSL = 0;
else SellSL=Bid+(StopLose*t);
if(TakeProfit==0)SellTP=0;
else SellTP=Bid-(TakeProfit*t);
double newlot;
if (UseCM==false) newlot= Lot;
if (UseCM==true) newlot=lots();
if (UseMulti==true){
if(ProfitOrLoss()==false){newlot=lastlot()*Multi;}
if(ProfitOrLoss()==true){newlot=Lot;}}
//-------------------------------------------------------------------------------------------------
//for(int i=OrdersHistoryTotal();i<OrdersHistoryTotal()+1;i+ +)
for(int i=0;i<=OrdersHistoryTotal();i++)
{
double OS=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if((OrderSymbol()==Symbol())
&&OrderType()==OP_BUY
&&(OrderMagicNumber()==MagicBuy||MagicBuyCorrec t)
&&(OrderProfit()>=0)&&(OrderClosePrice()<(Ask+(Ear lyCloseCorrection*t)))
&&((AccountInfoDouble(ACCOUNT_MARGIN_LEVEL)>=Min_M argin_Level
||AccountInfoDouble(ACCOUNT_MARGIN_LEVEL)==0))
)
{
NewOrder=OrderSend(Symbol(),OP_BUY,newlot,Ask,3,Bu ySL,BuyTP,"RenewBUY",MagicRebuy,0,clrPaleGreen);
Comment("\nReew Buy");
}}
}
الخطأ يحدث فى مرحلة ال select Order حيث ان الوظيفى لا تقوم باختيار اخر امر شراء مغلق و اوقات تختار و يكون عد التكرار كثير جدا الى ان يحدث ال stop Out
ارجو من حضرتك تعديل الخطأ فى الكود و تجربته حيث انى جربت كل الحلول التالية و لكنها لا تعمل ايضا الشكل الصحيح

الحلول المجربة :
//for(int i=0; i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal()-1;i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal();i=OrdersHistoryTotal()+1;i--)//not working at all
//for(int i=OrdersHistoryTotal()+1;i<OrdersHistoryTotal()+2; i--)//not working at all
//if (OrdersHistoryTotal()>0)
//{
//for(int i=OrdersHistoryTotal();i>OrdersHistoryTotal()-1;i--)
//for(int i=0;i<=OrdersHistoryTotal();i++)//many
//for(int i =OrdersHistoryTotal();i<OrdersHistoryTotal()+2;i++ )
//for(int i=0; i<OrdersHistoryTotal();i++)// many
//for(int i=OrdersHistoryTotal(); i<OrdersHistoryTotal()+1;i++)//not working
//for(int i=OrdersHistoryTotal(); i>0;i--)//many
//for(int i=OrdersHistoryTotal(); i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal(); i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal()-1;i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal(); i==OrdersHistoryTotal()-1;i--)//not working
//for(int i=OrdersHistoryTotal(); i==OrdersHistoryTotal()+1;i++)//not working
//for(int i=OrdersHistoryTotal()-1;i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal()-2;i>OrdersHistoryTotal()-1;i--)//not working
//for(int i=OrdersHistoryTotal()-1;i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal();i==OrdersHistoryTotal();i--) // not working
//for(int i=0; i<=OrdersHistoryTotal();i++)//many (as last lot)
//for(int i=2; i>=0;i--)
//for(int i=OrdersHistoryTotal();i>OrdersHistoryTotal()-1;i--)// not working



عرض البوم صور MohamedFX2014  
رد مع اقتباس
  #350  
قديم 16-04-2014, 02:29 PM
MohamedFX2014 MohamedFX2014 غير متواجد حالياً
عضو جديد
افتراضي رد: موضوع مخصص للاسئلة والاستفسارات الخاصة بدورة تعليم البرمجة الاحترافية بلغة mql4

السلام عليكم استاذنا اسلام
اولا احب ان اشكرك عن شرح سلسة البرمجة التى استفدت منها شخصيا لفهم الكثير
ثانيا عندى طلب مساعدة فى تصحيح الكود التالى لوظيفة التالية
الوظيفة : تقوم باعادة فتح امر الشراء المغلق بواسطة ال stopTrilling فى حالة ان استمر السعر فى الارتفاع بعد اغلاق امر الشراء
الكود المراد مراجعته و تصحيحه :

void RightBuyEarlyCloseCorrection()
//=====================================
// Right Buy Orders Early Closed By Trilling Stop.
{
double BuySL = Ask-StopLose;
double BuyTP = Ask+TakeProfit;
double SellSL = Bid+StopLose;
double SellTP = Bid-TakeProfit;
if(StopLose==0) BuySL = 0;
else BuySL=Ask-(StopLose*t);
if(TakeProfit==0)BuyTP=0;
else BuyTP=Ask+(TakeProfit*t);
if(StopLose==0) SellSL = 0;
else SellSL=Bid+(StopLose*t);
if(TakeProfit==0)SellTP=0;
else SellTP=Bid-(TakeProfit*t);
double newlot;
if (UseCM==false) newlot= Lot;
if (UseCM==true) newlot=lots();
if (UseMulti==true){
if(ProfitOrLoss()==false){newlot=lastlot()*Multi;}
if(ProfitOrLoss()==true){newlot=Lot;}}
//-------------------------------------------------------------------------------------------------
//for(int i=OrdersHistoryTotal();i<OrdersHistoryTotal()+1;i+ +)
for(int i=0;i<=OrdersHistoryTotal();i++)
{
double OS=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if((OrderSymbol()==Symbol())
&&OrderType()==OP_BUY
&&(OrderMagicNumber()==MagicBuy||MagicBuyCorrec t)
&&(OrderProfit()>=0)&&(OrderClosePrice()<(Ask+(Ear lyCloseCorrection*t)))
&&((AccountInfoDouble(ACCOUNT_MARGIN_LEVEL)>=Min_M argin_Level
||AccountInfoDouble(ACCOUNT_MARGIN_LEVEL)==0))
)
{
NewOrder=OrderSend(Symbol(),OP_BUY,newlot,Ask,3,Bu ySL,BuyTP,"RenewBUY",MagicRebuy,0,clrPaleGreen);
Comment("\nReew Buy");
}}
}
الخطأ يحدث فى مرحلة ال select Order حيث ان الوظيفى لا تقوم باختيار اخر امر شراء مغلق و اوقات تختار و يكون عد التكرار كثير جدا الى ان يحدث ال stop Out
ارجو من حضرتك تعديل الخطأ فى الكود و تجربته حيث انى جربت كل الحلول التالية و لكنها لا تعمل ايضا الشكل الصحيح

الحلول المجربة :
//for(int i=0; i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal()-1;i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal();i=OrdersHistoryTotal()+1;i--)//not working at all
//for(int i=OrdersHistoryTotal()+1;i<OrdersHistoryTotal()+2; i--)//not working at all
//if (OrdersHistoryTotal()>0)
//{
//for(int i=OrdersHistoryTotal();i>OrdersHistoryTotal()-1;i--)
//for(int i=0;i<=OrdersHistoryTotal();i++)//many
//for(int i =OrdersHistoryTotal();i<OrdersHistoryTotal()+2;i++ )
//for(int i=0; i<OrdersHistoryTotal();i++)// many
//for(int i=OrdersHistoryTotal(); i<OrdersHistoryTotal()+1;i++)//not working
//for(int i=OrdersHistoryTotal(); i>0;i--)//many
//for(int i=OrdersHistoryTotal(); i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal(); i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal()-1;i<OrdersHistoryTotal();i++)//many
//for(int i=OrdersHistoryTotal(); i==OrdersHistoryTotal()-1;i--)//not working
//for(int i=OrdersHistoryTotal(); i==OrdersHistoryTotal()+1;i++)//not working
//for(int i=OrdersHistoryTotal()-1;i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal()-2;i>OrdersHistoryTotal()-1;i--)//not working
//for(int i=OrdersHistoryTotal()-1;i>OrdersHistoryTotal()-2;i--)//many
//for(int i=OrdersHistoryTotal();i==OrdersHistoryTotal();i--) // not working
//for(int i=0; i<=OrdersHistoryTotal();i++)//many (as last lot)
//for(int i=2; i>=0;i--)
//for(int i=OrdersHistoryTotal();i>OrdersHistoryTotal()-1;i--)// not working




رد مع اقتباس