MetaTrader 5 build 2121: New design of the Strategy Tester - page 6

 
//+------------------------------------------------------------------+
//| СТИЛЬ И ДРЕВНЕЕ ФОРМАТИРОВАНИЕ МЕТАQUOTES                        |
//+------------------------------------------------------------------+
void OrderEntry(int direction)
  {
   if(direction==0 && tradenow==1 && cFunctions.TotalVolume(Ativo,0)<fatorMaxTrade && 
      flotbuy<=lotemaxtrade && flotbuy<=MaxLot && cFunctions.CheckMoneyForTrade(Ativo,flotbuy,ORDER_TYPE_BUY))
     {
      tradenow=0;
      if(TakeProfit>0){btp=Ask+(TakeProfit*Point());}else{btp=0;}
      if(StopLoss>0){bsl=Ask-(StopLoss*Point());}else{bsl=0;}
      if(trade.Buy(flotbuy,Ativo,Ask,bsl,btp,Commentt)){lastpriceBid=Ask;}
      flotbuy=NormalizeDouble(flotbuy*FatorMartingale,digitoslote);
     }

   if(direction==1 && tradenow==1 && cFunctions.TotalVolume(Ativo,1)<fatorMaxTrade &&
      flotsell<=lotemaxtrade && flotsell<=MaxLot && cFunctions.CheckMoneyForTrade(Ativo,flotsell,ORDER_TYPE_SELL))
     {
      tradenow=0;
      if(TakeProfit>0){stp=Bid-(TakeProfit*Point());}else{stp=0;}
      if(StopLoss>0){ssl=Bid+(StopLoss*Point());}else{ssl=0;}
      if(trade.Sell(flotsell,Ativo,Bid,ssl,stp,Commentt)){lastpriceAsk=Bid;}
      flotsell=NormalizeDouble(flotsell*FatorMartingale,digitoslote);
     }
  }


//+------------------------------------------------------------------+
//| СТИЛЬ И НОВОЕ ФОРМАТИРОВАНИЕ МЕТАQUOTES                          |
//+------------------------------------------------------------------+
void OrderEntry(int direction)
  {
   if(direction==0 && tradenow==1 && cFunctions.TotalVolume(Ativo,0)<fatorMaxTrade &&
      flotbuy<=lotemaxtrade && flotbuy<=MaxLot && cFunctions.CheckMoneyForTrade(Ativo,flotbuy,ORDER_TYPE_BUY))
     {
      tradenow=0;
      if(TakeProfit>0)
        {
         btp=Ask+(TakeProfit*Point());
        }
      else
        {
         btp=0;
        }
      if(StopLoss>0)
        {
         bsl=Ask-(StopLoss*Point());
        }
      else
        {
         bsl=0;
        }
      if(trade.Buy(flotbuy,Ativo,Ask,bsl,btp,Commentt))
        {
         lastpriceBid=Ask;
        }
      flotbuy=NormalizeDouble(flotbuy*FatorMartingale,digitoslote);
     }

   if(direction==1 && tradenow==1 && cFunctions.TotalVolume(Ativo,1)<fatorMaxTrade &&
      flotsell<=lotemaxtrade && flotsell<=MaxLot && cFunctions.CheckMoneyForTrade(Ativo,flotsell,ORDER_TYPE_SELL))
     {
      tradenow=0;
      if(TakeProfit>0)
        {
         stp=Bid-(TakeProfit*Point());
        }
      else
        {
         stp=0;
        }
      if(StopLoss>0)
        {
         ssl=Bid+(StopLoss*Point());
        }
      else
        {
         ssl=0;
        }
      if(trade.Sell(flotsell,Ativo,Bid,ssl,stp,Commentt))
        {
         lastpriceAsk=Bid;
        }
      flotsell=NormalizeDouble(flotsell*FatorMartingale,digitoslote);
     }
  }

Please bring back the old METAQUOTES style or at least make sure that the codes written on one line are not formatted.

Example:

Старая модель и я считаю ее идеальной моделью для однострочных кодов.

      if(TakeProfit>0){btp=Ask+(TakeProfit*Point());}else{btp=0;}
      if(StopLoss>0){bsl=Ask-(StopLoss*Point());}else{bsl=0;}



