Discussion of article "Using AutoIt With MQL5"

 

New article Using AutoIt With MQL5 has been published:

Short description. In this article we will explore scripting the MetraTrader 5 terminal by integrating MQL5 with AutoIt. In it we will cover how to automate various tasks by manipulating the terminals' user interface and also present a class that uses the AutoItX library.

AutoIt ships with an application called the AutoIt Window Info Tool that is used to get information about application windows.

By dragging the Finder Tool over any part of a target application,we can get the properties of a particular component. These components are refered to as controls. A control can be a button , dropdown menu, or a tab. These are just a few examples, there are many types of controls used to build applications. Each control is associated with a window. An application can be made up of a number of windows. Usually there is a main window,onto which other child windows are attached or docked. If the child windows are attached or docked to the main application window, then all the controls enclosed in those child windows
become part of the main application window. When using AutoIt to accurately locate a control, the window the control is associated with is important,whether it is a child window or the main application window.

Looking at the graphic below, we can see the finder tool being dragged over different regions of a Metatrader 5 (MetaTrader 5) application.Take note of the settings of the Window Info tool when Options menu is selected. Freeze , Always On Top and Use Spy++ Control Detection Logic , options are ticked.


Author: Francis Dube

 

Can you please advice on how to press button allowing to enable/disable AutoTrading (Ctrl+E) ? Should I use `ALGOTRADECHECK_BUTTON` or `WINDOWTEXT_EA` or maybe something else? Forgive me if I was inattentive but it seems that you check that experts are allowed to trade when you add one to a chart (b.t.w. what if another EA is already there?) so it could be a separate public method for that.

Thank you for a great job!

 
Daniel Lagoshniak #:

Can you please advice on how to press button allowing to enable/disable AutoTrading (Ctrl+E) ? Should I use `ALGOTRADECHECK_BUTTON` or `WINDOWTEXT_EA` or maybe something else? Forgive me if I was inattentive but it seems that you check that experts are allowed to trade when you add one to a chart (b.t.w. what if another EA is already there?) so it could be a separate public method for that.

Thank you for a great job!

ALGOTRADECHECK_BUTTON` and  `WINDOWTEXT_EA` should only be used to interact with EA dialogues. What you are trying to do is not implemented in the class. But it can be achieved by using CAutoIt 's ControlSend() method to send the key combination (Ctrl+E) to the terminal or you could target button in the toolbar and emulate a click with ControlLeftClick()

When there is an EA already on chart that differs from the one being applied to the chart, the code  can handle the dialogue that appears and asks to confirm whether the existing EA should be removed, after which the new EA will be added to the chart.

 

AutoIt is an excelent tool, but be warned that the last update was in March 2018...

;)

 
Yeah AutoIt is great I actually wrote AutoMTF in Autoit
 

Is there any way to set the color of the red and blue in Market Watch to solid color and not gradation ? I use Autoit to read the color but everytime I rerun the trading app it's changing making the pixel color checker also changed.

I also need a way to read profit of each open position using autoit