Could you please tell me how to properly apply copyright if the source code consists of several files?
For example, the source code is split into ~20 mqh files, and .mq5 is just a wrapper. Should I write some comments in each mqh file (I hope not)? Or will it be valid if I add some LICENCE.md (I have no experience with this)?
Copyright and licensing are two different things. Licensing is usually in a separate file, but I would suggest adding a copyright notice to every code file. That is how I have always done it irrespective of the programming language, since I first started coding back in the 1980's.
When creating a new file in MetaTrader, it's usual template also adds a copyright notice and property (even for include files). You can use that or manually create your own style of copyright notice.
You can also use MetaEditor's "project" files to handle the copyright notice "injection" in the final compiled version and not worry about it in the source code, but I prefer also having it in the all the source code files (just in case any of them find there way somewhere else).
EDIT: My usual copyright text is something like this (with the year, and reserved rights) ... "Copyright © 2025, Fernando M. I. Carreiro, All rights reserved."
Copyright and licensing are two different things. Licensing is usually in a separate file, but I would suggest adding a copyright notice to every code file. That is how I have always done it irrespective of the programming language, since I first started coding back in the 1980's.
When creating a new file in MetaTrader, it's usual template also adds a copyright notice and property (even for include files). You can use that or manually create your own style of copyright notice.
You can also use MetaEditor's "project" files to handle the copyright notice "injection" in the final compiled version and not worry about it in the source code, but I prefer also having it in the all the source code files (just in case any of them find there way somewhere else).
EDIT: My usual copyright text is something like this (with the year, and reserved rights) ... "Copyright © 2025, Fernando M. I. Carreiro, All rights reserved."
Thank you very much!
Fernando is right.
Ideally (but not necessarily) a short mention of the licence could be added to each file beside the copyright. It's a courtesy though.
Unfortunately MetaEditor template is very limited and will not allow you to have more than 1 line of text. So you would have to do it manually.
[W]ill it be valid if I add some LICENCE.md (I have no experience with this)?
I use ACCOUNT_NAME or ACCOUNT_LOGIN to implement licenses of ex5 files for private distribution.
I don't know any way of effectively implementing licenses within mqh nor mq5 source code files. It seems to me that the end user can simply edit out the license code.
Just to be clear, I use self-enforcing licenses--not just paper tigers.
(I also use mql5.com Cloud Protection.)I use ACCOUNT_NAME or ACCOUNT_LOGIN to implement licenses of ex5 files for private distribution.
I don't know any way of effectively implementing licenses within mqh nor mq5 source code files. It seems to me that the end user can simply edit out the license code.
Just to be clear, I use self-enforcing licenses--not just paper tigers.
(I also use mql5.com Cloud Protection.)Thanks, but I meant publishing the source code.
I like to split my source code into small mqh files. Almost always, an mqh file contains one small class. I haven't collected statistics, but I'd guess it's about 30-100 lines.
Let's assume the average mqh file size is 50 lines. If I add 5 lines of copyright to each file, then ~10% of the source code will be copyright comments.
Thanks, but I meant publishing the source code.
I like to split my source code into small mqh files. Almost always, an mqh file contains one small class. I haven't collected statistics, but I'd guess it's about 30-100 lines.
Let's assume the average mqh file size is 50 lines. If I add 5 lines of copyright to each file, then ~10% of the source code will be copyright comments.
Got it. I'm just thinking from a practical perspective. Once source code it out there, snippets thereof can be freely edited and/or adapted to another's own purposes. I appreciate this because it is essentially the whole point of the CodeBase.
On the other hand, another can infringe by simply deleting your copyright info from your entire work. At that point, it would be up to you to take legal action--likely internationally and assuming that you can ascertain the identity of the infringer.
I guess that it depends on the level of protection that you seek.
I guess that it depends on the level of protection that you seek.
I'm looking for fair use. Let's imagine, for example, that I've published my own implementation of a moving average. If someone were to take my code as is, add "macd = fastMa - slowMa" to it, and publish it as their own, it would be unfair to keep quiet about the copy-pasting of someone else's code.
This gets into the legal weeds of what constitutes a "new work" that is "substantially different" from the original work.
My point is that the legal answer is practically rendered moot once your code is publicly published due to unlikely enforcement. I would much rather rely on self-enforcing licensing code than on the fairness standards of others in the dark corners of the internet.
I use ACCOUNT_NAME or ACCOUNT_LOGIN to implement licenses of ex5 files for private distribution.
I don't know any way of effectively implementing licenses within mqh nor mq5 source code files. It seems to me that the end user can simply edit out the license code.
Just to be clear, I use self-enforcing licenses--not just paper tigers.
(I also use mql5.com Cloud Protection.)This gets into the legal weeds of what constitutes a "new work" that is "substantially different" from the original work.
My point is that the legal answer is practically rendered moot once your code is publicly published due to unlikely enforcement. I would much rather rely on self-enforcing licensing code than on the fairness standards of others in the dark corners of the internet.
That's not the point discussed. Once again...
Please stay on topic and refrain to post if you don't have something new or relevant to say about the topic.
Thank you.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Could you please tell me how to properly apply copyright if the source code consists of several files?
For example, the source code is split into ~20 mqh files, and .mq5 is just a wrapper. Should I write some comments in each mqh file (I hope not)? Or will it be valid if I add some LICENCE.md (I have no experience with this)?
[edit] Although I should probably be redirected to Google.