An object oriented language for Empty4

Post Reply
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: An object oriented language for Empty4

Post by NeoTrader »

hi Roger,
roger-write wrote:It may not be quite as impressive as you might think. Oq parses primarily the class structure elements but mostly leaves the contents of the body of the methods/functions intact. In other words, I don't parse out every name, token and expression, etc in the flow of code. Oq will take the body of a class method/function and copy it straight into mql. The only exception to this is that it will scan for the @ and : characters and do some replacements based on the surrounding names. But for the most part, once you're inside a class method, the code looks exactly like mql with the mentioned exceptions.
OK...now I understand...and it makes sense.. ;)
roger-write wrote:As for converting from mql to oq, you can actually take your existing mql code and run it thru oq without any issue, because anything outside the class {} construct will just get passed straight thru anyway. A good way for coders to start getting accustomed to oq might be to simply take an existing ea or indicator's code and set it up to build thru oq. Then they can start experimenting with a class here or there as needed. But hopefully the reboot, documentation, and examples will go a long way in helping people get accustomed to it. But the existing base of code should co-exist just fine inside oq.

Hopefully this makes sense.
It makes completely sense. Does this also mean that we could use OQ eventually with a continuous integration system later on if we have different libraries and create on top of these indicators, EA's or whatever?
roger-write wrote:One last thing. The rebooted oq will have types of classes called templates. There will be a standard template definition for, say, a trader mechanism or a signal, or an ea manager, etc. When the time comes, I really would like input from coders on defining the various templates. Once these are defined, then lets say a coder wants to create a new signal module for NB's 10.4 system, then all they do is follow the spec for the signal template (what methods are required, etc) and then anyone using oq could simply plug in the new signal and their EAs or indicators become NB 10.4 aware, so to speak.
The Template Idea sounds really great. Please don't forget to document this functionality and add also some implementation examples to it. It is sometimes a little difficult to grasp new concepts when you don't have proper examples and/or use-cases.

Regarding your inputs from developers. If our platform is running we will have a idea management system up and running. I think your whole project could be a great asset in our toolset and you could use the infrastructure to get more input on different topics and discuss it also there.

