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

 
#include <Trade\Trade.mqh>
CTrade itrade;
...
We have 2 positions:
Buy:
int ticket1 = 33; (with a price of 1.30853)
Sell:
int ticket2 = 19; (with a price of 1.31096)

Why doesn't itrade.PositionCloseBy(ticket1, ticket2) work?

Failed close position #15 sell 1 GBPUSD_i by position #19 [Invalid order].
 
Hello. I can't figure out how to make a pause in the standard generated EA after closing a trade.
On mql5
 

Hello !

The question is simple - I need a code so that the position can only open from 11pm to 2pm the next day...

 
Valentin Denisov:
Hello. I can't figure out how to make a pause after closing a trade in a standard generated EA.
On mql5
Sleep 3000; after closing a trade.
 
Valeriy Yastremskiy:
Sleep 3000; after closing the transaction.
Great. And where exactly should I prescribe?
 
Valentin Denisov:
Great. And where exactly do we need to write it?
We have to deal with the Expert Advisor's logic first. How deals are closed, and how this moment can be detected. If we use Stop Loss and Take Profit, then we have to check the deal closing time, and it is not equal to zero. If a deal is closed by a condition, then this moment should be monitored.
You can also track the number of market orders, the number of orders by order type. Check out these articles by Artyom Trishkin. The first articles on tracking the number of positions and their statuses.
https://www.mql5.com/ru/articles/5654
Библиотека для простого и быстрого создания программ для MetaTrader (Часть I): Концепция, организация данных, первые результаты
Библиотека для простого и быстрого создания программ для MetaTrader (Часть I): Концепция, организация данных, первые результаты
  • www.mql5.com
Разбирая огромное количество торговых стратегий, множество заказов на изготовление программ для терминалов MT5 и MT4, просматривая огромное разнообразие различных сайтов по тематике скриптов, индикаторов и роботов для MetaTrader, я пришёл к выводу, что всё это многообразие в подавляющем своём большинстве строится на фактически одних и тех же...
 
Working on the MT4 platform. On the 30th and 31st, entered the USDCNF and GBPUSD currency pairs. And on the 3rd, August my account entry point changes, this price was not even on the 30th and 31st of July. How can it be?
 
Hello. On the 30th and 31st, entered trades in USDCNF and GBPUSD currency pairs. And on the 3rd of August my entry point changes in my account, this price was not even on the 30th and 31st of July. How can it be? Who it depends on? I do not know where to turn, the firm I opened the account for has not done anything.
 
olga030577:
Hi. On the 30th and 31st, I entered trades in USDCNF and GBPUSD currency pairs. And on the 3rd of August my entry point changes in my account, this price was not even on the 30th and 31st of July. How can it be? Who it depends on? I do not know where to turn, the firm I opened the account for has not done anything.

any screenshots ? at the time of opening, now and plus the current order situation

 

the number of bars on the chart on which it is running."

Let's say there are 1000 bars. And the ticks are only available from bar 700 (bar X).

For starters, how do I determine this X ?

Another question to the experts: If there is a candle on the chart, and during the lifetime of this candle, I draw my indicator, and then a new candle is formed, will it be drawn? Or it will be drawn only after a new candle opens on the chart?