I've developed systems (EAs) on several trading platforms for over 12 years -- but I'm still a clueless infant when it comes to Empty4's mysteries.
I've figured out some basics of writing MQL, and I've experimented with a number of things. Here are a few points that still confuse me:
* On Tradestation, I'm used to eyeballing the performance of a system by just throwing it on a chart. TS automatically runs it on the chart history and then keeps running as realtime ticks arrive. In almost all cases, that backtest is a very good representation of what would have happened in realtime. TS computes performance stats on the chart history so I can see how the system performed, tweak parameters, optimize, etc. Empty4 does that with indicators -- it plots the past history of the indicator and then displays the realtime values -- but it doesn't seem to do that with EAs. I think EAs only operate in realtime, without any performance stats available -- unless you run them in the Strategy Tester. (Correct?) I'm still figuring out the ST. Sometimes it works, sometimes it doesn't -- e.g. F6 is supposed to launch it from the current chart but it doesn't. So I launch it with Ctrl-R and specify the EA/etc to test. Testing on every tick is supposed to be the best way to get accurate results, but it's horrifically slow. Testing the recent Fratelli v2.5 EA on M15 bars, it takes over 30 minutes to test the last 3+ weeks. That's less than one bar per SECOND (!!!), and this is on a pretty capable new laptop. Am I doing something wrong? Or is this why EAs don't execute on historic bars?? On Tradestation, on the same laptop (in fact while Empty4 is still chunking away on its 1500-bar test) I can run a 50,000-bar test in 3-4 seconds.
* It seems the best/only? reliable way to verify a system is to forward-test it in realtime. Naturally I'd like to have half a dozen balls in the air all the time so I can be comparing EAs against each other. As far as I can tell, Empty4 is set up so you can only have one account open at a time, and all EAs on all charts will trade in that account. How can you run multiple simultaneous tests? Do you have to track which trades came from which EAs, and separate them out to calculate your own stats? Or do you have to install multiple copies of Empty4 on your computer? If so, do you have to install *different* versions (different brokers) or can you install multiple instances of the same copy?
* Is it possible to backtest an EA with e Strategy Tester and actually trust the results? Forward testing is a very weak way to verify a system. I want to see how it's performed over time, through a variety of market conditions. That might take months or years to happen in realtime.
* When I tried writing code for an indicator, I had mysterious results that turned out to be caused by Empty4 behavior I didn't expect. I thought it would run through the bars of history, from start until bar 1, invoking start() once per bar. Then I expected it to invoke start() for each realtime tick in bar 0. Well, it basically does that, but then it also periodically re-evaluates some number of bars, from the last 3 or 4 to the entire chart. This means any code that carries state forward -- like an EMA for example -- is going to generate bogus results because you re-evaluate some bars several times. I suppose you could keep an array of any values you need, instead of just keeping the "value so far" of your calculation. Is this the recommended way to design your code?
I'm sure I'll come up with more questions, but those are the ones bugging me now...
Thanks!
Gary
Need Dummy's Guide to Working with Empty4
-
garyfritz
Re: Need Dummy's Guide to Working with Empty4
Anyone? Anyone?
I kept digging and found an answer to one of my questions. It looks like you install multiple instances of Empty4 to have separate testing platforms.
I kept digging and found an answer to one of my questions. It looks like you install multiple instances of Empty4 to have separate testing platforms.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Need Dummy's Guide to Working with Empty4
Not a clue. Far too long a paragraph to maintain my interest and no experience of Tradestation.garyfritz wrote:I've developed systems (EAs) on several trading platforms for over 12 years -- but I'm still a clueless infant when it comes to Empty4's mysteries.
I've figured out some basics of writing MQL, and I've experimented with a number of things. Here are a few points that still confuse me:
* On Tradestation, I'm used to eyeballing the performance of a system by just throwing it on a chart. TS automatically runs it on the chart history and then keeps running as realtime ticks arrive. In almost all cases, that backtest is a very good representation of what would have happened in realtime. TS computes performance stats on the chart history so I can see how the system performed, tweak parameters, optimize, etc. Empty4 does that with indicators -- it plots the past history of the indicator and then displays the realtime values -- but it doesn't seem to do that with EAs. I think EAs only operate in realtime, without any performance stats available -- unless you run them in the Strategy Tester. (Correct?) I'm still figuring out the ST. Sometimes it works, sometimes it doesn't -- e.g. F6 is supposed to launch it from the current chart but it doesn't. So I launch it with Ctrl-R and specify the EA/etc to test. Testing on every tick is supposed to be the best way to get accurate results, but it's horrifically slow. Testing the recent Fratelli v2.5 EA on M15 bars, it takes over 30 minutes to test the last 3+ weeks. That's less than one bar per SECOND (!!!), and this is on a pretty capable new laptop. Am I doing something wrong? Or is this why EAs don't execute on historic bars?? On Tradestation, on the same laptop (in fact while Empty4 is still chunking away on its 1500-bar test) I can run a 50,000-bar test in 3-4 seconds.
It is no wonder nobody has answered your post. This is more of a rant than a question.I could answer all of the multi-parts but cannot be bothered. Start with the assumption that Empty4 is crap and will do bugger-all for you unless you force it to, and work out from there; you will not go far wrong.* It seems the best/only? reliable way to verify a system is to forward-test it in realtime. Naturally I'd like to have half a dozen balls in the air all the time so I can be comparing EAs against each other. As far as I can tell, Empty4 is set up so you can only have one account open at a time, and all EAs on all charts will trade in that account. How can you run multiple simultaneous tests? Do you have to track which trades came from which EAs, and separate them out to calculate your own stats? Or do you have to install multiple copies of Empty4 on your computer? If so, do you have to install *different* versions (different brokers) or can you install multiple instances of the same copy?
No need to be bloody silly. I assume you are here because of my former activites at FF. Did you take in nothing posted there about ST?* Is it possible to backtest an EA with e Strategy Tester and actually trust the results?
Welcome to the wonderful world of Empty4 and mql4 coding. I would say, "Have fun" but you have to be a seriously warped and twisted individual such as me to actually enjoy coding this stuff.* When I tried writing code for an indicator, I had mysterious results that turned out to be caused by Empty4 behavior I didn't expect. I thought it would run through the bars of history, from start until bar 1, invoking start() once per bar. Then I expected it to invoke start() for each realtime tick in bar 0. Well, it basically does that, but then it also periodically re-evaluates some number of bars, from the last 3 or 4 to the entire chart. This means any code that carries state forward -- like an EMA for example -- is going to generate bogus results because you re-evaluate some bars several times. I suppose you could keep an array of any values you need, instead of just keeping the "value so far" of your calculation. Is this the recommended way to design your code?
I'm sure I'll come up with more questions, but those are the ones bugging me now...
Thanks!
Gary
Maybe 'Good luck' is more appropriate.
I am not kidding. Empty4 and mql4 are serious crap. I overcome them through: brute force; sq; George.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Need Dummy's Guide to Working with Empty4
You could always go to the source. http://book.mql4.com/ I haven't read any of it, but you never know.garyfritz wrote:Anyone? Anyone?
I kept digging and found an answer to one of my questions. It looks like you install multiple instances of Empty4 to have separate testing platforms.
George
-
garyfritz
Re: Need Dummy's Guide to Working with Empty4
I haven't read all of it, George, but I've read a good bit of it. Other than a few introductory concepts, it tends to be the "the xyz() function does xyz" type of documentation. I didn't see much how-to content.
Steve, I've only been stumbling around in Empty4-land, including FF, for a couple of weeks. No, I really haven't seen anything in FF about ST yet. I have gotten absolutely no paying work done in the last week because I keep writing indicators and getting sucked into different threads about various EAs, techniques, etc. I'm in a "learn everything in sight" mode right now and there's a lot to learn.
Your comment about "Empty4 is crap" is not encouraging. I'm here for two reasons: 1) the Empty4 community is a goldmine of creative traders and great ideas, and 2) I want to be able to auto-execute some simple EAs. Tradestation theoretically supports that, but in reality it's not a safe platform for unattended execution. Many people run unattended EAs on Empty4 so I thought this might be a good option for execution. I'm hoping it still is but I'm less sure.
Let me break down some of my questions:
* It's taking me 30 minutes to run ST on an EA on 3 weeks of M15 data. Is that expected? I was hoping maybe I had something configured wrong and it's supposed to run a lot faster than that.
* Is there anywhere that explains how Empty4 executes -- how it steps through historic bars, how it behaves once realtime ticks arrive, when it's likely to re-execute some or all of the bars, what's a good way to work with this execution model, etc? Or is that just hard-earned lore that you have to figure out by yourself?
Thanks gents,
Gary
Steve, I've only been stumbling around in Empty4-land, including FF, for a couple of weeks. No, I really haven't seen anything in FF about ST yet. I have gotten absolutely no paying work done in the last week because I keep writing indicators and getting sucked into different threads about various EAs, techniques, etc. I'm in a "learn everything in sight" mode right now and there's a lot to learn.
Your comment about "Empty4 is crap" is not encouraging. I'm here for two reasons: 1) the Empty4 community is a goldmine of creative traders and great ideas, and 2) I want to be able to auto-execute some simple EAs. Tradestation theoretically supports that, but in reality it's not a safe platform for unattended execution. Many people run unattended EAs on Empty4 so I thought this might be a good option for execution. I'm hoping it still is but I'm less sure.
Let me break down some of my questions:
* It's taking me 30 minutes to run ST on an EA on 3 weeks of M15 data. Is that expected? I was hoping maybe I had something configured wrong and it's supposed to run a lot faster than that.
* Is there anywhere that explains how Empty4 executes -- how it steps through historic bars, how it behaves once realtime ticks arrive, when it's likely to re-execute some or all of the bars, what's a good way to work with this execution model, etc? Or is that just hard-earned lore that you have to figure out by yourself?
Thanks gents,
Gary
-
garyfritz
Re: Need Dummy's Guide to Working with Empty4
The performance issue I've been seeing may be due to the EAs I've been running. I've experimented with 5 or 6 different EAs and they all seemed extremely slow. I just tested a simple MA-cross EA and it ran significantly faster -- about 4-5 seconds after collecting data for the same 3-week M15 test instead of 30 minutes. Still not blazingly fast but a huge improvement.
So it appears Empty4 itself is not inherently slow. Apparently something in the EAs I've looked at is the culprit.
So it appears Empty4 itself is not inherently slow. Apparently something in the EAs I've looked at is the culprit.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Need Dummy's Guide to Working with Empty4
I apologise unreservedly for my previous comments. I leave them in place only so that people can see what I am apologising for.
Welcome to my world. Are you sure you want to stay here?

