Download MetaTrader 5
To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
Sya
56
Sya 2016.03.23 11:36 

Hello everybody present,

did anyone here succesfully apply this function? I'm always failing with it. Added a Comment-Request to be sure the function is reached and it verifies, but no action results.

I'm aware, the execution can take some time, but even after minutes the expert still stays with a happy face. Using the context-menu-removal, the program pretty soon bows out.

As there are no variables or options to be added, I can't image how to make a mistake with it.

whroeder1
13627
whroeder1 2016.03.23 13:13  

Sya:

did anyone here succesfully apply this function?

I'm aware, the execution can take some time,

I can't image how to make a mistake with it.

It works fine. Are you returning from start? The EA is immediately removed as soon as you do.

Sya
56
Sya 2016.03.24 10:47  

Thank you, WHRoeder, for your kind reply. It's nice to know, the function normally works. Otherwise I could have saved my time with further efforts.

It's implemented in an indicator, which is controlled by OnChartEvent, from where graphical buttons (CHARTEVENT_OBJECT_CLICK) lead to different functions. One of them is "void RemoveExpert ()" with the only code "ExpertRemove () ;" . And return of course.

Maybe in this case there is some buffer-overflow that interferes with the proper execution. I'll try it out within a simple test-program to get some clues. Should I finally succeed, I'll give some explanations about the solution.


As so far

Happy Easter to the Community

Keith Watford
Moderator
7947
Keith Watford 2016.03.24 11:26  
When testing your code with chart event Print(sparam) to make sure that the object you think is being clicked is the one recorded.
Drazen Penic
2406
Drazen Penic 2016.03.24 18:52  
Sya:

Thank you, WHRoeder, for your kind reply. It's nice to know, the function normally works. Otherwise I could have saved my time with further efforts.

It's implemented in an indicator, which is controlled by OnChartEvent, from where graphical buttons (CHARTEVENT_OBJECT_CLICK) lead to different functions. One of them is "void RemoveExpert ()" with the only code "ExpertRemove () ;" . And return of course.

Maybe in this case there is some buffer-overflow that interferes with the proper execution. I'll try it out within a simple test-program to get some clues. Should I finally succeed, I'll give some explanations about the solution.


As so far

Happy Easter to the Community

 

Documentation for the ExpertRemove()  says it removes expert advisor from the chart.

Check ChartIndicatorDelete() if you want to remove an indicator from the chart.

Sya
56
Sya 2016.03.25 01:53  


@iGumRa

Thanks for your thoughts about it. I had set a Comment to be sure execution reaches the right point.

If I use Print, as you recommend - where then do I find the result? I today made a Print be executed and then checked all files within Client Terminal folder, that had change-time since the Print was done, but found nothing appropriate.

Maybe because the Print was within a Script - I'm not yet accustomed to this and have to try out, what kind of program can produce print-results. There is a folder "log" with files date.log, I guess it should be there.


@drazen64

You are right with the removal of the indicator. But it's not that I want to remove the indicator. The indicator should remove the expert, the "ExpertRemove()" is within the indicator that reacts on ChartEvents.

For both - indicator and expert - are running on the same chart, I thought it would be clear for the indicator what it should do. In the manual the ExpertRemove() happens within an expert. Is it, that this function only works in the expert itself? Some kind of self-distruction so to say? Then I could set a Global Variabel out of the indicator to trigger the expert to finish, is this right?


Again, thanks to both of you for your help.


Keith Watford
Moderator
7947
Keith Watford 2016.03.25 02:21  
The Print will be in the Expert tab window
Drazen Penic
2406
Drazen Penic 2016.03.25 12:31  

You are right, ExpertRemove() removes expert that issues this command - it can't remove some other expert.

You need to use either global variables, either custom chart events (this is a more elegant solution). 

Sya
56
Sya 2016.03.28 18:16  

@iGumRa

The Print will be in the Expert tab window

Thank you, this really helps a lot!


@drazen64

either custom chart events (this is a more elegant solution). 

Elegant is always highly appriciated ☺. I read about those custom_chart_events, but have no experience for the time being. Maybe I'll have to come back with some questions upon this.

Good to know, what's considered the most professional solution. Thank you.


Hope, both of you had nice Easter days.

/
To add comments, please log in or register