Did you have by any chance the opportunity to look into other Trading Platforms who already implemented OO based Languages (and I don' think about MT5 here.. ;) e.g. NinjaTrader which is based on C#).
Maybe you can get also some Ideas out of their OO implementations.

Thanks again for your creative work and keep it up...


happy trading,

Robert

-
roger-write
Trader
Posts: 63
Joined: Sat May 19, 2012 10:34 am

Re: An object oriented language for Empty4

Post by roger-write »

NeoTrader wrote:It makes completely sense. Does this also mean that we could use OQ eventually with a continuous integration system later on if we have different libraries and create on top of these indicators, EA's or whatever?
If I understand Continuous Integration properly, then I believe so. In the build file, you can name modules individually, or whole directories that contain a subsystem with multiple modules. These get included into the project. So, for example, let's say you've developed a sub-system for, say, harmonics analysis. As long as someone using oq has your set of source files in a directory, all they have to do is name the directory in the build file and it sucks in your module. Obviously one subsystem may depend on another and that will all have to be documented in the subsystem description, etc.

And when including some new subsystem, obviously there will need to be some work to stitch it up to your EA or indicator's processes. But if a module uses a predefined template class and your code already talks to the template definition, then there can literally be plug and play stuff.....but i'm getting ahead of myself, since I don't currently have documentation and examples to back all this up.
NeoTrader wrote:The Template Idea sounds really great. Please don't forget to document this functionality and add also some implementation examples to it. It is sometimes a little difficult to grasp new concepts when you don't have proper examples and/or use-cases.
I agree. That's one reason I'm going back to the drawing board. I want to make sure oq is correct and then provide docs and examples.
NeoTrader wrote:Regarding your inputs from developers. If our platform is running we will have a idea management system up and running. I think your whole project could be a great asset in our toolset and you could use the infrastructure to get more input on different topics and discuss it also there.
Yes, that will be a great asset to have that kind of collaboration.
NeoTrader wrote:Did you have by any chance the opportunity to look into other Trading Platforms who already implemented OO based Languages (and I don' think about MT5 here.. ;) e.g. NinjaTrader which is based on C#).
I seriously considered Ninja and would have liked nothing more than to jump the Empty4 ship, scrap this project and embrace a real trading development environment. But after lots of consideration, realizing that it would be quite limiting from a broker standpoint, etc., is why I decided to stay the course. I haven't studied Ninja in any great detail, but it would probably be useful at some point. I know C#, so by that virtue, I know what their language looks like. oq is based somewhat loosely on C# as well.

But some things are emerging with oq that I didn't anticipate when I first started this project that are sort of cool. These things aren't really a "standard practice" sort of thing in OOP, but it's sort of like the language is here to serve the coder and so I might as well make it do what makes sense for it to do. Anyway, I'm starting to ramble. More on this later when I have actual documentation and examples.
User avatar
NeoTrader
Trader
Posts: 436
Joined: Wed Apr 04, 2012 2:52 pm
Location: small Village at Lake Chiemsee, Bavaria, Germany

Re: An object oriented language for Empty4

Post by NeoTrader »

Hi Roger,

I stumbled over an Article on the mql4.com site quite a while ago and I just remembered it and thought that you can maybe get some inspiration out of it for your Project.

It is called Object Approach in MQL.

Keep up the good work.


happy trading,

Robert

-
roger-write
Trader
Posts: 63
Joined: Sat May 19, 2012 10:34 am

Re: An object oriented language for Empty4

Post by roger-write »

NeoTrader wrote:I stumbled over an Article on the mql4.com site quite a while ago and I just remembered it and thought that you can maybe get some inspiration out of it for your Project.
Actually, the author of this article would no doubt be pleased that oq is being developed. It solves exactly what is being said. Notice section 2. with the switch statement. Oq builds the switch statements under the hood, so to speak. I used to do this manually and thought, "gee, why can't there be something that does this for me...."

Nice find on the article. Thanks.
User avatar
bodleytunes
Trader
Posts: 68
Joined: Tue Oct 02, 2012 8:38 am
Location: Stockport

Re: An object oriented language for Empty4

Post by bodleytunes »

Interesting stuff.

OO programming blows my tiny mind though as I'm just a hobbyist where my paid job is on Networks. My developer colleagues where I used to work tried to give me tips on how to program OO. In the end though, I spend much more time trying in vein to think how an object oriented programmer would tackle the problem in hand, rather than actually coding :(

I'm currently trying to port some EA's over to Dukascopy which uses Java (JForex)

I like Java very much, as even though I originally learned with C#, I'm very much anti-microsoft, and hate being a slave to Windows, so my main languages of interest are Java and Python because they are OS independent and very Linux friendly.

I just wish all brokers had a standard platform with API's for all the main languages.

That would be:

Java
C#
and Python - because its just great!!

Then the world would be a better place :D :ugeek:

Cheers!

Bod.
roger-write
Trader
Posts: 63
Joined: Sat May 19, 2012 10:34 am

Re: An object oriented language for Empty4

Post by roger-write »

For those interested in the ObjectQuotes project, I've been pretty busy behind the scenes, working full time on this. I'm nearing completion of a complete rewrite of the oq.exe program with the following goals:
  • Make it more accessible to coders
    + Import feature for existing mql projects
    + Commands for creating new empty shell projects for experts, indicators and scripts
    + Commands for working with the build file
  • Make it more about a better coding environment as opposed to ONLY being about object oriented
  • Improving the foundational concepts
  • The addition of native classes (this will grow over time) and are classes and functionality which has broad general appeal to coders and will natively be available as part of OQ
  • Build-in dynamic hierarchical resources (I know, a mouthful, right? - I promise it's cool stuff)
  • Build in object tree persistence for allowing coders to create class structures with persistence, meaning if you turn off your computer, get back into Empty4 and your EA, it will pick up exactly where it left off without missing a beat
  • Better plug-and-play module creation
  • Ability to override Empty4's built in functions if the coder chooses
While the new oq.exe program is almost done, I still need to create the coders guide and provide examples before the official 0.98 release. Starting Monday, I won't be able to work on this full time anymore as I am starting a long-term engineering contract. Have to pay the bills and all that. So I'll be going at a slower pace.

Once OQ 0.98 is released, work begins on what I'm calling the ObjectQuotes Standardized Templates. These will be template classes of various trading categories (think Trader, Signal, Study, EA Manager, etc.) and will essentially define how each of these interact with the client code using them. This will form the basis of the community sharing of modules for those who choose to adopt the OQ methodology. Over time, as a community these standardized templates will no doubt evolve based upon our collective thoughts and ideas.

So, it's in the works and will get there eventually.

Peace out!
User avatar
snailbeard
Trader
Posts: 615
Joined: Mon Dec 24, 2012 10:54 am
Location: Just above water somewhere between Oxford & Cambridge

Re: An object oriented language for Empty4

Post by snailbeard »

Hi Roger,

Its very generous of you to share this project with the forum.

MQL makes me cry with frustration: after 20 years of OO S/W development myself - what a headache - so much typing to do basic things in MQL! And global variables all over the place!

I really want to migrate to a better platform, but if I cannot then this could really help improve my productivity and maybe help in the migration stages.

Perhaps it is possible to abstract the trading logic at a higher level so that migration is more straight forward in the future.

Anyway I look forward to trying out your framework when my current EA is regularly making a few pips, as I have a list of potential enhancements in my head, or should I just start from fresh on a proper trading platform - its difficult to know.

I look forward to exploring this in the future.

Brian
roger-write
Trader
Posts: 63
Joined: Sat May 19, 2012 10:34 am

Re: An object oriented language for Empty4

Post by roger-write »

snailbeard wrote:Hi Roger,

Its very generous of you to share this project with the forum.

MQL makes me cry with frustration: after 20 years of OO S/W development myself - what a headache - so much typing to do basic things in MQL! And global variables all over the place!

I really want to migrate to a better platform, but if I cannot then this could really help improve my productivity and maybe help in the migration stages.

Perhaps it is possible to abstract the trading logic at a higher level so that migration is more straight forward in the future.

Anyway I look forward to trying out your framework when my current EA is regularly making a few pips, as I have a list of potential enhancements in my head, or should I just start from fresh on a proper trading platform - its difficult to know.

I look forward to exploring this in the future.

Brian
Yes, all the things you mentioned have gone through my mind as well - whether to switch or not. But every time I get serious about switching to another platform I realize that the brokers are limited and there is less available in the way of indicators/EA/code, etc. Ultimately this is what led me to the OQ project. I'm still moving forward on it, but slower now that I can't work full time. Plus I keep thinking of additional very useful features to add which are sort of "low hanging fruit", so the OQ spec keeps expanding a little bit further in typical programmer feature-creep manner. For example, the latest thing I added was a way to do callback functions on standard flat MQL functions. I suspect there are those out there that may never embrace OO, which is fine. A perfectly sensible argument could be made for a pure function based language. So, adding things like callbacks could be very useful to them.

At any rate, I'll keep things posted as I progress.
eigenvector
Trader
Posts: 20
Joined: Sat Jul 14, 2012 3:14 pm

Re: An object oriented language for Empty4

Post by eigenvector »

Hello Roger,

I admire the ambitious nature of the project. Anything that can make a developer's life easier with regards to creating MQL4 code is greatly appreciated and badly needed. I've read a few posts here from you and a couple of the other developers that talk about the pros and cons of jumping ship from Empty4 to some other platform. I have taken the plunge and am not looking back!

I've moved just about all of my serious development out of Empty4 as I don't have a high level of trust in either the data or the backtesting environment. Also the Empty4 framework is limited in that it isn't able to do multi-currency backtesting (well), genetic optimization, or portfolio optimization. For me the data is the lynch pin as getting high quality bid/ask data that is synchronized is a major accomplishment.

Those issues aside, I'm also working on my own system development framework, one that includes portfolio optimization, system development and backtesting using genetic optimization all done with high-quality synchronized bid-ask data. The most important aspect of a system development framework is the data.

For the trading / implementation part of things with Empty4 enabled brokers it can be as simple as executing a buy / sell / flat script. I have worked with this method of trade automation in the past and the execution can be very fast and accurate, and made nearly flawless in execution with a simple script based method.

In the case of simultaneously automating multiple systems, I'm considering a C# DLL based method to keep the Empty4 state in line with the system state. When dealing with multiple systems, Empty4 effectively only needs to know the net position for each pair. The problems that cause many forum posters to refer to Empty4 as Empty4 are limited to the code that executes orders. In my experience, trade logic can be written in and systems run in C# (pick your favorite language), and Empty4 interaction can simply be to tell it to buy or sell. In this way, when other platforms are added for trading, the trade execution code can simply be replaced / altered to adapt to a new trade platform API and the core trading logic / current trade state for each individual system is all kept nicely behind the scenes.
raidsan
Posts: 5
Joined: Fri Apr 19, 2013 6:35 pm

Re: An object oriented language for Empty4

Post by raidsan »

well, it's just something i am looking for. I want to use OO to moding the Trend logic, and pattern recognition, include Elliott Wave, and I need add more additional class encapsulates, such as mt4gui to add user interaction, import and use fx news info etc.
work with raw Empty4 mql without OO, I almost can't finish the job, e.g. trend in fact will come from segment, segment will be nested on diff period level, manage the relation between segments, segment high/low point and caculate trendline...
mt5 work like c++ , but a lot work have done in Empty4 can't be reuse, and real account is not mt5,
moreover, I have use Empty4 offline chart to recieve china stock and future data, and I need use the same trade system to trace the chance.
Post Reply

Return to “Coders Hangout”