You can run a test in st and derive one result. Then, you can run exactly the same test a few seconds later and get a radically different result. Note that st uses the current spread, not that in force at the time you are testing. Using st at weekends is a real blast. St is slow and useless. It is valuable only in helping coders check that their code is correct. It has not other value.garyfritz wrote:I've developed systems (EAs) on several trading platforms for over 12 years -- but I'm still a clueless infant when it comes to Empty4's mysteries.
I've figured out some basics of writing MQL, and I've experimented with a number of things. Here are a few points that still confuse me:
* On Tradestation, I'm used to eyeballing the performance of a system by just throwing it on a chart. TS automatically runs it on the chart history and then keeps running as realtime ticks arrive. In almost all cases, that backtest is a very good representation of what would have happened in realtime. TS computes performance stats on the chart history so I can see how the system performed, tweak parameters, optimize, etc. Empty4 does that with indicators -- it plots the past history of the indicator and then displays the realtime values -- but it doesn't seem to do that with EAs. I think EAs only operate in realtime, without any performance stats available -- unless you run them in the Strategy Tester. (Correct?) I'm still figuring out the ST. Sometimes it works, sometimes it doesn't -- e.g. F6 is supposed to launch it from the current chart but it doesn't. So I launch it with Ctrl-R and specify the EA/etc to test. Testing on every tick is supposed to be the best way to get accurate results, but it's horrifically slow. Testing the recent Fratelli v2.5 EA on M15 bars, it takes over 30 minutes to test the last 3+ weeks. That's less than one bar per SECOND (!!!), and this is on a pretty capable new laptop. Am I doing something wrong? Or is this why EAs don't execute on historic bars?? On Tradestation, on the same laptop (in fact while Empty4 is still chunking away on its 1500-bar test) I can run a 50,000-bar test in 3-4 seconds.
Please see coloured replies above.* It seems the best/only? reliable way to verify a system is to forward-test it in realtime. Yes. Naturally I'd like to have half a dozen balls in the air all the time so I can be comparing EAs against each other. As far as I can tell, Empty4 is set up so you can only have one account open at a time, Yes. and all EAs on all charts will trade in that account.Yes. How can you run multiple simultaneous tests? Do you have to track which trades came from which EAs, and separate them out to calculate your own stats? Yes. You can use different magic numbers Or do you have to install multiple copies of Empty4 on your computer? If so, do you have to install *different* versions (different brokers) or can you install multiple instances of the same copy?Don't know what you mean
More coloured replies.* Is it possible to backtest an EA with e Strategy Tester and actually trust the results? No Forward testing is a very weak way to verify a system. I want to see how it's performed over time, through a variety of market conditions. That might take months or years to happen in realtime.Yes.
Welcome to my world. Are you sure you want to stay here?
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
- SteveHopwood
- Owner
- Posts: 9904
- Joined: Tue Nov 15, 2011 8:43 am
- Location: Misterton - an insignificant village in England. Very pleasant to live in.
Re: Need Dummy's Guide to Working with Empty4
Code an ea that relies on custom indis and your computer will slow to a crawl. Here is the text that I copy to people when explaining this:garyfritz wrote:The performance issue I've been seeing may be due to the EAs I've been running. I've experimented with 5 or 6 different EAs and they all seemed extremely slow. I just tested a simple MA-cross EA and it ran significantly faster -- about 4-5 seconds after collecting data for the same 3-week M15 test instead of 30 minutes. Still not blazingly fast but a huge improvement.
So it appears Empty4 itself is not inherently slow. Apparently something in the EAs I've looked at is the culprit.
"The problem with custom indis is one that lies at the heart of Empty4. When an EA consults an indicator, the platform loads it into memory, then unloads it again once it has responded to the EA call. This takes time.
Custom indis typically consist of a number of calls to the regular indicators that ship with Empty4, and manipulate the information thus gleaned according to what the coder requires. An indicator such as AllAverages will make a number of calls to standard indicator at each tick; each indi is loaded, used, then unloaded. This takes a long time.
An EA that includes calls to a custom indi such as AA makes the problem a little worse still because it makes a call to AA, then Empty4 loads it into memory, returns the result of the call to the EA, then unloads the indi. Ridiculous, but that is how it works, and is the reason that indis such as AA and VQ slow your machine.
And then, we put the EA on multiple charts................................."
Welcome to my world. Or, if I have already said this and I neither know nor care, welcome to my world again.
Now, you didn't much like it when I first told you that Empty4 is total crap, but this is a fact. Empty4 is total crap and if you want to code for it you have to understand this. Your life will be an endless battle against it. It is total crap because the criminals want it to be so; they make more money by providing a crap platform that they can manipulate against traders, and'or that is systemically designed to work against their 'valued clients'.
have fun. I do, but then I know what I am getting into.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.
To see The Weekly Roundup of stuff you guys might have missed Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.
-
garyfritz
Re: Need Dummy's Guide to Working with Empty4
Then I have to ask... why do you stay?SteveHopwood wrote:Now, you didn't much like it when I first told you that Empty4 is total crap, but this is a fact. Empty4 is total crap and if you want to code for it you have to understand this. Your life will be an endless battle against it. It is total crap because the criminals want it to be so; they make more money by providing a crap platform that they can manipulate against traders, and'or that is systemically designed to work against their 'valued clients'.
There are other alternatives. Have you ever looked at Tradestation? It's free for FX. Tradestation's FX brokerage is quite good, I believe. Typical spreads are good -- currently (23:50 GMT) about 1.5pip for USDJPY, 1.8pip for EURUSD, better during Euro hours. Fills are good. In several hundred real-money trades, I've averaged 0.45 pips of "slippage" on stops -- difference between my EA's entry price and my fill. And that included all extraordinary fills during spikes and interventions, screwups on my part, etc.
IMHO TS's platform utterly obliterates Empty4. In terms of power, flexibility, ease of use, and reliability, it's not even in the same league. It certainly has its issues, but as you said, so does Empty4 in spades.
Probably the biggest advantage of TS is its backtest abilities. As I said, I can place a strategy (TS-speak for an EA) on a chart and almost instantly see how the strategy performed in the past. I just opened a 5-year chart of M15 EURUSD and applied a fairly complex strategy to it. The strategy executed on the 125,000-bar history in about 7 seconds. Then I could see on the chart exactly what it did, see extensive statistics, trade listings, equity curves, etc. Since it's so fast, you can do extensive optimization runs if you want.
More importantly, the backtester WORKS. With very few exceptions (such as multiple stops within a single bar), the default settings of the backtest produce results that are extremely close to what you would have gotten in realtime. If that's not good enough, you can have the system evaluate your strategy at a finer level of resolution, all the way down to tick level. (Obviously that runs a lot slower than testing at a bar level. But for most situations it's not necessary.)
You don't have to turn an EA loose on a demo account and watch it in realtime, hoping that the realtime market conditions will exercise the EA sufficiently. You can run it on months or years of history and be confident that the results it reports are VALID.
TS has the disadvantage that you are tied to the TS brokerage, at least if you use the built-in order mechanisms. It's possible to use add-on tools to execute your orders on NinjaTrader or other gateways. TS also has some challenges in automated unattended execution, but those can be worked around -- easier, I think, than you work around the issues with Empty4.
I originally came here because of the wealth of sharing and great ideas, and that's been great. The creativity and open sharing here are wonderful. I also came because I thought Empty4 might be a simpler solution for auto-executing simple EAs. You're telling me that's not the case. So, I invite you to take a look at Tradestation. Obviously you would have a learning curve, and I'd be happy to help with that if you want. But writing basic strategies in TS is VERY simple compared to the thousand-line behemoths I see here all the time. There are some things about the TS EasyLanguage that you would miss (the C capabilities in particular) but I believe you'd find you'd gain much more than you'd lose.
I'm not a Tradestation salesman. But the things you excoriate Empty4 for are just not issues on TS. Your life might be much easier if you tried a better platform.