النتائج 1 إلى 3 من 3
  1. #1
    الصورة الرمزية Point
    Point غير متواجد حالياً عضو المتداول العربي
    تاريخ التسجيل
    Feb 2020
    الإقامة
    تركيا
    المشاركات
    8

    افتراضي كود برمجي في حال تفعل شرط يتوقف الاخر

    السلام عليكم ورحمة الله وبركاته
    عساكم بخير يا كرام هذا أول طلب لي في هذه المنتدى الطيب , أحتاج كود برمجي في حال تفعل عندي شرط يتوقف الشرط الاخر ولايعمل حتى ينتهي هذه الشرط
    مثلا اكسبرت مضاعفات الشرط الاول الصفقات الاولى
    كود PHP:
      //+-------------------+
          //الصفقة الاولى رقمي
          
    if(orderscnt(OP_BUY)==&& totalBuyLots==0)
            {
             
    open(OP_BUY,Lot,Ask,TP,StopLoss,MG);
             
    ProfitLine(OP_BUY);

            }
          
    //الصفقة الاولى رقمي
          
    if(orderscnt(OP_SELL)==&& totalSellLots==0)
            {
             
    open(OP_SELL,Lot,Bid,TP,StopLoss,MagicNumber) ;
             
    ProfitLine(OP_SELL);

            }


          
    //+------------------------+ 
    من ثم الشرط الثاني المضاعفات
    كود PHP:
          if(orderscnt(OP_BUY)>1)
             
    ModifyOrders(OP_BUY);
          
    ProfitLine(OP_BUY);
          if(
    orderscnt(OP_SELL)>1)
             
    ModifyOrders(OP_SELL);
          
    ProfitLine(OP_SELL);

          if(
    orderscnt(OP_SELL)>=&& orderscnt(OP_SELL)<MaxTrades)
            {
             
    LastLot=LastCurrentOrderInfo("Lots",OP_SELL);
             
    LotxMathPow(MultMathorderscnt(OP_SELL));

             if(
    MultiplierMode == Normal)
                
    newLotNormalizeDouble(Lot Lotx,Lot_Digits);
             if(
    MultiplierMode == FiboMulti)
                
    newLot=LastLot(OP_SELL,MagicNumber,1)+LastLot(OP_SELL,MagicNumber,2);
             if(
    MultiplierMode == IncrementMulti)
                
    newLot=LastLot+LotIncrement;

             if(
    newLot <= MaxLots&&Bid>=LastCurrentOrderInfo("Price",OP_SELL)+Step*px+StepPlus*(orderscnt(OP_SELL)-1)*px && TimeCurrent()-LastCurrentOrderInfo("Time",OP_SELL)>=MinutesBetweenOrders*60)
               {
                
    ticket=OrderSend(Symbol(),OP_SELL,newLot,NormalizeDouble(Bid,digits),Slippage*Q,0,0,InitialComment+MG,MG,0,Red);
                
    ProfitLine(OP_BUY);
               }
            } 
    // مضاعفات البيع

          
    if(orderscnt(OP_BUY)>=&& orderscnt(OP_BUY)<MaxTrades)
            {
             
    LastLot=LastCurrentOrderInfo("Lots",OP_BUY);
             
    LotxMathPow(MultMathorderscnt(OP_BUY));

             if(
    MultiplierMode == Normal)
                
    newLotNormalizeDouble(Lot Lotx,Lot_Digits);
             if(
    MultiplierMode == FiboMulti)
                
    newLot=LastLot(OP_BUY,MagicNumber,1)+LastLot(OP_BUY,MagicNumber,2);
             if(
    MultiplierMode == IncrementMulti)
                
    newLot=LastLot+LotIncrement;

             if(
    newLot <= MaxLots&&Ask<=LastCurrentOrderInfo("Price",OP_BUY)-Step*px-StepPlus*(orderscnt(OP_BUY)-1)*px && TimeCurrent()-LastCurrentOrderInfo("Time",OP_BUY)>=MinutesBetweenOrders*60)
               {
                
    ticket=OrderSend(Symbol(),OP_BUY,newLot,NormalizeDouble(Ask,digits),Slippage*Q,0,0,InitialComment+MG,MG,0,Blue);
                
    ProfitLine(OP_SELL);
               }
            } 
    // مضاعفات الشراء 
    هنا لو أردت أن أضع شرط اخر مثلا هذا

    كود PHP:
       if(UseRsi && ContinueTrade == true)
         {
          if((
    RsiMode == Booth && orderscnt(OP_BUY)==0) || (RsiMode != RSISELL &&  orderscnt(OP_BUY)==&& orderscnt(OP_SELL)==0))
            {
             if(
    time==true&&rsi_1<=Level_buy&&T_2!=Time[0]&&LastOrderCloseTime()<Time[0])
               {
                if(
    orderscnt(OP_BUY)<&& ((!DiffFromOpenCandle && ((Ask>=BuyPrice && Ask<=BuyPrice+2*px) || !UsePriceFilter)) ||
                                           (
    DiffFromOpenCandle && Ask<=Open[0]-DiffInPoints*px)))
                  {
                   
    open(OP_BUY,Lot,Ask,TakeProfit,StopLoss,MagicNumber);
                   
    ProfitLine(OP_BUY);
                   
    T_2=Time[0];
                  }
               }
            }
          
    /////////////////////
          
    if((RsiMode == Booth && orderscnt(OP_SELL)==0) || (RsiMode != RSIBUY &&  orderscnt(OP_BUY)==&& orderscnt(OP_SELL)==0))
            {
             if(
    time==true&&rsi_1>=Level_sell&& T_1!=Time[0]&&LastOrderCloseTime()<Time[0])
               {
                if(
    orderscnt(OP_SELL)<&& ((!DiffFromOpenCandle && ((Bid>=SellPrice && Bid<=SellPrice+2*px) || !UsePriceFilter)) ||
                                            (
    DiffFromOpenCandle && Bid>=Open[0]+DiffInPoints*px)))
                  {
                   
    open(OP_SELL,Lot,Bid,TakeProfit,StopLoss,MagicNumber) ;
                   
    ProfitLine(OP_SELL);
                   
    T_1=Time[0];

                  }
               } 
    // Rsi Setting
            
    // RsiHidg
         
    //UseRsi 
    اريد عندما يتحقق هذا الشرط يتوقف شرط المضاعفات ولا يتحقق بمجرد ان يتم اغلاق صفقة من هذا الشرط , اريد ان يتحقق بعد ان يتم انتهاء هذا الشرط تماما او يتم اغلاق جميع الصفقات الخاصة به
    أرجو أن يكون الطلب واضح .

  2. #2
    الصورة الرمزية MR.dollar
    MR.dollar غير متواجد حالياً مشرف المتداول العربي
    تاريخ التسجيل
    Jun 2009
    الإقامة
    مصر
    المشاركات
    13,851

    افتراضي

    اقتباس المشاركة الأصلية كتبت بواسطة Point مشاهدة المشاركة
    السلام عليكم ورحمة الله وبركاته
    عساكم بخير يا كرام هذا أول طلب لي في هذه المنتدى الطيب , أحتاج كود برمجي في حال تفعل عندي شرط يتوقف الشرط الاخر ولايعمل حتى ينتهي هذه الشرط
    مثلا اكسبرت مضاعفات الشرط الاول الصفقات الاولى
    كود PHP:
      //+-------------------+
          //الصفقة الاولى رقمي
          
    if(orderscnt(OP_BUY)==&& totalBuyLots==0)
            {
             
    open(OP_BUY,Lot,Ask,TP,StopLoss,MG);
             
    ProfitLine(OP_BUY);
     
            }
          
    //الصفقة الاولى رقمي
          
    if(orderscnt(OP_SELL)==&& totalSellLots==0)
            {
             
    open(OP_SELL,Lot,Bid,TP,StopLoss,MagicNumber) ;
             
    ProfitLine(OP_SELL);
     
            }
     
     
          
    //+------------------------+ 
    من ثم الشرط الثاني المضاعفات
    كود PHP:
          if(orderscnt(OP_BUY)>1)
             
    ModifyOrders(OP_BUY);
          
    ProfitLine(OP_BUY);
          if(
    orderscnt(OP_SELL)>1)
             
    ModifyOrders(OP_SELL);
          
    ProfitLine(OP_SELL);
     
          if(
    orderscnt(OP_SELL)>=&& orderscnt(OP_SELL)<MaxTrades)
            {
             
    LastLot=LastCurrentOrderInfo("Lots",OP_SELL);
             
    LotxMathPow(MultMathorderscnt(OP_SELL));
     
             if(
    MultiplierMode == Normal)
                
    newLotNormalizeDouble(Lot Lotx,Lot_Digits);
             if(
    MultiplierMode == FiboMulti)
                
    newLot=LastLot(OP_SELL,MagicNumber,1)+LastLot(OP_SELL,MagicNumber,2);
             if(
    MultiplierMode == IncrementMulti)
                
    newLot=LastLot+LotIncrement;
     
             if(
    newLot <= MaxLots&&Bid>=LastCurrentOrderInfo("Price",OP_SELL)+Step*px+StepPlus*(orderscnt(OP_SELL)-1)*px && TimeCurrent()-LastCurrentOrderInfo("Time",OP_SELL)>=MinutesBetweenOrders*60)
               {
                
    ticket=OrderSend(Symbol(),OP_SELL,newLot,NormalizeDouble(Bid,digits),Slippage*Q,0,0,InitialComment+MG,MG,0,Red);
                
    ProfitLine(OP_BUY);
               }
            } 
    // مضاعفات البيع
     
          
    if(orderscnt(OP_BUY)>=&& orderscnt(OP_BUY)<MaxTrades)
            {
             
    LastLot=LastCurrentOrderInfo("Lots",OP_BUY);
             
    LotxMathPow(MultMathorderscnt(OP_BUY));
     
             if(
    MultiplierMode == Normal)
                
    newLotNormalizeDouble(Lot Lotx,Lot_Digits);
             if(
    MultiplierMode == FiboMulti)
                
    newLot=LastLot(OP_BUY,MagicNumber,1)+LastLot(OP_BUY,MagicNumber,2);
             if(
    MultiplierMode == IncrementMulti)
                
    newLot=LastLot+LotIncrement;
     
             if(
    newLot <= MaxLots&&Ask<=LastCurrentOrderInfo("Price",OP_BUY)-Step*px-StepPlus*(orderscnt(OP_BUY)-1)*px && TimeCurrent()-LastCurrentOrderInfo("Time",OP_BUY)>=MinutesBetweenOrders*60)
               {
                
    ticket=OrderSend(Symbol(),OP_BUY,newLot,NormalizeDouble(Ask,digits),Slippage*Q,0,0,InitialComment+MG,MG,0,Blue);
                
    ProfitLine(OP_SELL);
               }
            } 
    // مضاعفات الشراء 
    هنا لو أردت أن أضع شرط اخر مثلا هذا

    كود PHP:
       if(UseRsi && ContinueTrade == true)
         {
          if((
    RsiMode == Booth && orderscnt(OP_BUY)==0) || (RsiMode != RSISELL &&  orderscnt(OP_BUY)==&& orderscnt(OP_SELL)==0))
            {
             if(
    time==true&&rsi_1<=Level_buy&&T_2!=Time[0]&&LastOrderCloseTime()<Time[0])
               {
                if(
    orderscnt(OP_BUY)<&& ((!DiffFromOpenCandle && ((Ask>=BuyPrice && Ask<=BuyPrice+2*px) || !UsePriceFilter)) ||
                                           (
    DiffFromOpenCandle && Ask<=Open[0]-DiffInPoints*px)))
                  {
                   
    open(OP_BUY,Lot,Ask,TakeProfit,StopLoss,MagicNumber);
                   
    ProfitLine(OP_BUY);
                   
    T_2=Time[0];
                  }
               }
            }
          
    /////////////////////
          
    if((RsiMode == Booth && orderscnt(OP_SELL)==0) || (RsiMode != RSIBUY &&  orderscnt(OP_BUY)==&& orderscnt(OP_SELL)==0))
            {
             if(
    time==true&&rsi_1>=Level_sell&& T_1!=Time[0]&&LastOrderCloseTime()<Time[0])
               {
                if(
    orderscnt(OP_SELL)<&& ((!DiffFromOpenCandle && ((Bid>=SellPrice && Bid<=SellPrice+2*px) || !UsePriceFilter)) ||
                                            (
    DiffFromOpenCandle && Bid>=Open[0]+DiffInPoints*px)))
                  {
                   
    open(OP_SELL,Lot,Bid,TakeProfit,StopLoss,MagicNumber) ;
                   
    ProfitLine(OP_SELL);
                   
    T_1=Time[0];
     
                  }
               } 
    // Rsi Setting
            
    // RsiHidg
         
    //UseRsi 
    اريد عندما يتحقق هذا الشرط يتوقف شرط المضاعفات ولا يتحقق بمجرد ان يتم اغلاق صفقة من هذا الشرط , اريد ان يتحقق بعد ان يتم انتهاء هذا الشرط تماما او يتم اغلاق جميع الصفقات الخاصة به
    أرجو أن يكون الطلب واضح .
    وعليكم السلام ورحمة الله وبركاته
    يمكنك وضع متغير من نوع bool بحيث عندما يتحقق الشرط الثاني تصبح قيمته true ثم تضع في شرط المضاعفات أن قيمة المتغير يجب أن تكون false حتى تعمل المضاعفات
    توقيع العضو
    بناء أنظمة تداول آلي ويدوي لفحص سوق العملات ودمجها مع التحليل الفني لإتخاذ القرارات

  3. #3
    الصورة الرمزية Point
    Point غير متواجد حالياً عضو المتداول العربي
    تاريخ التسجيل
    Feb 2020
    الإقامة
    تركيا
    المشاركات
    8

    افتراضي

    يا هلا والله بالطيب أسعدتني حروفك بتواجدها في سؤالي
    أخي الحبيب هذا الحل قمت بتجربته ولكن لايحل المشكلة والسبب كالآتي

    مثلا هذا الكود
    كود:
    if(totalBuyLots >= startfix && orderscnt(OP_SELL)==0)
            {
    
             newLot=NormalizeDouble(totalBuyLots-fix,Lot_Digits);
             if(orderscnt(OP_BUY)==2)
               {
                newLot=totalBuyLots/2;
               }
             open(OP_SELL,newLot,Bid,0,SL,MG) ;
    
            }
    عندما تتجاوز لوتات الشراء الحد المسوح يعطي امر بيع ولو وضعت ال bool ستتوقف المضاعفات ولكن عند اغلاق اي صفقة ولو بقيمة 0.01 سيتم تفعيل المضاعفات وبهذه الحالة سيعود يتفعل الشرط لأن لوتات الشراء عادة للتتجاوز الحد وبهذه الحالة سأدخل بدوامة

    أنا حللت المشكلة ولكن كتبت هذا للفائدة لمن يريد التعلم
    الحل بكتابة شرط على المضاعفات انها لاتتفعل في حالة تجاوز الحد .

    ولكن الان في مشكلة اخرى وهي اريد حل لعدم نكرار الصفقة التي بدون شروط حتى تضرب التيك بروفيت وبدون تعارض مع الشروط الاخرى

    كود:
     if(totalBuyLots > totalSellLots && totalBuyLots > startfix)
            {
             //mine=totalBuyLots-totalSellLots;
            // newLot=mine/2;
             open(OP_SELL,0.01,Bid,TP,SL,MG) ;
             ProfitLine(OP_SELL);
            }


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17