| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| ExpertRemove() ...... or maybe it doesn't!! https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5399 |
Page 1 of 1 |
| Author: | Bruster400 [ Thu Feb 15, 2018 9:11 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
Hi, In my manual trading, I like to make things as easy as possible so I've coded a number of scripts to help me place trades and adjust stops etc. However, I've recently coded a couple of very simple EA's to wait for the right time to enter and then place the trade before removing themselves much like a script would. An example of the code from one that opens a trade on the next Heiken Ashi change for example would be: Code: Select all Code: Select all It seems that ExpertRemove(); has not done a full job of removing it. If I look at the chart there is no evidence of the EA in the top right hand corner and there is no Expert Properties in a right click context menu. However, if I open up the profile file and read the entry for that chart, the EA is shown as loaded! Does anyone else have any experience of using ExpertRemove and is there something else I should be doing? I did have my computer crash yesterday (which means the profile wasn't saved on exit) which might explain it but I'd assumed that if the EA was in the chart's profile then it should show on the chart? I've manually deleted it from the profile which has stopped the issue but I thought I'd flag it in case anyone else is using helper EA's or has seen this issue before. Bruster |
|
| Author: | renexxxx [ Thu Feb 15, 2018 10:52 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
Have you considered sleeping a little bit? The trade has just been sent, you got a ticket number, but it might still be waiting for an acknowledgment from the server. Have you tried this: Code: Select all |
|
| Author: | Bruster400 [ Thu Feb 15, 2018 11:09 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
Thanks Rene, I'll give that a go of course but it doesn't seem to be placing a trade that it has an issue with and I don't do anything with the trade after it is placed. I actually have a "sleep" in after the trade is placed but didn't post that code (sorry). Code: Select all I'm going to check the profile files for each chart that I use it on over the next couple of days to see if the EA is fully removed at the time or whether it needs the profile to be saved to complete it. I feel that it has something to do with my computer crash yesterday but it didn't happen while I was using the EA so that may be a dead end too. |
|
| Author: | SteveHopwood [ Thu Feb 15, 2018 11:37 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
The documentation led me to believe that ExpertRemove() will not work until the EA has completed its thread, whatever that means. The practical effect is that the call does not always succeed. I declare bool RemoveExpert=false; in the general declarations space, then place this construct at the top of OnTick()/Timer() : Code: Select all I think. :youknow: It seems to work. |
|
| Author: | Bruster400 [ Fri Feb 16, 2018 9:14 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
Thanks Steve, I'll build that in and see if it helps. The return might be the issue but I'm surprised that the EA needs to complete after it's been removed.... still, this is Empty4 we're dealing with here..... Bruster |
|
| Author: | Bruster400 [ Tue Mar 06, 2018 9:44 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
Just to close off this topic, I've found the issue so thought I'd share. The problem was caused by my computer crashing. It didn't crash whilst the EA was exiting or anything like that it's actually that the profile does not get updated until you manually close Empty4. Until then, even though the EA has exited from your chart, the chart details in the profile do not reflect this until you close Empty4. If your PC crashes, when you re-open Empty4 the EA will still be functioning on the chart even though it will not be showing any signs of being loaded. I've tested this with both the ExpertRemove function in an EA and actually manually removing the EA - the effect is the same - the EA is not fully removed until a manual shut down of the platform - or loading another EA to that chart. Worth knowing. |
|
| Author: | SteveHopwood [ Tue Mar 06, 2018 10:10 am ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
That is indeed useful to know. Remove an EA from the chart and follow that up by shutting down and restarting the platform. Or, to be really sure the EA is removed:
|
|
| Author: | tomele [ Tue Mar 06, 2018 2:24 pm ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
That leads to an idea. We could have an EA that does nothing than immediately removing itself. We could use that one to kill any EA probably running in the background. |
|
| Author: | fx805 [ Thu Mar 15, 2018 7:20 pm ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
I was thinking the same thing as tomele... Could we remove have a functioin that calls the ExpertRemove() funtion ---then next in the function have it call and open another "dummy" ea .. This new dummy EA does nothing other then over write the first EA (essentially removing it from the profile and placing the new "dummy' ea on the chart... Since the new dummy ea does nothing-- though its there-- you cant get into trouble with mystery trades being placed by the Orginal EA you didnt know was still lurking in the background.. We might not be able to call a EA but would the act of calling an indicator or script (even to just write "your safe no EAs active") on the screen... Would that be enough to overwrite the removed EA from the profile? |
|
| Author: | SteveHopwood [ Thu Mar 15, 2018 7:47 pm ] |
| Post subject: | ExpertRemove() ...... or maybe it doesn't!! |
It is not a complicated business. You can always just close down the chart, then the platform. Empty4 is such utter, total bollocks that you should close and restart the platform every time you set up anything that remotely appears clever, complicated, or above the understanding of a newt before the damn thing receives the next tick. Platform I mean, not newt. No idea whether newts receive ticks or not. I hope they enjoy the experience, if they do. If instead you absolutely insist on refusing to recognise the Total Bollockhood of Empty4 and do not carry out the steps I outlined above, you can always try the attached EA. It took about 30 seconds to code it in response to an earlier post, and because I was bored. It took about 30 seconds more to forget about it because I am not an idiot (my assertion only and open to debate) and have a fair few ideas about how to combat the Cretins at Crapperquotes. The latest post here reminded me about it and so I post it here for your delectation and await your gales of warm applause for such a technically advanced piece of hitherto unbelievably-concepted piece of kit. Rene is currently gasping in amazement at it and wondering, "Now why did I never think of that?" My expertise knows no bounds. In case any of you are daft/inexperienced enough to still be wondering: yes, I have imbibed tonight. There could be more nonsense to come. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|