Новый стиль, который портит всех моих роботов.

      if(TakeProfit>0)
        {
         btp=Ask+(TakeProfit*Point());
        }
      else
        {
         btp=0;
        }
      if(StopLoss>0)
        {
         bsl=Ask-(StopLoss*Point());
        }
      else
        {
         bsl=0;
        }
 
Joao Luiz Sa Marchioro:

Please revert to the old METAQUOTES style or at least make sure that the codes written in one line are not formatted.

use the Pico style, it's very similar to what you're looking for

but the Pico style splits the if - else statement on two lines if you use { }

Your code where using { }

if(TakeProfit > 0) btp = Ask + (TakeProfit * Point());}
else {btp = 0;}

if not using { }

if(TakeProfit > 0) btp = Ask + (TakeProfit * Point()); else btp = 0;
 

2133 Here's a gimmick like this


 
Igor Makanu:

use the Pico style, it's very similar to what you're looking for

but the Pico style splits the if - else statement into 2 lines if you use { }

Your code where using { }

if not using { }

Yes !!! did a full analysis of the available styles and chose PICO and RATLIFF

PICO is the most compact.

RATLIFF is the smartest.

But it is absurd for METAQUOTES to change a style that has been used for years. It would disrupt the lives of all users. An irresponsible change. A few months ago I messed up something about their style, I thought it was wrong to move despite the small changes, but now they have messed up.

 
Vladimir Pastushak:

2133 uma piada


Yes !!! we know it's a beta version, but if something was correct in the old versions and has now changed in the beta version, it's probably with these changes. Better complain now to make sure everything is going right

 
There are two suggestions that I would like METAQUOTES to adopt.
1) Put a lock on the graph to prevent the used graph from closing along with unnecessary graphs when using CTRL-F4.

2) Allow the user to define the number of cores to use on the cloud network. For example: I could limit use to 50 cores in CLOUD NETWORK just to help and increase optimization speed along with the 100 cores I already have on my servers. This way I would not have to buy one or two more servers.

Currently, I cannot use CLOUD NETWORK because it makes my servers useless and the value of the optimization becomes high.
 
After running a test with a third-party config, the default config is reset. There are no test settings when the terminal is started normally.
 
MetaQuotes Software Corp.:

The documentation is obsolete in this case.

For the sake of efficiency, strings are now preallocated larger than requested, as in the vast majority of cases they are ramped up by subsequent operations.

This is now clear.
But no matter how I change the string length, the StringBufferLen result always stays 260.

string str; 
StringInit(str, 1, '_'); 
Print("str = ", str); 
Print("str = ", str, ": StringBufferLen(str) = ", StringBufferLen(str));
2019.09.03 03:30:47.490 Test    str = _
2019.09.03 03:30:47.490 Test    str = _: StringBufferLen(str) = 260


string str; 
StringInit(str,100,'_'); 
Print("str = ",str); 
Print("str = ",str,": StringBufferLen(str) = ", StringBufferLen(str));
2019.09.03 03:32:57.789 Test    str = ____________________________________________________________________________________________________
2019.09.03 03:32:57.789 Test    str = ____________________________________________________________________________________________________: StringBufferLen(str) = 260
 
MetaQuotes Software Corp.:

The documentation is out of date in this case.

For the sake of efficiency, the strings are now preallocated larger than requested, since in the vast majority of cases they are incremented by subsequent operations.

Is it possible in this case

void OnStart() 
{ 
        string s1; 
        StringInit(s1,100,'_'); 
        const string s2 = s1;
        Print( StringBufferLen( s2 ));
}

s2 can increase in the future?

Result: 260

Expected: 100 or 0.

 

I added StringLen to the test, and initialized the string differently.
In documentation it is one thing, but in fact it behaves differently.
And buffer in this case shows 0 instead of 260.
So, either there is a problem with string initialization. Or StringBufferLen is failing.

 string str = "_"; 

 Print("str = ", str);
 Print("str = ", str, ": StringBufferLen(str) = ", StringBufferLen(str), " StringLen(str) = ", StringLen(str)); 
   
 str = "__________";  

 Print("str = ", str, ": StringBufferLen(str) = ", StringBufferLen(str), " StringLen(str) = ", StringLen(str));
2019.09.03 03:55:45.145 Test    str = _
2019.09.03 03:55:45.145 Test    str = _: StringBufferLen(str) = 0 StringLen(str) = 1
2019.09.03 03:55:45.145 Test    str = __________: StringBufferLen(str) = 0 StringLen(str) = 10