Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1254

 

Hello all.

There is a candlestick indicator, tick indicator, it is not attached to any TF. A candlestick in the indicator may appear at any moment.

The question is, how to know from the EA about the appearance of this candle?

I tried to add an additional buffer to the indicator

#property indicator_buffers 5 // дополнительный буфер
#property indicator_plots   1
SetIndexBuffer(4, is_new,           INDICATOR_DATA);

into which I write 1 when a new candle appears.

The problem is that this buffer does not appear in the Data Scope window, and therefore its value cannot be read from the EA.

What to do?

 
Сергей Таболин:

Hello all.

There is a candlestick indicator, tick indicator, it is not attached to any TF. A candlestick in the indicator may appear at any moment.

The question is, how to know from the EA about the appearance of this candle?

I tried to add an additional buffer to the indicator

into which I write 1 when a new candle appears.

The problem is that this buffer does not appear in the Data Overview window, and therefore its value cannot be read from the EA.

How to do?

Add construction

#property indicator_buffers 5 // дополнительный буфер
#property indicator_plots   2
 
Alexey Viktorov:

Add construction

Thank you.

 
Hi all! Friends, there are problems with the connection to the server and there is a need to test an indicator, but I cannot update the data. Who can, please send the history of M1 RTS-12.20 for the last 2 weeks or more. Thanks in advance!
 
Please share a function to get all paths (with subdirectories) to specific files in a specified directory into an array!
 

Hello. The Expert Advisor places pending orders on the levels. In the conditions there are ask and bid prices, respectively, for buy and sell orders. If I write :

ask = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
bid = SymbolInfoDouble(Symbol(), SYMBOL_BID);

in the tester, pending orders are placed both to buy and to sell. If I write:

ask = m_symbol.Ask();
bid = m_symbol.Bid();

only buy orders are placed. Sell orders are not placed and I do not have any log entries in this regard. I am quite satisfied with the first option, but I still wonder what the reason is.

Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Свойства ордеров
  • www.mql5.com
Приказы на проведение торговых операций оформляются ордерами. Каждый ордер имеет множество свойств для чтения, информацию по ним можно получать с помощью функций Идентификатор позиции, который ставится на ордере при его исполнении. Каждый исполненный ордер порождает сделку, которая открывает новую или изменяет уже существующую позицию...
 
Youri Lazurenko:

Hello. The Expert Advisor places pending orders on the levels. In the conditions there are ask and bid prices, respectively, for buy and sell orders. If I write :

in the tester, pending orders are placed both to buy and to sell. If I write:

only buy orders are placed. Sell orders are not placed and I do not have any log entries in this regard. I am quite satisfied with the first variant, but I still wonder what is the reason.

check on 0.0 for starters

m_symbol.Bid();

look at the rest of the code to call the price assignment

 
Youri Lazurenko:

Hello. The EA places pending orders on the levels. In the conditions there are ask and bid prices, respectively, for buy and sell orders. If I write :

in the tester, pending orders are placed both to buy and to sell. If I write:

only buy orders are placed. Sell orders are not placed and I do not have any log entries in this regard. I am quite happy with the first variant, but I still wonder what the reason is.

Before referring to the prices through an object ofCSymbolInfo class, one must first refresh the prices

CSymbolInfo:RefreshRates

Refreshes quotes by symbol

Документация по MQL5: Стандартная библиотека / Торговые классы / CSymbolInfo
Документация по MQL5: Стандартная библиотека / Торговые классы / CSymbolInfo
  • www.mql5.com
CSymbolInfo - Торговые классы - Стандартная библиотека - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Vladimir Karputov:

Before accessing prices via aCSymbolInfo object, the prices must first be refreshed

CSymbolInfo:RefreshRates

Refreshes quotes by symbol

Thank you for your reply. As for me, it's much easier to use the first option than to write a bunch more conditions to something like this to make it work. InCSymbolInfo class, when defining ask and bid, the same formula is used as in the first variant. We get the result in the first case without price refreshing; in the second case, it is refreshed. We can get the ask price throughCSymbolInfo class without refreshing; bid, however, this variant is no good. I think it is too complicated.

Документация по MQL5: Стандартная библиотека / Торговые классы / CSymbolInfo
Документация по MQL5: Стандартная библиотека / Торговые классы / CSymbolInfo
  • www.mql5.com
CSymbolInfo - Торговые классы - Стандартная библиотека - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 

Hi all!

Wrote an EA. Can't say it's profitable. When testing, sometimes trades appear in the results with a volume that doesn't match the algorithm's calculation. For example, two consecutive trades: one is calculated correctly, the other is calculated incorrectly. How to get rid of it?

Reason: