Questions from Beginners MQL5 MT5 MetaTrader 5 - page 163

 
zlodei:

I wrote the simplest indicator in mql4, I wanted to translate it to mql5, and I have been struggling for a week, but it is not working! I'm getting on my nerves, I hate mql5 because I have already written 88 lines of a simple 34-line indicator in mql5!

Here is the code on mql4:

And here is the code on mql5:

Indicator lines are not displayed correctly in MT5.

What have I done wrong?

Good people, help me, have pity on the poor guy, I'm on the verge of a breakdown, honestly. It's a shame you can't swear in here!

Moderator, don't ban me, first give me a warning if something is wrong.

You need ArraySetAsSeries(..., true), for all buffers (in OnInit()), and everything will work. // In MT5, default =false.
 
papaklass:

Take a look at https://www.mql5.com/ru/docs/indicators

There is a code of standard indicators there

Thank you!

Maybe I didn't ask the question correctly, I figured it out myself, I was looking for this:

Документация по MQL5: Операции с графиками / ChartIndicatorAdd
Документация по MQL5: Операции с графиками / ChartIndicatorAdd
  • www.mql5.com
Операции с графиками / ChartIndicatorAdd - Документация по MQL5
 
MetaDriver:
You need ArraySetAsSeries(..., true), for all buffers (in OnInit()) and everything will work. // In MT5, default =false.

This does not help... Because on EVERY tick there is multiple (tens of thousands of times) call of CopyOpen and CopyClose functions, which leads to freezing of the indicator and in some cases, the terminal.

In addition, in the CopyOpen it is obvious that the array is exceeded, and in mql5 it leads to a halt of the program execution. And the terrible CPU load, as it turns out.

Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Программы MQL5 / Выполнение программ - Документация по MQL5
 
Fleder:

This does not help... Because on EVERY tick there is multiple (tens of thousands of times) call of CopyOpen and CopyClose functions, which leads to freezing of the indicator and in some cases, the terminal.

In addition, in the CopyOpen it is obvious that the array is exceeded, and in mql5 it leads to a halt of the program execution. And the terrible load on the CPU, as it turns out...

What a terrible algorithm you have).
 
zfs:
What a creepy algorithm you have).
That creepy algorithm is not mine. It's just that the person (author) asked for help and was politely sent away!
 
Fleder:
This creepy algorithm is not mine. It's just that the person(author) asked for help and he was politely sent away!
The only thing left to do is to resolve the issue with you).
 

Afternoon !

Can you tell me how I am learning to trade on the demo.

I made a short with stoploss, after 10 min pause and quotes were not loading from the server. After the download a 5000 pips candlestick jumped and stop was weak.

Is it a fault of the demo? Or it may happen on a real account?

I have already downloaded it but I have not downloaded it yet.

 
sbr080:

Afternoon !

Can you tell me how I am learning to trade on the demo.

I made a short with stoploss, after 10 min pause and quotes were not loading from the server. After the download a 5000 pips candlestick jumped and the stop was weak.

Is it a fault of the demo? Or it may happen on a real account?

I have already downloaded it but I have not downloaded it yet.

The demo is simulated, there are no guarantees of normal operation on it. Stops can work on any account.
 

sbr080:

Or does it also happen in a real account?

Does what happen?

spikes of a hundred pips?

or a losing trade?

 

Gentlemen, please tell me what to write in the last two lines when modifying a pending order if its lifetime is set. (e.g. 6 hours - ).

request.type_time = ORDER_TIME_SPECIFIED; // the order will be active until the expiry date
request.expiration = TimeCurrent()+6*3600;//last known server time + number of hours*hours

If the lifetime doesn't change, can we not write anything at all when modifying? By default it will die by itself.

And if you need to change its life?

Modify Pending Order

Trade request to modify pending order price levels. 7 fields are required:

-action

-order

-price

-sl

-tp

-type_time

-expiration

These are the two lines in the Handbook that I can't get into:

type_time

Type of order at expiration time. Value can be one of the values ENUM_ORDER_TYPE_TIME

expiration

Expirationtime of the pending order (for ORDER_TIME_SPECIFIEDorders )

Please write how they should look in the expert, when modifying, I will understand. Thank you in advance.