A suggestion for the ease of use of the MetaEditor

 

Hello, I would like to suggest developers to standardize indents in MetaEditor when writing code, as it is done in VisualStudio. Because there is no standard indentation in functions and blocks. As a result, the code is less readable. Also when copying and pasting the code, it is inserted askew, some lines are left and some are right. Can you please fix it. And to be able to button normalize all code by indents automatically, it's also implemented in VisualStudio

 
Fresto:

Hello, I would like to suggest developers to standardize indents in MetaEditor when writing code, as it is done in VisualStudio. Because there is no standard indentation in functions and blocks. As a result, the code is less readable. Also when copying and pasting the code, it is inserted askew, some lines are left and some are right. Can you please fix it. And to be able to button normalize all the code on the indentation automatically, it is also implemented in VisualStudio


To make code readable, use styler:Styler - Work with Source Code - Program Development - MetaEditor

Стилизатор - Работа с исходным кодом - Разработка программ - Справка по MetaEditor
Стилизатор - Работа с исходным кодом - Разработка программ - Справка по MetaEditor
  • www.metatrader5.com
Данная функция предназначена для оформления исходного кода в соответствии с рекомендуемым стандартом. Это позволяет сделать код более читаемым...
 

Standardised. Use the code styler (Ctrl+,).

 
Did not notice this function) Thought the right mouse button should be) Thank you)

P.s. How easy it is to make everything beautiful now, and I was struggling and added spaces, got used to automatically write beautifully at once, etc.
 
Ihor Herasko:

Standardised. Use the code styler (Ctrl+,).


The code styler has one codestyle, a la K&R, which most programmers are steadily sick of. I have FormatMQL project in VS, make links to sources, which I'm going to use tightly and reformat into human MS Style.

 

Great topic! I would also like to suggest MQLEditor as close as possible to Sublime Text 3.:) Really miss getting - block commenting, block indent control at once by key combination. See side highlighting of code "architecture", etc.

 
Alexey Volchanskiy:

The styler has one codestyle, a la K&R, which most programmers are steadily sick of. I have FormatMQL project in VS, I link to sources I'm going to use tightly and reformat them to human MS Style.

Nothing like that - I write in two different environments with two different formatting styles - not nauseating.

So don't make it up, just get used to it.

 
Rashid Umarov:

Not at all - I write in two different environments with two different formatting styles - not nauseating.

So don't make it up, just get used to it.

Naturally, after all, you are an employee of the company. It would be nice to have a choice of codestyle in the editor. I don't want to get used to it.
 
Mikhail Kontsevoy:

What's missing is a keyboard shortcut to get - block commenting, block indent control.

Look in the Edit -> Advanced menu

 

Yes, MQ's style is a problem. But convincing them to do at least an adjustment is impossible. This problem is already 10 years old.

Forum on trading, automated trading systems and strategy testing

What a style! :)

Sergey Kravchuk, 2009.11.24 11:27

Prehistory: Over many years of coding I developed "my" style of text formatting(here). My texts have been authomatic already for a long time and I have to use Astyle only when I start working with some "alien" text.

I can explain why I format my texts this way: the number of tabs (shifting to the right deep into the text) corresponds to the nesting level. Each opening { starts a new level, so it's on a separate line with the same indentation as the previous text, and all text after it is indented to the right. Each closing } takes the text back one tab. This makes it easy to find paired brackets (they should be in the same position vertically and the number of times the Tab key is pressed corresponds to the nesting level of the text. The internal + - > < < are punctuated with spaces, so that the text doesn't blend into a solid mush. To me, this makes sense and makes sense.


Here is the story: Yesterday I received source code of ml5 with some strange (from my point of view) formatting: curly brackets moved to the right in the text for 2 positions, and text inside them is also moved to the right, but only for one position. I tried to use tabulator to get to the same position where there is an opening { in order to put a closing } - did not work.

Can someone (maybe the developers themselves) explain the logic of Metaeditor5 formatting?

Here is a piece of code from MACD Sample.mq5 in their way and in my way:

Styler5                                  -|- Мой стиль
-------                                  -|- ---------
bool CSampleExpert:: LongModified()       -|- bool CSampleExpert:: LongModified()
  {                                      -|- {  
   bool res=false;                       -|-   bool res = false;
//--- check for trailing stop            -|-   //--- check for trailing stop
   if( InpTrailingStop>0)                 -|-   if ( InpTrailingStop > 0)
     {                                   -|-   { 
      if( m_symbol.Bid()- m_position. Price -|-     if ( m_symbol.Bid() - m_position. Pric
        {                                -|-     {
         if( m_position. StopLoss()< m_symb -|-       if ( m_position. StopLoss() < m_symb
           {                             -|-       {
            double sl= m_symbol.Bid()- m_a -|-         double sl = m_symbol.Bid() - m_a
            double tp= m_position. TakePro -|-         double tp = m_position. TakeProfi
            //--- modify position        -|-         //--- modify position
            if( m_trade. PositionModify( Sy -|-         if ( m_trade. PositionModify( Symbo
               printf("Long position by  -|-           printf(" Long position by % s to
            else                         -|-         else
              {                          -|-         {
               printf("Error modifying p -|-           printf(" Error modifying positi
               printf("Modify parameters -|-           printf(" Modify parameters : SL
              }                          -|-         }
            //--- modified and must exit -|-         //--- modified and must exit fro
            res=true;                    -|-         res = true;
           }                             -|-       }
        }                                -|-     }
     }                                   -|-   } 
//---                                    -|-   //---
   return( res);                          -|-   return( res);
  }                                      -|- }

And further.

Forum on trading, automated trading systems and strategy testing

Styler in MetaTrader 5

Combinator, 2009.11.24 14:10

Discuss the MQL5 styler. Started here


I have to look at different code. Including a poorly written one.

Good formatting considerably eases code reading.


Therefore, imho, the thing will remain unclaimed by the majority of normal coders due to specific formatting and lack of options.

I suggest to either add customization or format in a really common style.

As an option -- make it possible to choose one of 2 or 3 styles.


 
Stanislav Korotky:

Yes, MQ's style is a problem. But convincing them to do at least an adjustment is impossible. This problem is now 10 years old.

And further.

The difference is not significant, but the formatting style of MQ is undeniably better.

Reason: