Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1518

 
MrBrooklin #:

You seem to be confused. Here is a look and read carefully the comments to each line:

I hope everything will be clear now. As for the variable, I wrote to you in another thread that it can be called either position or m_position, etc. etc.

And please ask questions in this thread, it will be easier to get help.

Regards, Vladimir.

Yes, sorry, not CTrade, but CPositionInfo. But still you can't write instead of m_position position or " pos, posit, k_pos, k_position, etc. etc. " as you write. It is m_position (CPositionInfo m_position;) that is stuffed in the class.

 

You can write any name of the variable, the main thing is that further in the code it should have the same name. Example:

#include <Trade\PositionInfo.mqh>  // включим файл PositionInfo.mqh

CPositionInfo k_pos;               // объявим переменную, например, k_pos

// Далее в коде должны использовать только это название переменной

   for(int i=PositionsTotal()-1;i>=0;i--)
      if(k_pos.SelectByIndex(i)) // selects the position by index for further access to its properties
         if(k_pos.Symbol()==m_symbol.Name() && k_pos.Magic()==m_magic)
           {
            if(k_pos.PositionType()==POSITION_TYPE_BUY)
               buys=true;

            if(k_pos.PositionType()==POSITION_TYPE_SELL)
               sells=true;

            if(buys && sells)
               return;
           }

Any other questions?

Regards, Vladimir.

 
MrBrooklin #:
CPositionInfo k_pos;
Yes, there are no errors. Thank you. Valuable information.
 
MrBrooklin #:

You can write any name of the variable, the main thing is that further in the code it should have the same name. Example:

Any other questions?

Regards, Vladimir.

All these prefixes of variable names, for example "m_", mean belonging to a certain class, from the word "member" - a member of the class. That is, outside the class you don't have to add them to variable names - they are not members of the class, they are members of the programme. All the more so when they are global - there is another prefix here. For example, if you look at MetaQuotes sources, you will see that global variables are prefixed with the prefix "Ext" - external, external.... If you want to use some prefix to your global variables in the form of "letter_", then "g_" - from global.

 

Is the percentage of lost capital on the trail stop in the strategy tester taken into account as a minus to the drawdown?

i.e. if orders are closed with profit but not at the most favourable price, will the drawdown be higher or lower in this case?

Or does the drawdown only take into account the initial capital drawn down?

 
AkaEdie strategy tester counted as a minus to drawdown?

i.e. if orders are closed with profit but not at the most favourable price, will the drawdown be higher or lower in this case?

Or does the drawdown only take into account the initial capital drawn down?

The drawdown of balance and equity is taken into account from the maximum balance and from the maximum equity.

 
Sorry for the stupid question, what does equity mean in this case?
 
AkaEdie #:
Sorry for the stupid question, what does equity mean in this case?

Equity is an unrecorded financial result.

 

Thank you, but can anyone tell me how to take into account in this class

  1. only the maximum fixed profit
  2. minimum losses
  3. total maximum capital

https://www.mql5.com/ru/articles/286

or in other ways?

and also profit in the tester is calculated plus capital or only profit separately? what is the final figure I mean?

Создание собственных критериев оптимизации параметров эксперта
Создание собственных критериев оптимизации параметров эксперта
  • www.mql5.com
Терминал МetaTrader 5 дает новые возможности для оптимизации параметров создаваемых экспертов. Кроме уже имеющихся в тестере критериев оптимизации, разработчики получили инструмент для создания собственных критериев. Это открывает поистине безграничные возможности в тестировании и оптимизации экспертов. В статье рассматриваются практические способы построения таких критериев - как простых, так и достаточно сложных.
 
AkaEdie #:

Thank you, but can anyone tell me how to account for this class.

  1. only the maximum fixed profit
  2. minimum losses
  3. total maximum capital

https://www.mql5.com/ru/articles/286

or in other ways?

and also profit in the tester is calculated plus capital or only profit separately? what is the final figure I mean?

Here you can find out what standard figures you can get after passing in the strategy tester.

The initial balance is not taken into account in the "profit" figure.

Документация по MQL5: Константы, перечисления и структуры / Состояние окружения / Статистика тестирования
Документация по MQL5: Константы, перечисления и структуры / Состояние окружения / Статистика тестирования
  • www.mql5.com
После окончания тестирования вычисляются статистические показатели результатов торговли по множеству параметров. Значения показателей можно...