My approach. The core is the engine. - page 158

 
Artyom Trishkin:

Wait. You wrote:

So who's got what army?

Well, I'll chalk your rudeness about "smart guy" up to the fact that you don't speak Russian well and don't understand that it means a pejorative and dismissive attitude towards the person you are talking to.

Why, have you lost your sense of humour or something?

 
Vasiliy Sokolov:

Unfortunately, yes. A callback interface between two fundamentally different systems is not possible.

Actually, the question was almost rhetorical)

IMHO, with NET compatibility added, it is necessary to add callbacks to terminal. At least one) At least, to push the event into terminal queue.

 
Artyom Trishkin:

If via timer, how are you going to work in the tester? I thought you said you were doing cross-platform code.

Artyom, what questions? If the timer doesn't work, it's emulated from other sources...

it's even in the "battle robot" always so, because the EventSetTimer:-)

ps/ there's something infectiously drawn to militaristic themes...command posts, combat robots... "Galacteco Danger"

 
Dmitriy Skub:

Actually, the question was almost rhetorical)

IMHO, with the addition of NET compatibility, there is a strong need to add call-backs to the terminal. At least one) At least, pushing the event into terminal queue.

I'm not able to catch events in MT5, Spy++ cannot see chart events for some reason. It seems that self-written classes and event models are used instead of standard Windows events.

I use OnTimer as well, that's why I try to receive a minimum data packet in the request, although at the current PC speed I may be getting greedy)))

Artyom Trishkin:

If the timer, how do you work in the tester? I thought you said that you make cross-platform code.

When I tried to use МТ5 it was a real pleasure to write under C# - I call .dll, immediately start a form and put all graphics into a separate thread ( Thread ) and that's all, after that I just work with data exchange between C# and МТ5 and the graphical form with buttons works as a usual widow application - the request from МТ5 only receives status of earlier clicked elements and nothing is braking or will be;)

 
Maxim Kuznetsov:

Artyom, what's with the questions ? if the timer doesn't work, it's emulated from other sources...

this is even always the case in "combat robot", because EventSetTimer :-)

ps/ there's something infectiously drawn to militaristic themes...command posts, combat robots... "Galacteco Danger"

Well... I wanted to ask Vassili how he'd do it. In order to compare it with what I made myself a long time ago (not without Vasil's advice, of course)

 
Igor Makanu:

i failed to capture events in MT5, for some reason Spy++ cannot see chart events, it seems that self-written classes and event models are used rather than standard widows ones, in MT4 i can send a widows event without any problems

I use OnTimer as well, that's why I try to receive a minimum data packet in the request, although at the current PC speed I may be getting greedy)))

When I tried to use OnTimer in MT5, the timer in the tester is generated without problems and it's a real pleasure to write under C# - I call .dll, immediately start the form and put all the graphics in a separate thread ( Thread ), after that you just work with data exchange between C# and MT5 and the graphical form with buttons works by itself as a usual Windows application - the request from MT5 only receives status of earlier clicked elements and nothing is slowed down ;)

I did it in five via a timer in the tester. Even its simple use (it's a millisecond multitimer) leads to a serious slowdown of the tester. Therefore, simply refused the timer in the visualizer - it's the same thing to work on ticks. Made two models - by timer and by flags events through OnTick(). By timer in real time, by ticks - in the visualizer.

Lies - three models - also through OnChartEvent() - only realtime there too.

 
Igor Makanu:

i failed to capture events in MT5, for some reason Spy++ cannot see chart events, it seems that self-written classes and event models are used rather than standard widows ones, in MT4 i can send a widows event without any problems

I use OnTimer as well, that's why I try to receive a minimum data packet in the request, although at the current PC speed I may be getting greedy)))

When I tried to use OnTimer in MT5, the timer in the tester is generated without problems, and it is a pleasure to write code under C# - I call .dll, immediately start the form and in a separate thread ( Thread ) all the graphics and that's all, now I just work with data exchange between C# and MT5, and the graphical form with buttons works by itself as a usual widow application - in MT5 request only the status of earlier clicked elements is sent, nothing is lags and will not lag ;)

If you also make Model at MQL level and other stuff at Sharpey, it will be great. Then the logic is separate, the view is separate. The frontend deals with design and usability and doesn't deal with the trading backend. Changing the configuration of buttons on a form or splitting a form into two or three should not affect the Expert Advisor's algorithms in any way.

 
Vasiliy Sokolov:

Peter, if you don't mind, I'll prepare an article on how a graphical application can be created quite easily in MQL, using the new feature of integration with .Net libraries. The title of the article will be "Creating custom forms in VisualStudio for trading experts based on .Net Framework and C#".

Your approach and your ideas fired me up. I wondered if it was possible to create a graphic form for my Expert Advisor quickly and easily, using only basic programming skills. I conducted an experiment, and it turned out that it is possible! I got a form like this:

The idea was that the user would draw the required form in the VisualStudio editor and all the necessary work of integrating this window with the MQL code would be done behind the scenes, in automatic mode. To do this, I had to write a C# controller - a kind of analogue of your kernel, however, it only takes about 200 lines of code.

You can read about how it all works in the article I've started.

That's it, Vasiliy, you've covered your kernel with a cauldron.

 
Dmitry Fedoseev:

That's it, Vassily, you've covered your head with a cinder block.

It's generally expected to end like this, but there's no specific article yet...

although there's a 99% chance such an article will come out before the kernel-engine. Peter needs to keep to the remaining percentage.

 
Artyom Trishkin:

I did in the five via the timer in the tester. Even just using it (and it's a millisecond multitimer) caused a serious slowdown of the tester. Therefore, simply refused the timer in the visualizer - it's the same thing to work on ticks. Made two models - by timer and by flags events through OnTick(). By timer in realtime, by ticks - in renderer.

ZS. I lie - three models - also through OnChartEvent() - there, too, only realtime.

I haven't decided on the design yet, I checked that it works in the tester without any problems, thanks to@fxsaber for his help with the #define code - I automatically add OnTick(), OnTimer() handlers when plugging the injector... so i can make the necessary calls in any section of the Expert Advisor

I don't even know where the lag may be? I use the timer quite often - 400 ms, but the call is only getting from the .dll 2 arrays int 10-ele-v and 2 int (how many buttons and how many checkboxes, such dimension of arrays), there simply physically can not slow down, because even write in the array if the button was clicked, and in the int number I send a button, the array is not needed in principle, as a precaution if the user has a nervous breakdown and it faster than 0.5 seconds will beat the button )))

I guess we have different tasks - when it comes to the construction of TS, you don't need graphics, and when it comes to debugging and visualization of TS, you don't need the speed of the tester ;)


Maxim Kuznetsov:

If you also make a MQL-level Model, and the rest in Sharpay, it would be great. Then the logic is separate, the view is separate. The frontend deals with the design and usability and doesn't get involved in the trading backend. Changing the configuration of buttons on a form or splitting a form into two or three should not affect the Expert Advisor's algorithms.

I will keep it as a nice post! And write it in the description, if I'm ripe for public comment

Reason: