Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1449

 

Good afternoon!

Help please beginner, translate the EA from mql4 to mql5, need to calculate the width of the channel in points on a given number of bars from the current, calculations he do but it is not clear how, appear negative values that should not be.

 double Del_Max()
 {
 double hi=0,lo=0,del=0;

   for(int i=1; i<MaxBarCount;i++)
    {
    hi=iHighest(NULL,0,MODE_HIGH,i,1);
    lo=iLowest(NULL,0,MODE_LOW,i,1);
    }
   
    del=NormalizeDouble((hi-lo),0);
return(del);

Example:

Alert: Channel width max. = 1200000.0, Channel width min. - 200000.0


Thank you!

 
Sergey Alekseev number of bars from the current, calculations he do but it is not clear how, there are negative values that should not be.

Example:

Alert: Channel width max. = 1200000.0, Channel width min. - 200000.0

Firstly, look in the documentation and realise the purpose and difference between the iHighest and iHigh functions, similarly for iLowest and iLow.

This should give you the right idea.

 
Sergey Alekseev number of bars from the current, calculations he do but it is not clear how, there are negative values that should not be.

Example:

Alert: Channel width max. = 1200000.0, Channel width min. - 200000.0


Thank you!

You are getting bar numbers with maximum and minimum price values. Hence the negative values.

BUT!!! In the new version of MT introduced a new function with which you can get in arrays and minimum and maximum prices for a certain number of bars. Then use mathematical functions to get the maximum and minimum price values and calculate the required value using the formula.

You will be the first to use the innovation:))))))

Документация по MQL5: Доступ к таймсериям и индикаторам / CopySeries
Документация по MQL5: Доступ к таймсериям и индикаторам / CopySeries
  • www.mql5.com
CopySeries - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Can I access the database created with the help of mql5 from the outside, say, write a code on node.js and interact with the database. Or the database can be used only with the help of mql5?
 
I can not find a branch or posts on the topic - limitation of non-compatible parameters in the Tester, so that during the initialisation pass, if a number of parameters match, the optimisation will not take place
 
how to receive and send information to MT4 server using api for trades profit , loss etc...
 
Moatle Thompson #:
how to receive and send information to MT4 server using api for trades profit , loss etc...

Study API documentation

 
Kirllik #:
Can I access the database created with the help of mql5 from the outside, say, write a code on node.js and interact with the database. Or the database can be used only with the help of mql5?

You can. There are no obstacles.

 
lynxntech #:
I can't find a thread or posts on the topic - limitation of incompatible parameters in Tester, so that during the initialisation pass when a number of parameters match, optimisation will not take place

This?
https://www.mql5.com/ru/forum/437096#comment_43539784

Отключение оптимизации параметров в зависимости от input переменной. - Проверьте, есть ли какая то возможность при оптимизации игнорировать перебор параметров модуля?
Отключение оптимизации параметров в зависимости от input переменной. - Проверьте, есть ли какая то возможность при оптимизации игнорировать перебор параметров модуля?
  • 2022.11.28
  • www.mql5.com
У модулей есть свои input параметры, которые прогоняются в оптимизации. Есть ли какая то возможность при оптимизации игнорировать перебор параметров модуля если он выключен. Там можно включать отключать параметры от оптимизации
 
Yuriy Bykov #:

This?
https://www.mql5.com/ru/forum/437096#comment_43539784

I do it like this:

 input int StopLoss   = 30;
 input int TakeProfit = 50;    
 int OnInit()
     {
      if(MQLInfoInteger(MQL_OPTIMIZATION))
        {
         if(TakeProfit < StopLoss / 4)
            return(INIT_FAILED);
        }
      return(INIT_SUCCEEDED);
     }