[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 241

 
artmedia70:

You have already been told what the reason is. The point is not i++ or i-- but rather in what end of the list we should start to delete orders from - the beginning of the list (as you did) or from the end of the list (as you must do in this case).

To understand what happens when orders are deleted, you need to know and understand how the orders are stored in the array.

When you delete the first order first (it is indexed by i=0), the indexes of all orders are shifted in the array - the first order becomes null, the second order becomes first, the third - second, and so on. This is why all the orders are not completely removed - in fact, when i becomes 6, the sixth order is shifted to the fifth position in the array of orders and the order is not selected by index 6.

When you delete orders from the end of the list, the shift will not happen - the first order has a zero position in the list, and it will continue to have it. The 10th order had position 9, it was deleted, then the 9th order, which has a position 8 in the list is deleted, and so on, until the first order with a position zero in the array of orders.

A BIG THANK YOU to artmedia70 for their comprehensive reply, just thank you to ilunga ... and to nadya for her participation too ... best wishes ...
 
Please advise, I have set up the multicurrency tool to work with several currencies from one window. But the problem is that switching between currencies is so fast that there is no time to open an order. Within 3 minutes, 4 orders + 4 pending orders have been opened. And there was a lot of switching between currencies.
 
volshebnik:
What's better and what? )
Making unique names and remembering them. I don't know your task, maybe you don't need to.
 
forexnew:
Please advise, I have set up the multicurrency tool to work with several currencies from one window. But the problem is that switching between currencies is so fast that there is no time to open an order. Within 3 minutes, 4 orders + 4 pending orders have opened. And there was a lot of switching between currencies.

http://vinin.ucoz.ru/forum/11
 

there are 2 user modifications Mod_1 and Mod_2

both have modification condition:

double TS;
int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);

if (TS < Min_Dist)
TS=Min_Dist;

How to change it so the modification doesn't go through with a stop loss condition, for buy stop loss is less than trailing stop,

and for sell, stop loss is bigger than trailing stop

 

Hello.

Please help me to find a bug.

The code below doesn't work on the tester, while there is no such problem on the demo. There is no error in the logbook.

Thanks in advance.

  //====================== Отлавливаем прибыль по рынку ===========================================
  if (RinProfit) {
    if(SchBuyLots>0 || SchBuyLots777>0)
     {
      if((SchSellStop_b(MAGIC)>0 && (maM_fast<maM_slow || maH_fast<maH_slow || maOtk_fast<maOtk_slow)) ||
         (SchSellStop_b(MAGIC)>0 && (speedup_H1_ff<(10000+H1_MA_factor_ff) || speedup_H1_ss<(10000+H1_MA_factor_ss) ||
                                     speedup_M15_ff<(10000+M15_MA_factor_ff) || speedup_M15_ss<(10000+M15_MA_factor_ss))) ||
         (SchSellStop_b(MAGIC)>0 && ((maHXX<=H1_point_min  && speedup_H1_ss<(10000+H1_MA_factor_ss)) || maHXX>=H1_point_max)) ||
         (SchSellStop_b(MAGIC)>0 && Fractal_fibo_buy>Fibo_prohibit) ||
         (SchSellStop_b(MAGIC)>0 && TF1S>0 && TF2S>0 && timf1s!=0 && timf2s!=0 && TF1S<TF2S) ||
         (SchSellStop_b(MAGIC)>0 && TF1S>0 && TF2S>0 && timf1s!=0 && timf2s!=0 && TF1S>=TF2S && Bid<price_S))
       {
        while (SchBuyLots+SchBuyLots777>0 && SchSellLots+SchSellLots777>0)
         {
          CloseVstrechnye(MAGIC);
          return (0);
         }
        CloseAll_bMAGIC(Proskalz, MAGIC);
        CloseAll777_b(Proskalz);
        DeleteOtlozhMAGIC(MAGIC);
        DeleteOtlozh777();
        Alert("Позиции Buy закрыты согласно рыночной ситуации.");
        RefreshRates();
        if (Timeout_Trade>0 && ProfHist<=0)
         {
          Comment (SMB,": ТАЙМАУТ ТОРГОВЛИ "); 
          Sleep (Timeout_Trade*60000);
         } 
        RefreshRates();
       }
    }
    if(SchSellLots>0 || SchSellLots777>0)
     {
      if((SchBuyStop_b(MAGIC)>0 && (maM_fast>maM_slow || maH_fast>maH_slow || maOtk_fast>maOtk_slow)) ||
         (SchBuyStop_b(MAGIC)>0 && (speedup_H1_ff>(10000-H1_MA_factor_ff) || speedup_H1_ss>(10000-H1_MA_factor_ss) ||
                                    speedup_M15_ff>(10000-M15_MA_factor_ff) || speedup_M15_ss>(10000-M15_MA_factor_ss))) ||
         (SchBuyStop_b(MAGIC)>0 && ((maHXX<=H1_point_min  && speedup_H1_ss>(10000-H1_MA_factor_ss)) || maHXX>=H1_point_max)) ||
         (SchBuyStop_b(MAGIC)>0 && Fractal_fibo_sell>Fibo_prohibit) ||
         (SchBuyStop_b(MAGIC)>0 && TF1B>0 && TF2B>0 && timf1b!=0 && timf2b!=0 && TF1B>TF2B) ||
         (SchBuyStop_b(MAGIC)>0 && TF1B>0 && TF2B>0 && timf1b!=0 && timf2b!=0 && TF1B<=TF2B && Bid>price_B))
       {
        while (SchBuyLots+SchBuyLots777>0 && SchSellLots+SchSellLots777>0)
         {
          CloseVstrechnye(MAGIC);
          return (0);
         }
        CloseAll_bMAGIC(Proskalz, MAGIC);
        CloseAll777_b(Proskalz);
        DeleteOtlozhMAGIC(MAGIC);
        DeleteOtlozh777();
        Alert("Позиции Sell закрыты согласно рыночной ситуации.");
        RefreshRates();
        if (Timeout_Trade>0 && ProfHist<=0)
         {
          Comment (SMB,": ТАЙМАУТ ТОРГОВЛИ "); 
          Sleep (Timeout_Trade*60000);
         } 
        RefreshRates();
       }
     } 
   }
  //===============================================================================================  
 

What is the difference between calling functions from dll in MT4 and MT5? I compile dll, it works fine in MT5, but in MT4 it gives me error:

2011.10.06 23:00:34 Solaris executor EURUSDm,M1: cannot call function 'InfoOfTrading' from dll 'Solaris.dll'(error 127)

What the hell is this? - I`ve been racking my brains. :(

 
make a Win32 dll project
 
sergeev:
make a Win32 dll project
But it works fine in MT5!
 

I will continue with my above question.

I have also used the above code in another EA. The situation with that EA was similar to that described above with the difference that the code conditions were fulfilled exactly the other way around (in the demo, again, everything was working without errors). But one day the tester worked correctly and the code was working properly according to the conditions given to it.

It's a real mysticism.

Also, for some reason optimization sometimes fails to work for me. Sometimes it recalculates something but resets all results to zero for some reason. It happens so on terminals of different brokers. However, when all the stars and constellations in the sky probably converge, everything starts working as it should.

Reason: