Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1151

 

Does anyone know how to distinguish a graphical object created by the program from a manually created object in the terminal?

Previously terminal objects had a name beginning with #

Now there is no such distinction in mt 5

 
Good afternoon. Is there any way to set the slope of a trend line as a percentage, rather than in points between the first extremum and the second one (we use them to draw the trend line)? I.e., Ext. 2 is located at x% versus Ext. 1. I read the mql forum, where they suggest creating virtual coordinates that depend on the price and time scale and, if the scale is changed, they will also change. @Artyom Trishkin
 
DotCom:
Good afternoon. Is there a way to set the slope of a trend line as a percentage, rather than in points between the first and the second extrema (we use them to plot the trend line)? I.e., Ext. 2 is located at x% versus Ext. 1. The mql forum advises to create virtual coordinates that depend on the price and time scale and, if the scale is changed, they will also change. @Artyom Trishkin

in degrees you can)

1

2

 
Taras Slobodyanik:

in degrees you can)


thought about it, but if you scale the graph, degrees will change, it is better to have a relative value %

 
DotCom:

thought about it, but if you scale the graph, degrees will change, it is better to have a relative value %

If you scale it to a fixed scale, the values will be constant.

 

Good afternoon. I have a question about MQL5.


How do I calculate all charges related to a position?

In MT4, I obtained and added swap and order commission for this purpose using OrderSwap() and OrderCommission() functions;

I need to do the same in MT5, but I have difficulties with netting and hedging. I need a universal solution that will work correctly in both modes.

I can get swap by position using the PositionGetDouble(POSITION_SWAP) function;

But the commission is paid for each deal that took part in the position formation. Therefore, we need to get the entire history of deals on the position HistorySelectByPosition(position_id).

And then loop through all deals of this position and sum the commission HistoryDealGetDouble(deal_ticket,DEAL_COMMISSION).

However, in addition to commissions, I found another expense item in the reference: DEAL_FEE - payment for carrying out a transaction. It is charged as soon as the transaction is completed.

Isn't this the same as commission? And what about these costs, should they also be added together with commission DEAL_COMMISSION?

Correct me if I am wrong.

 
Hello @ Artyom Trishkin, can you help me with this question: https://www.mql5.com/ru/forum/339891 ?
Как использовать processsthreadsapi.mqh в MQL5 / MQL4?
Как использовать processsthreadsapi.mqh в MQL5 / MQL4?
  • 2020.05.07
  • www.mql5.com
Скажите, пожалуйста, могу ли я использовать эту библиотеку для многопоточности процессов...
 

Please advise and MQL4 to take the previous value of MA I wrote

iMA(Symbol(), period01, 5, 0, MethodMa, PriceMa, i+1)

MQL5 does not have " i+1" parameter for iMA

How do I do it now?

I want to remake this indicator for MT5
 
MakarFX:

Please advise and MQL4 to take the previous value of MA I wrote

MQL5 does not have " i+1" parameter for iMA

How do I do it now?

I want to remake this indicator for MT5

Open the Expert Advisor file "Moving Average.mq5" and see an example of working with indicators in MQL5.

 
MakarFX:

Please advise and MQL4 to take the previous value of MA I wrote

MQL5 does not have " i+1" parameter for iMA

How do I do it now?

I want to remake this indicator for MT5
It may be +1 or +1000, as long as it is possible to get them all at once. Pay special attention to array indexing.
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyBuffer
Документация по MQL5: Доступ к таймсериям и индикаторам / CopyBuffer
  • www.mql5.com
Отсчет элементов копируемых данных (индикаторный буфер с индексом buffer_num) от стартовой позиции ведется от настоящего к прошлому, то есть стартовая позиция, равная 0, означает текущий бар (значение индикатора для текущего бара). При копировании заранее неизвестного количества данных в качестве массива-приемника buffer[] желательно...