| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| My shell EA code https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=79 |
Page 23 of 23 |
| Author: | K-Lander [ Thu Jun 18, 2020 5:28 pm ] |
| Post subject: | My shell EA code |
Hi Steve, Attached I am sending Bare Bones with a working ForceSleepUntilNextBar feature. A friendly reminder to anyone using the shells: Remember to DELETE the failsafe on the code (you´ll find it within the LookForTradingOpportunities function). Nothing will ever trigger a trade unless you do it (I forgot about it and took me 2 hours to figure out why the bugger doesn´t fire). Thanks for the help Steve, and for the coding lesson. All the best, and stay safe in these strange times. Ariel
|
|
| Author: | simplex [ Sat May 13, 2023 4:49 pm ] |
| Post subject: | Re: My shell EA code |
Hi all, I'm just working my way through this formidable piece of software. Stumbled over the object handling functionality: Code: Select all So that return value is not -1 necessarily. Maybe it's worth considering to replace Code: Select all Code: Select all There are several similar ObjectFind calls in the source code. |
|
| Author: | SteveHopwood [ Mon May 15, 2023 7:34 pm ] |
| Post subject: | Re: My shell EA code |
Thanks for this. Brilliant point. I am not going to do anything with this immediately as I can make the changes as I use the code. Plus, anyone such as yourself, can read your post and make the changes themselves. Anyone who cannot, cannot use the shells. Thanks again. Hugely appreciated. |
|
| Author: | simplex [ Tue May 16, 2023 12:28 pm ] |
| Post subject: | Re: My shell EA code |
Agree & thanks! Now for my next find, which dives a little bit deeper in the trading logic. See function LookForTradingOpportunities(): Code: Select all Code: Select all This may work in a perfect world. But let's assume we as coders implement some sort of faulty logic when it comes to analyse the market for entry opportunities. Allright: this is highly unlikely, but let's just assume the impossible is happening: our trading logic issues a buy and a sell signal at the same time for a given pair. In above logic, the long trade will be placed, while the short trade is silently ignored. Do I want that? Don't know about you, but I do not. What I find alarming most of all is the fact that ignoring the short trades obviously happens silently. Maybe there are security checks later on dealing with such a situation, which I possibly am not aware of yet. Anyway, I believe it's better to deal with this case before actually placing trades. So this is my proposal to (hopefully) improve that bit of the shell code: Code: Select all I'm just working on this mod, it's not yet ready, but I'd like to discuss my proposal here, before possibly running (coding) into a completely wrong direction. Maybe this idea is worth to find its way into the shell itself, not only in my upcoming EA's. In the end, it makes the shell a bit more foolproof (which suits me perfectly!), because it deals with a faulty signal logic in a more appropriate manner as compared to just ignoring it. |
|
| Author: | simplex [ Sun Nov 10, 2024 6:06 pm ] |
| Post subject: | Re: My shell EA code |
Still using the incredible Barebones 17-6-20.mq4 once in a while as a reference for certain tasks in MT5. So just today I stumbled over the following code, which I believe contains a bug. Please refer to function Code: Select all Code: Select all Cheers, sx |
|
| Author: | SteveHopwood [ Sun Nov 10, 2024 8:12 pm ] |
| Post subject: | Re: My shell EA code |
I have been coding this stuff for about 16 years now and still am not sure about the answer to your question - one I have asked myself umpteen times over the years. Notice the comment following this line of code: if (Bid <= sl - (TrailingStopPips / factor))//George George was SHF member gaheitman. At the time, he knew more about coding than most of us here. He was most helpful and I adopted anything he suggested. Sadly, he has not visited here for more than 5 years, so I guess that age took its usual toll. It is coming to us all but I still think about him every time I use one of the shells. These days, I code closing buys at the Bid and sells at the Ask with one difference. I use the minimal spreads of Afterprime to minimise any damage that my possible misconceptions might cause. Sorry not to be more definitive in my answer. Of course, none of this really matters unless: an EA responds to lines drawn on a chart to crossing said tpsl lines to close a trade - those are a real headache; your broker is a criminal and the spreads are monumental - bugger all I can do about that. I hope this helps whilst not being sure it will. |
|
| Author: | markft [ Mon Nov 25, 2024 2:25 am ] |
| Post subject: | Re: My shell EA code |
If I understand correctly from the code section, this is where we are managing the trailing stop for a Sell order. Yes I think you are right and that should be the Ask, as we would be executing a market order to buy, to close the sell, at the Ask price. That being said, as Stave mentioned, this is usually not significant almost all of the time, unless somehow the spreads have widened a lot. |
|
| Author: | SteveHopwood [ Sun Dec 22, 2024 3:43 pm ] |
| Post subject: | Re: My shell EA code |
The latest updates to the shells are in post 1 - "Updated versions 19th Dec 2024.zip". nwesterhuijs wrote to me nearly 3 years ago pointing out a missing doubles conversion of its extern int. This line needed adding to OnInit(): DistanceBetweenTrades = DistanceBetweenTradesPips; This only applies to the versions that include grid trading. Thanks Norbert. Sorry it has taken me so long to get around to this. ----- A very minor issue. Those of you using the shells are familiar with the, "Expression not boolean" warning when compiling. I had coded return(0) instead of return(true) and so have corrected this. ----- The next update is a big one for grid trading. I recently coded an ea for one of our members that works on grid stop orders. Taking a buy stops as an example, the first stop in the grid would fill then the market would fall and leave a large gap in between the market and the open market order. The ea would send a new stop order to fill the gap. Never mind the details, but in a complicated position there could be bunches of stop and market orders close together - not something we wanted. Nothing I coded would stop this happening. I have been playing with grids of stop orders on XAUUSD and wanted a simple expert with buttons on the chart, to send and delete grids at the click of the relevant button. I used a lot of the code from one of my grid-sending scripts and noticed that the stops never bunched if I added more stops. I looked into the DoesTradeExist() function and saw that shf member odrisb had solved the problem for me. Goodness knows when but a long time ago and I had forgotten. I added this to the ea I described earlier and the bunching problem was instantly solved. This was an invaluable contribution odrisb, so many thanks. This only applies to the grid trading versions. ------ Those of you who use the LotsPerDollopOfCash feature are familiar with it not working properly. For example, using 0.01 lots per $1,000 would see the lot size increasing to 0.02 when your choice of the balance or equity reached $1,500 rather than waiting until it reached $2,000. I finally sorted this out in developing the ea I described earlier, so I have updated all versions. |
|
| Author: | SteveHopwood [ Thu Jan 16, 2025 1:53 pm ] |
| Post subject: | Re: My shell EA code |
The latest zip file is in post 1 - "Shell codes updated 16th Jan 2025.zip" They fix a tiny bug that I have been meaning to correct for ages, but forget about until it causes me to spend a frustrating couple of hours thinking that the is a bug elsewhere. Guess why I suddenly remembered again. You do not need to download if you can already use the shells. The bug was in this code block: Code: Select all if (OrderOpenPrice() < LowestSellStopPrice) You do not need the download as you are already using the shells. The DIY is to do a search for: if (OrderOpenPrice() > LowestSellStopPrice) Then change '>' to '<'. |
|
| All times are UTC | Page 23 of 23 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|