Discussion of article "TradeObjects: Automation of trading based on MetaTrader graphical objects"

MetaQuotes
Moderator
233782
MetaQuotes  

New article TradeObjects: Automation of trading based on MetaTrader graphical objects has been published:

Geometrical constructions on symbol charts have been remaining one of the most popular trading tools for decades. The advanced technologies make it easier to apply support or resistance lines, historical price levels and entire patterns, for example channels and Fibo grid. Algorithmic trading software allows us both to analyze standard patterns and trade using them. MetaTrader also has applications that automate the process to some extent: in most cases, it is enough to add an object to the chart with an EA or script launched in it. The application will open a position, track and close it in due time according to the settings. Such applications enable us not only to trade online but also polish our skills in the tester's visualization mode. We can find such applications in the CodeBase and the Market.

However, all is not that simple. Generally, CodeBase applications have simplified functionality. Besides, they are rarely updated and become obsolete fast (often losing compatibility with the latest MQL language and platform versions), while commercial products are often too expensive.

In this article, we will develop a new tool that represents the golden mean. It will be as simple as possible and provide ample opportunities at the same time. It will be compatible with both MetaTrader 4 and MetaTrader 5. Thanks to the open source code, it can easily be expanded and modified to fit your needs.


Author: Stanislav Korotky

Cleverson De Oliveira
184
Cleverson De Oliveira  

Hi there, thanks for this great work.


I´ve read the paper, but at MT5 I´m facing the following compile error.


'SymbolInfoInteger' - no one of the overloads can be applied to the function call mt4market.mqh 101 23


I´m struggling to fix the problem, could you please give me some advice?

Stanislav Korotky
35397
Stanislav Korotky  
Cleverson Oliveira:

Hi there, thanks for this great work.

I´ve read the paper, but at MT5 I´m facing the following compile error.

'SymbolInfoInteger' - no one of the overloads can be applied to the function call mt4market.mqh 101 23

I´m struggling to fix the problem, could you please give me some advice?

Sorry for the inconvenience.

Unfortunately MetaTrader 5 API have been changed in incompatible way since the publication.

Previously, to detect if a symbol supports "close by" mode one should use SymbolInfoInteger(symbol, SYMBOL_ORDER_CLOSEBY), which returned boolean value.

Now it's replaced by the new approach: you should call SymbolInfoInteger(_Symbol, SYMBOL_ORDER_MODE), which returns a combination of flags, one of which is SYMBOL_ORDER_CLOSEBY.

(SymbolInfoInteger(_Symbol, SYMBOL_ORDER_MODE) & SYMBOL_ORDER_CLOSEBY != 0)

The updated header file is attached.

Files:
mt4market.mqh  7 kb
Komgrit Sungkhaphong
140
Komgrit Sungkhaphong  

Thanks especially Expert include file


give me new dimension on OOP

Stanislav Korotky
35397
Stanislav Korotky  
Here is the updated MT5 source code fixing compatibility issues with newer compiler builds.
Files:
Picee
10
Picee  

The expert doesn't work anymore, in 2021?

Picee
10
Picee  

Update 

My problem is that it cant open the file

can't open "C:\Users\YANG\AppData\Roaming\MetaQuotes\Terminal\F762D69EEEA9B4430D7F17C82167C844\MQL5\Include\MT4Bridge\MT4Account.mqh" include file TradeObjects.mq5 19 1

Can youhelp mee solve it?

Stanislav Korotky
35397
Stanislav Korotky  
Picee:

Update 

My problem is that it cant open the file

can't open "C:\Users\YANG\AppData\Roaming\MetaQuotes\Terminal\F762D69EEEA9B4430D7F17C82167C844\MQL5\Include\MT4Bridge\MT4Account.mqh" include file TradeObjects.mq5 19 1

Can youhelp mee solve it?

Did you place MT4Bridge headers in the referenced folder?

Picee
10
Picee  
Stanislav Korotky:

Did you place MT4Bridge headers in the referenced folder?

Yes, i did. do i need to exporte the file out of include?

Its doesn't want to open any file. 

Stanislav Korotky
35397
Stanislav Korotky  
Picee:

Yes, i did. do i need to exporte the file out of include?

Its doesn't want to open any file. 

Make sure you have placed the header file in the exact MT instance folder (if you have several instances). What does it mean "doesn't want to open any file"? Please, show your code and complete error log.

Stanislav Korotky
35397
Stanislav Korotky  
Picee:

this line is in warnig, is it gonna be a problem?

declaration of 'Magic' hides global variable MT4Orders.mqh 972 22

This is ok in this case.