Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1039

 
User_mt5:
Yes, I should have presented the code. But it's simple: in the OnChartEvent() function, the first line is print:

That's probably not enough...

You've provided programming strings, the contents of which I'll look at in detail and experiment with. Maybe that will solve the issue.

Thank you very much!

the code in the help works, I gotdelta =+120 anddelta =- 120 in the log for scrolling the wheel

Which corresponds to scrolling one way and the other

SZY: take into account that Printy terminal can sometimes "swallow" if there will be frequent output in the log

 
Igor Makanu:

the code in the help works, I gotdelta =+120 anddelta =- 120 for scrolling the wheel in the log

which corresponds to scrolling to one side and vice versa

SZY: take into account that Prynty may sometimes "swallow" if you will be frequent output in log

MQL remains a mystery to me in many ways. In this case after mouse activation event 9 did not leave the logs. Now it's 9 and 11 to one side and only 11 to the other. I don't understand this, for the life of me.

And I do not understand why some events must be included, while others do not require it. (I now understand why I missed the inclusion of the mouse - because I was not expecting it, and help, we do not read all the row without exception).

120 I also received and also I still do not understand what it is. I will figure it out.

Thank you again, you've been very helpful!

 
User_mt5:

MQL remains a mystery to me in many ways. In this case, after mouse activation, event 9 did not leave the logs. Now it's 9 and 11 to one side and only 11 to the other. I don't understand this, for the life of me.

And I do not understand why some events must be included, while others do not require it. (I now understand why I missed the inclusion of the mouse - because I was not expecting it, and help, we do not read all the row without exception).

120 I also received and also I still do not understand what it is. I will have to deal with it.

Thank you again, you are very helpful!

This is not an MQL issue, Windows generates events in this way, for example, a Windows mouse click event is generated giving out several events: button pressed, then button clicked - and you only need to process one click

So it is with the wheel - the message queue is generated

 
Igor Makanu:

This is not an MQL issue, this is how Windows generates events, for example Windows message mouse click is generated by generating several events: button pressed, then button pressed - and only one click needs to be processed

the same with the wheel - a message queue is generated

Since you say so, it must be so. But I am not a professional programmer, there are some points I find difficult to understand.

Thank you.

 

Greetings all!

Help to unambiguously understand the correctness of the calculation of acceptable risk in money and the volume of the planned position, I am interested in the formula that takes into account TickPrice and other nuances, rather than reasoning on the subject.

Input data:

Deposit, $ = 3000
Risk per trade, % = 5
Risk price, $ = ?
Size SL, point= 250
Tick price = 1,3
Lot volume = ?

I calculate as follows:

Risk Price, $ = Deposit, $ * Risk per trade, % / 100
Lot Volume = Risk Price, $ / Size SL, point / Tick Price

 
Anzhela Sityaeva:

Greetings all!

Help to unambiguously understand the correctness of the calculation of acceptable risk in money and the volume of the planned position, I am interested in the formula that takes into account TickPrice and other nuances, rather than reasoning on the subject.

Inputs:

Deposit, $ = 3000
Risk per trade, % = 5
Risk price, $ = ?
Size SL, point = 250
Tick price = 1.3
Lot volume = ?

I calculate as follows:

Risk price, $ = Deposit, $ * Risk per trade, % / 100
Lot volume = Risk price, $ / Size of SL, point / Tick price

Look in this advisor.
Советник 4UJ
Советник 4UJ
  • www.mql5.com
Рекомендаций по валютной паре нет. Используемые индикаторы: Простая скользящая средняя с периодом 48 — SMA(48). Индикатор ATR с периодом 7 и MA по ценам ATR с периодом 30 Условия для покупок: 1. Цена находится выше скользящей средней. 2. Индикатор ATR пересекает свою скользящую среднюю снизу вверх. 3. Как только сформируется первая медвежья...
 
Alexey Viktorov:
Look at this EA.

Thank you for your answer!

Any mathematicians out there? I would like to understand the difference between the first and second version of the calculation, in both cases the result is the same. Which of the two is correct?

First option: Volume Volume = Price at Risk, $ / Size SL, point / Tick value
Second variant: Volume of the lot = Risk price, $ / ( Size of SL, point * Tick value)

 
Anzhela Sityaeva:

Thank you for your answer!

Any mathematicians out there? I would like to understand the difference between the first and second version of the calculation, in both cases the result is the same. Which of the two is correct?

First option: Volume Volume = Risk Price, $ / Size SL, point / Tick value
Second variant: Volume of the lot = Risk price, $ / ( Size SL, point * Tick value)

And what role does the comma play in the formulas??? Well, if I understand the question correctly, then remember your 5th grade maths lessons: First you do the expressions in parentheses and then the expressions outside parentheses. First you perform parenthesis, then multiplication and division, and finally addition and subtraction in the sequence from left to right.

Example:

100/10/10=1

100/(10*10)=1

 
Alexey Viktorov:

What role does a comma play in formulas??? Well, if I understand the question correctly, then remember your 5th grade maths class: You do the expressions in parentheses first and then the expressions behind the parentheses. First you perform parenthesis, then multiplication and division, and finally addition and subtraction in the sequence from left to right.

Example:

100/10/10=1

100/(10*10)=1

The comma doesn't play a role in the formula, you correctly noted, it just separates the value from the type, for ease of understanding no more. Grade 5 is a long time ago :), I've never been good at maths, it just so happens. But I do remember the order of operations.

The question is exactly thesame in both variants of the calculation, which variant is correct?

 

Hi all...

I'm trying to remove an indicator I added from an EA. I am doing the following:

//Объявляю переменные
int win_ind=-1,
    handle_ind = INVALID_HANDLE;

//Создаю
   handle_ind= iCustom(NULL,0,"ind");
   if(handle_ind== INVALID_HANDLE){
      Print("Не удалось создать индикатор. Код ошибки: ",GetLastError());
      return(false);
   }
   win_ind=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL); //--- получим номер нового подокна, в которое добавим индикатор 
   if(!ChartIndicatorAdd(0,win_ind,handle_ind)){
      Print("Не удалось добавить индикатор на окно графика. Код ошибки: ",GetLastError());
      return(false);
   }

//Удаляю
   string name = ChartIndicatorName(0, win_ind, 0);
   bool res = ChartIndicatorDelete(0, win_ind, name); 
   if (!res) PrintFormat("Не удалось удалить индикатор %s с окна №%d. Код ошибки %d", name,win_ind,GetLastError());

In Indicator:

int OnInit(){
   IndicatorSetString(INDICATOR_SHORTNAME,"blablabla");

Indicator is added, subwindow number and short name is correct, but error when deleting:

2019.05.08 12:01:10.068 2019.04.03 12:39:31 Failed to delete indicator blablabla from window #2. Error code 4014

4014 - "System function is not allowed to be called". Can you please tell me what this means, how to remove the indicator?

Reason: