Automation with button and mouse click interception. - page 4

 
HIDDEN >> :

interested in software control of the strategy tester.

1. open it from the Expert Advisor (code found)

2. press the Start button

etc. In general, it would be desirable to have all the codes from this window. buttons, etc.

You want to get off easy. :))

There are a lot of complicated things here:


1. open the tester window

2. open the list of EAs, select a given EA from the list by name (can be skipped, leaving one position in the list beforehand)

3. open symbol list, select a given symbol from the list by name (you can skip this by leaving one position in the list beforehand)

4. open the list of methods, select a given method from the list by name or number

5. Open period list, select given period from the list by name or number

6. Check "Use date" box, check it

7. Check "Optimise" checkbox, tick the checkbox. 10.

8. Check "Visualization" box, uncheck it (optional)

9. Enter the given date in the "From" window (if possible)

10. Enter the set date in the "To" window (if possible)

11. press the "Start" button

12. Receive a signal of the end of optimisation, i.e. text "Start" returned to the button (a timer can be used)

13. Close the tester window


That is if I haven't missed anything yet.

 
granit77 >> :

You want to get off easy. :))

There's a lot of complicated stuff here:


1. open the tester window

2. open the list of Expert Advisors, select a given Expert Advisor from the list by name (can be skipped, leaving one position in the list beforehand)

3. open symbol list, select a given symbol from the list by name (you can skip it by leaving one position in the list beforehand)

4. open the list of methods, select a given method from the list by name or by number

5. Open period list, select given period from the list by name or number

6. Check "Use date" box, check it

7. Check "Optimise" checkbox, tick the checkbox. 10.

8. Check "Visualization" box, uncheck it (optional)

9. Enter the given date in the "From" window ( if it's possible)

10. Enter the set date in the "To" window (if possible)

11. press the "Start" button

12. Receive a signal of the end of optimisation, i.e. text "Start" returned to the button (a timer can be used)

13. Close the tester window


If I have not missed anything yet

There is a lastparameters.ini file in the tester folder, what prevents it from being prepared in the Expert Advisor, written and opened in the tester and the start button pressed. It turns out that half of the items are already missing.

 

That's right, I'd forgotten.

If you've worked with it, run through the list, maybe all you really need to do is press 'Start'?

 
granit77 >> :

Right, I had forgotten.

If you have worked with it, run through the list, maybe you really only need to press "Start"?

optimization=0 //optimisation on and off
genetic=1 //genetics
fitnes=0
method=0 //testing method
use_date=0 //by date
from=1226620800 // start date in seconds since 1970
to=1226620800 // end date


the same for EA, after testing and optimising it is done once manually the parameters are saved and change as you like. I still need to press the Start button, oh how much I need....


If optimization is going on for the Expert Advisor that trades on a chart, F6 code can be pressed and, accordingly, the Expert Advisor and the currency pair are automatically selected. i.e. some more points are missed.

 
HIDDEN >> :

I still need to hit the start button, oh how much I need....

I'm not particularly flattered. A manual run with periodic optimisations has not yet produced an unambiguously positive result.

Besides, the question of choosing the best set of parameters also hangs in the air, everyone comes up with anew.

Mathemat has promised an article, maybe it will clear up a bit.

But with this tool, the possibilities will increase by an order of magnitude; it will be a breakthrough.

 

From a nearby thread Erics tells.


Button codes are looked up in Spy++ (Control ID)

And they are used to get the button descriptor:

hButtonStart = GetDlgItem(hTester, 0x40A);



I'm going to wake up and figure out how to attach it.

 

Before performing any actions in the Strategy Tester window, you should first understand how a window tree is arranged in MetaTrader, and secondly, determine
its system descriptor. Then, using the GetDlgItem(int hDlg,int nIDDlgItem) function, you can get IDs of the necessary controls.


The picture below shows a part of MetaTrader window tree in Spy++. Thered marker indicates its root. Yellow marker shows location of "Terminal" window in the tree, etc.
Thus, in order to obtain the system identifier of the "Start" button (marked with a blue marker in the picture), you should sequentially pass through all higher levels
. For illustration, each level is marked with a colour.




Here is a sample code in MQL to get the "Start" button descriptor.

#include <WinUser32.mqh>

#import "user32.dll"
   int GetAncestor(int hWnd, int gaFlags);
   int GetDlgItem(int hDlg, int nIDDlgItem);
#import

void start()
{
   int hMetaTrader, hTerminal, hTester, hButtonStart;
   
   hMetaTrader = GetAncestor(WindowHandle(Symbol(),Period()),2); //дескриптор основного окна терминала
	
   hTerminal = GetDlgItem(hMetaTrader,0xE81E);
   hTester = GetDlgItem(hTerminal,0x53);
   hButtonStart = GetDlgItem(GetDlgItem(hTester,0x81BF),0x40A);  //дескриптор кнопки "Старт"
}

To determine the descriptor, the second parameter of the GetDlgItem() function is to pass the Control ID to the window component. It can be defined by calling
menu item "Properties..." by right-clicking. As an example, in the figure below the Control ID of the "Terminal" window(0xE81E) is marked in red .


 
Ilnur >> :

Before making any actions in the Strategy Tester window, you must first understand how the window tree in MetaTrader is structured, and secondly, determine


Thanks for the tutorial. The Start button is safely pressed, as are the other necessary buttons on the control panel called MetaTrader 4.

 

Eh.... it comes to mind.


The Americans sent a tourist to a Soviet submarine. He got drunk on the first day. In the morning he woke up and saw the captain with a baton running after the sailors and yelling: "Who pushed the red button? Who pushed the red button?" The American chides him:
- You know, sir, we don't have captains in America behaving like that!
- There is no more America! Who pushed the red button?!

 
HIDDEN писал(а) >>

Eh.... I'm reminded.

The Americans sent a tourist on a Soviet submarine. He got drunk on the first day. He woke up in the morning and saw the captain with a baton chasing sailors and yelling: "Who pushed the red button? Who pushed the red button?" The American chides him:
- You know, sir, we don't have captains in America behaving like that!
- There is no more America! Who pushed the red button?!

It was a good terminal : -)))

Reason: