Questions from Beginners MQL4 MT4 MetaTrader 4 - page 106

 
bas:

1. How do I close a position with a pending order? I couldn't find any special tools in the documentation. So, only by counter order and then OrderCloseBy()?

2. How do I know the error that occurred when triggering a pending order, e.g. NOT_ENOUGH_MONEY? There is nothing in LastError(). But it is there and the tester displays it in the log.

1. Look how this issue is handled smartly in the MT5 when using a netting account. There all simultaneously opened orders for one instrument are summed up. The opening price of a net position is then averaged. Opening a counter order closes the position. Opening of the double opposite order reverses the position, etc. There is no need for many calculations for a pile of orders

2. Perhaps, after the pending order triggering, another operation, changing the value of the _LastError variable, is performed. Try to check it immediately when entering OnTick().
 

1. Yes, from that point of view it is convenient. On the other hand, if there are several systems running on the account at the same time, it only makes it more difficult to control them.

2. That's exactly what I do, GetLastError() always = 0.

p.s. how do i get a response from Metaquotes? there is nothing at all in the documentation about working with pending orders in MT4.

 
bas:

2. That's exactly what I do, GetLastError() always = 0.

p.s. how do i get a response from Metaquotes? there is nothing at all in the documentation about working with pending orders in MT4.

1. So, either SL, TP help, or wait for the order to open in the market and CloseBy, but the second option makes sense...

Are you sure about MT4? in MT5, you just need to check ResultRetcode, not LastError.

what is not in the documentation? it's always been enough

 
bas:

1. Yes, from that point of view it is convenient. On the other hand, if there are several systems running on the account at the same time, it only makes it harder to control them.

p.s. how do i get a response from Metaquotes? there is nothing at all in the documentation about working with pending orders in MT4.

1. Let's simulate. A team of speculators comes to town. The main one says: in the past they sold at 100. Here you can buy for 50 and sell for 40. Assistants say: We'll buy. Chief says: It's decided by the majority. Because I wanted to sell the leftovers, maybe the next town will be even cheaper.
The other brigade is a democracy, but the deposit is shared. The boss says after the meeting: OK, go buy at 50. In the meantime I'll sell the rest at 40.
Which brigade has a higher yield?
PS There is a language reference in the documentation. And everyone drains the deposit at their own risk. Examples in codeBase a lot. In the terminal, open the library tab at the bottom third from the end. There you can also filter Indicators, Expert Advisors, Scripts by right-click on the title
 

Good afternoon everyone, could you please advise why the quotes occasionally start to deviate from the real ones?

 
timurxismatulli:

Good afternoon everyone, could you please advise why the quotes occasionally start to deviate from the real ones?

Everyone uses it silently to make a profit.

 

Question about orders in MT4, sorry for the off-topic, but there is no life in that section :( and I would like toget an answer fromMetaquotes.

https://www.mql5.com/ru/forum/160587/page106#comment_6130412

Вопросы от начинающих MQL4 MT4 MetaTrader 4
Вопросы от начинающих MQL4 MT4 MetaTrader 4
  • 2017.11.29
  • www.mql5.com
Если у Вас вопросы по MQL4, MT4, MetaTrader 4, пожалуйста пишите в этой теме. Особенно когда вопросы касаются торговых функций...
 

It's just that my charts have variations of a hundred pips and different candlesticks. I can't figure out what the reason is.

 
timurxismatulli: It's just that my charts have deviations of a hundred pips and different candles. I can't figure out what the reason is.

It's a trend direction indicator! Use it to make a profit...

 
bas: I am sorry about orders in MT4, but there is no life in that section :( I would like toget an answer fromMetaquotes

Metaquotes has provided a tool. Using it involves risks, you apply it at your own risk. Examples of use in CodeBase. In the terminal, the Library tab. Metaquotes is unlikely to teach you

Reason: