[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 311

 

Question about the operation of the tester: Afterrunning a test, you change the parameters (dates, currency pair, timeframe), re-run the test - it runs, but when it is over the information in the tabs like "chart" and "report" does not change at all - everything remains from the previous test. The saved report also turns out to be old. What is the reason and how to fix it? Maybe there is some function to reset the results?

I've read the manual, articles, searched the forum - I haven't encountered any mentions of such a problem...

 

I think I need to use an external file to fix the krust indicator, I can't do it, I just can't figure out what's wrong.I think I'm getting a bit tired when I try to use an external file but I don't know what's wrong.

1) with the report

Who will help finish what he started with those will share the strategy (Indicator crunch only part of the strategy, but no less important). Real grad (can not for so long lucky, mowed down only our energetics and that not put a stop loop, until then, all goes on the rise and you see with what progress).

Files:
 
but here are the pieces of code
Files:
 

Can you tell me what's wrong? Four orders in a row modify normally, but on the fourth tick it starts to write OrderModify error 1.

After a trend reversal, the first order is fine, the second order modifies normally, but once again the same nonsense is written...

Normalization does not play a role.

I have been fighting for several days!

   for (x=0;x<OrT;x++)
   {
   if (OrderSelect(x,SELECT_BY_POS)==true)
    {
     if (OrderMagicNumber() == magic)
      {
       if (OrderType = OP_BUY)
       {
       shift = iBarShift(Symbol(),30,OrderOpenTime());                           //запомнил свечу открытия
        for (m=shift;m>=1;m--)
        if (High[m]-OrderOpenPrice() >= TS*Point)
        {
         if (OrderOpenPrice()+spread*Point != OrderStopLoss())
         {
          OrderModify(OrderTicket(),OrderOpenPrice(),                           //переводит SL в безубыток
          OrderOpenPrice()+spread*Point,OrderTakeProfit(),0,CLR_NONE);
          return;
         }
        }
       }
      }
     if (OrderMagicNumber() == magic)
     {
      if (OrderType = OP_SELL)
      {
       shift = iBarShift(Symbol(),30,OrderOpenTime());                           //запомнил свечу открытия
        for (m=shift;m>=1;m--)
        if (OrderOpenPrice()-Low[m] >= TS*Point)
        {
         if (OrderOpenPrice()-spread*Point != OrderStopLoss())
         {
           OrderModify(OrderTicket(),NormalizeDouble(OrderOpenPrice(),dig),     //переводит SL в безубыток
           NormalizeDouble(OrderOpenPrice()-spread*Point,dig),
           NormalizeDouble(OrderTakeProfit(),dig),0,CLR_NONE);
           return;
         }
        }
       } 
      }
    }
   }

Thank you in advance.

 
CYBOPOB:

Can you tell me what's wrong? Four orders in a row modify normally, but on the fourth tick it starts to write OrderModify error 1.

After a trend reversal, the first order is OK, the second one modifies it, but it again displays the same error...

The normalization does not play a role.

I have been struggling with this for several days!

Thank you in advance.

Either consider the rules yourself (when writing code), or use ready-made solutions where these rules are already taken into account.
 
CYBOPOB:

Can you tell me what's wrong? Four orders in a row modify normally, but on the fourth tick it starts to write OrderModify error 1.

After a trend reversal, the first order is fine, the second order modifies normally, but once again the same nonsense is written...

Normalization does not play a role.

I have been fighting for several days!

Thank you in advance.

Before modification, you have to check that the stop order parameter is not equal to the new stop. If they are equal, there is nothing to modify. Hence, error 1.
 

About sorting arrays.
I'm trying to sort two arrays: the first in ascending order(ArraySort(num_array);function), and the second according to the first one, so that if the fifth element in the first array comes first, then the second array will do the same (fifth element comes first).
If there is a MQL function for sorting arrays together, please give me the link.
Regards. Shurkin.

 
artmedia70:
Before modifying, you need to check that the stop order parameter is not equal to the new stop. If they are equal, there is nothing to modify. Hence, error 1.


Isn't that it?

if (OrderStopLoss() != OrderOpenPrice()-spread*Point)

Artem, don't consider it a problem, write the code, eh? Or give me that thing you have in your hand, I will finish this torment...

 
CYBOPOB:

Isn't that it?

Artem, don't consider it a problem, write the code, eh? Or give me that thing you have in your hand, I will finish this torment...


Not that. I told you:

Before modifying, you need to check that the stop order parameter is not equal to the new stop. If they are equal, there is nothing to modify. Hence error 1.

 

I have a question for the professionals. I want to make the function universal. The function counts how many bars of one characteristic (bullish or bearish, matching the size, maybe something else I add) follow each other and if there is a bar that does not correspond to this characteristic, i.e. pointed in another direction, the counter is reset.

Here is a code, where I am calculating in one of the variants. I.e. if the bars of one characteristic are going upwards, i.e. bullish.

int LastCandlesType(int trend)
{
   int cnt,                            // Счётчик идущих друг за другом свечей с требуемыми признаками

   for (int i=i_AnyBarsToHistory; i>=1; i--)
   {
      if ((Close[i] - Open[i]) >= i_sizeOfSequentialCorrectionBar * pt)     // Если бар соответствует требуемым признакам..
          cnt++;                                                                     // .. прибавим 1 к счётчику

      if (Close[i] < Open[i])                                                        // Если бар, не соответствует основному признаку..
          cnt = 0;                                                                   // .. счётчик обнуляем
      
/*      if (i == 1)
      Print("i = ", i,"; cnt = ", cnt);*/
   }

   if (cnt == 3)                                                                     // Если 5 баров вподряд бычьи..
    return (REQUIRED_SEQUENTIAL_CANDLE_GOT);                                         //..Выходим из функции
}

How to make it so that when passing trend parameter to this function, which will be responsible for passing the supposed main trend at the moment, the calculation is based on this parameter.

I.e., if trend == downward, the function in the loop was like now, and iftrend == upward, the Open[i] and Close[i] were swapped in the loop, so that the conditions were observed. Because in that case the close price of the bar will be lower than the open price and the difference will be minus.