Protect your EA, Indicator from Copying
Вставка
- Опубліковано 23 сер 2024
- Covers restrictions on use, time limits and encrypted licences.
You can follow the code for this tutorial at
orchardforex.c...
Playlist for this series: • Restrict use of your M...
Free downloads for Metatrader 4 and 5
MT4: www.orchardfor...
MT5: www.orchardfor...
Follow our regular market updates:
Web: www.orchardfor...
Twitter: / orchardforex
Facebook: / orchardforex-327549444...
Telegram: t.me/orchardforex
Get the code at orchardforex.com/copy-protect-your-ea-or-indicator/
Includes a typo correction, in KeyGen, StringToCharArray(account+privateKey, accountChar);
do i send include file to client if so how do i protect it
@@JemillNoge To use these techniques ONLY send the ex4 or ex5 file to your client. The contents of the include file will already be in the ex file after compiling. Then send the licence for an account locked product or if the client has paid for the work treat the ex file like a sample. When the client pays then remove all the licencing lines from the source file and send the source of the expert or indicator to the client. There is no need to ever send the include file.
@@OrchardForex bullshit… they decompile all mt5 market and cloud protection…
@@Ama_Teur Really, do you have an example of a recently decompiled application? Do you really know what you are talking about or are you just trying to get attention?
@@OrchardForex I think Matey Boy's trying to compare penis sizes.....lol
The best channel about MQL ... clearly You have outside mql experience ...nobody writes code like this (professional approach) in mql education channels on UA-cam ... Thank You :) .. Regards
Thank you very much
This is the best MQL programmer on UA-cam. How I wish I can learn how to code in a similar fashion.
IMPORTANT:.. In order for this to work you must make sure that when you write this EA code that you put the #define lines ABOVE the line where you #include the LicenseCheck.mqh. By the time that the compiler reads the #include line and compiles the .mqh it must have ALREADY read the #define lines FIRST in order for the #ifdef lines to work properly... Pip Pip...
You are one hell of a tutor too Jim. It's amazing to see you commenting here. I am the one guy who still likes your videos from as a way back as 2013. Keep up the good work old timers! I like you both.
..said one legend to another ? :D
These are great videos! I can't thank you enough for making them!
Glad you like them!
You are a genius sir. I watched some important lessons so far and think also i know your own unbeated EA strategy now. And by including my own to it as well after learning also your structures framworks i am gonna also improve it to the nextlevel :) so an unbelievable endless big thank you Mister Australia. Your work amazes me a lot.
Wow, thanks
Hello, where can I locate an email, link or site of the unbeaten EA strategy? Thx
Wow, what an interesting video. This has been my concern for a while, but you have just solved it for me. Thanks a lot. 👍👍
Thank you for your simple explanation to implement a license key!
You're welcome! Remember to check the pinned comment, there was an error in the video.
yay been wanting this can show us how to add a logo to our ea/indicator when somone drags it over
Excellent explanation! Thank you! I do have a question though... is there anyway (for a EA developer/provider) to write an EA section of code that can track, "see", or report if the account it is licensed to run on is being copy traded by either another copy trader EA or virtual platform? Essentially is there a way to stop or track the resulting trades from being copy-traded on the customers end to another account?
Thank you for the wonderful explanation 🥰 I would just like to get a code to protect the expert advisor and that it be specified with a year of use and be linked to the account number
Just add a check on the account number, or check the other videos in the playlist for different approaches. ua-cam.com/play/PL0iqkWGt8zznxMIWGGPVXD999Q9yzKrjd.html
@@OrchardForex thanks you sir 😊
Amazing! Thanks a lot! 🤩🤩🤩
hello, nice video!!. I have a question, I did exactly as you did but on the third file Licence Generator, the error defined KeyGen appear. I try to use chatgpt but he can not resolve the problem
Hello, I have followed all steps and no errors. But when i place the license key, It says invalid even when i am inputting it correctly.
Any chance you could do a video using an SQL database from wordpress hosting with your licensing concept? Would this work?
For example, client base on website SQL database which can be toggled Active or Inactive for each client. A person doesn't pay, change the database to inactive.
Amazing instructor/instructions! Curious if you have this no-loss EA for sale on MT4/5 Market?
If this file is an include, will it still be read when uncompiled? I experienced something unpleasant about my product being duplicated, but I put this restriction, will this inclusion still be read when uncompiled, I hope not
Hi. First of all, thank you for this very useful video and ideas.
I have a question related with the licence days functions... I have tried it using a VPS and the EA doesn't stop running on the date that it is supposed to end. If I close the platform and open it again, it stops. But if I leave it always open, in a VPS, it continues running. Is there any way of actually stopping the EA from running when it is supposed to, even if the platform continues open?
Thank very much
Yes, I only placed the check in the OnInit function to prevent the EA from being started. If you also want a runnning EA to shut down then include a second call in the OnTick function like this
if (!LicenceCheck(InpLicence)) ExpertRemove();
I will try it. Thank you for your help.
Excellent!
Many thanks!
Great video. Well explained.
Why it doesn't work for me? copied everything you made but if i try to put it on a pair in the demo account i have on my broker firstly it doesn't stop it even if i said to use it on a real account, secondly i only have the message for input the private key but not the actual box where to put it and it doesn't show me the private key on the expert folder on the terminal, do you know why? can it be that the code is old and maybe there were few new changes?
thanks in advance for your help
This has been the most valuble video I have ever seen on YT. Thank you.
Is there a way to code restrict the number of devices one can use the vode on at a given time? Let's say one only wants users to be restricted to 2 devices.
Yes, I use something like this but it requires access to an activation server to track the number of instances in use.
@@OrchardForex thanks for taking the time to respond. I appreciate it. Is there anyway you can make a video on how to do this. Again, thanks for your content
I try to stick to MQL coding on this channel. To go into the PHP and JS for the server would not have enough interest.
@@OrchardForex i understand. I have sent you an email regarding a quote for an EA. Please look out for an email from myself.
Thank you for all your valuable content, PLEASE make some videos about chart events by mouse drag and clicks there is no one else is covering this and it is driving me crazy
Thank you so much!
Great suggestion! I'll add this to my list.
@@OrchardForex
Thanks a lot you are the best
nice video, just one doubt....how does it work when you distribute this? you distribute the .ex4 file right? but what happens then with the licence_check.mqh file? can people potentially hack it?
So don’t send the mqh file
oh...im totally confused now sorry....if one of the first lines of the EA tells #include ..how can you not send the mqh file and just the ex4?
@@pedrosanchezroca181 Because the mqh file is embedded in the ex4 file. If you are asking this question then I don't think you are at the stage where you should be distributing your apps to others.
Love your work. Tx
So glad!
Thanks for the excellent video explanation. I have a question, is there an error in the coding of the keygenerator, I can't get a working key at all. Other restrictions work without problems.
Not that I can see. The KeyGen function returns a key as a string. There is an earlier error where the private key was not used but the function would still return a working key, just not protected. There is a pinned comment at the top of the list with a fix and the code on the web page is correct.
I just needed to clarify a related point for beginners:
If you create a custom indicator or EA on MT4 just for your own personal use on a PC, this licensing code wouldn't be necessary in that case, would it? The only copy or theft danger is being hacked past the firewall of your OS? I'm assuming MT doesn't automatically upload your data even when the default copyright displays 'MetaTrader, Inc.' when going through the initial dialogue boxes upon creation? Thanks for your fascinating video.
This video, originally planned to be the only one, is part of a 3+part series. The aim here is where you build the EA for someone else, want to let them try it out but not just take the demo and not pay.
@@OrchardForex Thanks for your reply. I completely understand your actual intention behind the video. It just left me wondering how safe one's intellectual work may be when there is no actual distribution beyond personal use on one machine.
@@jamesburtnett8144 The EA is not sent to the broker. It is as secure as any other file on your computer.
thank you for your videos I learned well. please can you show us how to protect the robot from copying operations to another account... thank you in advance
There are other videos that may help. A playlist is linked in the description.
Oh god you are good at it! I have a question for you… can you contact me it’s about a secret ea but I can’t find why the warning code is not correct… please
So i must give all this files to the customer ? how can i control the license that i gived to the costumer ? and if the costumer edit the code himself ?
Thanks for your responds
The use case for this is to let your customer (who paid you to do the work) try the expert, then pay you, then you give them the files after removing the security code.
Thanks! I was wondering how this could be done. ... GOD Bless!!!
You're welcome
Very useful and exactly what I've been looking for, thanks! How do I protect the .ex4 file from being decompiled and copied, though? Is there an easy way to do it?
The MQL market claims to add an extra layer of decompile protection and I've heard there are commercial products that can do the same but I don't have any first hand knowledge of them. I also haven't heard of a successful decompiler for recent code but I'm sure someone is working on one.
Very good content, can this protect a custom indicator?
Experts, Indicators, Scripts yes
Thanks you ❤
Nice Idea ;) Love it!! Is there any way, to give the expire Date with the licence Key?
Yes, see this video ua-cam.com/video/wee3s0JnGFY/v-deo.html
What about copy trading software that copy trades from one account to another? Is it possible to implement something that let's you recognize when somebody does this? Because if you use a copy trading software like this you can of course undermine the need of a license.
You can't stop copy trading, but you still need a licence for the original trading software
Thank you very much for the fabulous work you are doing. I have a concern about the protection of my robot using a license key. I followed the video and managed to implement this , but the resulting ex4 file works on any account when it is supposed to be unique. How to do please? Thanks in advance
You have made a mistake somewhere. That's all I can say from your description. Maybe step through in the debugger and make sure the licence routines are being called.
@@OrchardForex Thanks for your answer, I will check it all.
Thanks🙏
Hi, I built an indicator with EA builder but it works only on my pc. If I try installing it on another pc, it indicates it's successfully loaded on the journal but the indicator doesn't show on the chart. What can I do to correct this please
Contact ea builder
It would be very useful to learn how to make our own copy trading bot.
Professor, would you please teach us how to program copy trading
You can easily purchase copy traders. It would not be worthwhile to write your own.
Could you please suggest a reliable way of compiling the EA? To eliminate reverse engineering the EA file.
Yes, just compile it. Have you seen an EA successfully decompiled lately?
@@OrchardForex Nope I never seen it. But I have seen in UA-cam few unethical people try to decode our hardwork. Anyway... I love all your videos. Thanks for your valuable contribution sir! Do you trust MQL5 cloud protector for code compilation?
@@reach_perumal I don't use it. My clients are all high value corporates and have no interest in MT5
@@OrchardForex thanks sir! I am an young Java developer started my career this year. Out of curiosity, Can I ask you what kind of environment/platform/programming language are used for Corporate clients.
@@reach_perumal All of my clients are using MQL4
My cousin bought a trading system but when i try to use it it says unauthorised user how can i fix that
Buy your own copy
Dear Sir, It missing SL and TP In some order, This is not working properly, Can you please check the reason? can you help me?
This tutorial is about securing your code, not SL and TP.
Hi may you please help me. I bought an EA recently and it has these account limits whereby it has to be registered to a single account for it to function and the guy told me i can register an account with him when i want and i’ve been doing funding challenges and today i passed a challenge and asked him to connect the phase 2 account to the ea and then he isn’t responding to me. Is there a way for you to remove these limits?
You're asking to hack someone else's code. No. Not here.
Thank you so much for your help , please sir how can I protect indicator simple password without encrypt ?
You can always try just compiling a password in but it isn't very good protection.
Thank you
I want to make EA working on 1 computer only , can we do that? how?
Sell through the MT5 market.
@@OrchardForex thank you , is there any code can show (computer ID or Hard disk ID or MAC address for current computer)?
@@abuomar3410 You can do that by calling a dll but nothing within metatrader.
@@OrchardForex Thank you
Hi, great video. How about if I wanted to authorise a license renewal?
See the playlist in the description
So the include file has to be converted to a DLL right?
No. No DLL at all. In the video I just included the mqh file
Could you show us how to make an include function that returns a double value like for instance RSI value... than turn this include into a dll file. After that, how to call it from your expert?? Thanks
Writing a dll would be an advanced topic and I'm trying not to get too complex with these videos. Is there a reason why you need a dll?
In the EA line 14 #inclue what do I write instead of orchard?
This is the path to the LicenceCheck.mqh file. Use the path where you stored the file.
@@OrchardForex brill thanks
Thx 🙏🙏🙏
What about metatrader 5.. you only keep using metatrader 4 but it wont compile in 5
I use MT4 because it is more popular. The code for licence testing is the same for MT4 and MT5. The only thing I showed that is MT4 specific is the example EA but you would be adding the code into your own EA so that should not be relevant.
hello onchard forex.
I would not teach how to program our own COPY TRADING
I don't plan to show copy trading
Greeting i have coded my robot but my robot does not not place any orders... maybe you can help because i tried but it does not place any orders
I can't help with only this much detail.
Does anyone know how to change this code to only trade Tuesday - Thursday, and only trade from 9am - 2 pm server time?
I am new to codes and I don't want to mess anything up on the current EA I am using.
datetime LastOpenTradeTime()
{
datetime result = 0;
for(int i = OrdersTotal()-1; i >= 0; i--)
{
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
if(OrderType() > 1) continue;
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
result = OrderOpenTime();
break;
}
}
return(result);
}
bool SelectLastHistoryTrade()
{
int lastOrder = -1;
int total = OrdersHistoryTotal();
for(int i = total-1; i >= 0; i--)
{
if(!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
lastOrder = i;
break;
}
}
return(lastOrder >= 0);
}
datetime LastOpenTime()
{
datetime opentime1 = 0, opentime2 = 0;
if(SelectLastHistoryTrade())
opentime1 = OrderOpenTime();
opentime2 = LastOpenTradeTime();
if (opentime1 > opentime2)
return opentime1;
else
return opentime2;
}
Hi sir, thanks a lot for sharing this great code... I'm just asking if someone has the same problem as me with the following line in the main code :
int OnInit() {
if (!LicenceCheck(InpLicence)) return(INIT_FAILED) ; ==>>> this line give an error message after compiling : 'LicenceCheck' - function not defined ...
.......
I don't have any error in the others script, it's just this line and I don't understand where is the problem. Files are at the good place, with the good names...
Please can you help ? Regards
Typing error in the function name but more likely you forgot to include the file with the functions
@@OrchardForex The name is strictly the same, no error in the name... I have the three files, Restricted_EA, LicenceCheck.mqh and LicenceGenerator.mqh... What do you mean exactly ("you forgot to include the file with the functions") ?
Thanks for help
@@Axel98807 Do you have the #include statements.
@@OrchardForex I restart everything and the error message is gone... mystery... thanks for your help
this video and methods not protect from decompilling
They also don't protect from rain or volcanic eruption
i did exactly as you did but am getting errors on the .mqh file
You aren't being very specific about the errors. You'll just have to work through the problems.
Hi. I want to create license for ea but i want every license work just one systems. How can design this functions? I want limited for computer system like using mac address .some people want use ea in every account without getting new license for every account
You will have to use a dll to get access to that kind of system information
@@OrchardForex how can use it? Have you any trading course for that?
@@sohrabfeghhi8914 This is not for trading. This is to use where a client is paying you for development, you want to give them the ex file to try before payment but you want to make sure they do not just keep the trial version and not pay.
Do you have a telegram or Whatsapp account?
@@sohrabfeghhi8914 I don't give out that information. For custom work go to orchardforex.com/custom-experts
Bro how can i protect my source code in tradingview so that my clint can't copy it.
I can't help with tradingview
Is there a video for a mt5 version?
The code is the same. This is one case where MT5 has kept up.
hello sir i'm still confused about how i delete the moving average indicator that is in the chart windows please tell me about it if you can make this tutorial
Just right click, indicators, select and delete
@@OrchardForex for ea sir
@@youtraders Why would you want the EA to remove an indicator? If you don't want the indicator just don't add it to the chart in the first place.
@@OrchardForex I just want to delete the moving average that is on the chart windows after the ea is stopped. I'm confused about how to make the windows chart not have a moving average line
This is great Stuff. I wanna know Is there any way to stop decompiling the ex4 files?
how do we integrate with our webistes lets say you want deactivate someone
That's a good question. I should make a detailed answer as a video. I've added it as a request at orchardforex.com/requests/integrate-copy-protection-with-web-to-allow-remote-deactivation/
Hello first of all thank you for your amazing work. Is it possible to share this code with mql5? Thank you
Which mart is not working with MQL5?
how do you manipulate expired indicator mt4 to work?
The idea for the expiry date is to use it where you are being paid for custom work. You can give the limited version to the client to confirm they are happy and they cannot simply take the demonstration and not pay because it will stop working. When they pay you you just make a new version with the restriction removed.
Its very useful code, thanks sir, I used this code for my EA but every time, it prints message "Invalid License " and EA removed. I used my account no and my private key to generate license code. Can't find the mistake. please help me.
Add a print statement in the licence check code and print out the hashed value the licence is comparing to. My best guess is that when you are concatenating the strings to be hashed you have a difference in the code used to generate the key in the script and the code in the licence check.
@@OrchardForex OK Thanks sir, in print different key printed while taking EA in service than generated key by generator,. How it is?
@@jagdishvasave2504 If you followed the example then the script and the ea are both using a common include file, so the logic to create the code is the same in both. The difference then will be that one of the inputs is different.
In the KeyGen function the include file first concatenates the private key and account number, then uses SHA256 to hash the value. If the script and the ea are both calling the same function and getting a different result then one of those 2 values is different. Try adding the print statement in the keygen function, print out both the private key and the account. Make sure both the script and ea are using the same include file.
@@OrchardForex hi sir how to print the hash value in licence check mqh?
@@dimashariyanto3352 a simple Print(value);
How can we display the license termination date on the chart, to stay always visable? I would appreciate your help once again. Thank you
Easiest would be to just use Comment()
How do I fix data losses on my Indicators eg Time[0]
What do you mean by data losses on Time[0]
With property strict it gives me losses is there a way I could send a screenshot
@@JemillNoge You can use the contact form on our web site and attach a file. Property strict just tells the compiler to use the new program structures. I still don't know what you mean by losses unless you're saying you have a losing strategy.
I been protecting my EAs using account numbers and expiry date. In respect of this video do i have to send the Licence.mqh file to client or just .ex4 after compiling
See the second video on this. ua-cam.com/video/wee3s0JnGFY/v-deo.html
you must be programming on mql for years to make this look so easy
Thank you, sometimes it feels like forever.
Can we use this for MT5 ?
Yes. MT5 also
it can be easy decompiled
how?
Can you help me create a robot
That's not really what we do.
Sir I added the license to my EA and it’s showing invalid Pointer error
The most likely cause is that you missed instantiating the licence object with the new statement
@@OrchardForex how can I do that sir
@@fortunesunday4627 This video does not use classes so I assume you are looking at the later video using a licence file but adding the comment in the wrong place. In the otehr video go to 35:49. ua-cam.com/video/wee3s0JnGFY/v-deo.html
@@OrchardForex Thank your sir
@@OrchardForex But am using a MacBook and the file was created in the file folder but the .lic file isn’t there rather it went to my log folder
Mestre, how to protect our work from decompiler softwares..thanks
The MQL market claims to add an extra layer of decompile protection and I've heard there are commercial products that can do the same but I don't have any first hand knowledge of them. I also haven't heard of a successful decompiler for recent code but I'm sure someone is working on one.
@@OrchardForex Have you ever used Cloud Protector service of MQL5, it adds extra layer of encryption which helps to prevent complete decryption of code if someone uses any decompiler.
@@gamerx3201 No. If the original code can be decompiled then protected code can be decompiled. Have you seen a working decompiler lately?
never heard of successful decompilation.
@@Macam2macam Not for a long time. I think since build 600. There are a few people out there selling decompilers but they appear to be scams.
Bro how to crack the ea licence key
You can try a brute force attack, just cycle through possible keys until you get a matching hash.
Is there a script to convert mq4 to mq5
Not that I know of. I have seen some function libraries that allow you to use MT4 code in MT5 with limited success. But really, why would anyone want to convert.
I see since we trading vix75 etc with deriv.com and it’s only MT5 that’s why we would like to convert it from mq4 to mq5
On mt5 is not removing the EA. Does not verify the key.
I've just tested it using the same code used in the video and all is working in MT5. To use the key you will have to comment out the other settings like expiry days and alloed demo symbols. It's mentioned in the video.
@@OrchardForex I will keep trying! Thank you master!
Please help me with my robot please
If you want to post the full strategy it may be something I consider for a tutorial.
Good Day! I'm either blind or something has changed. I'm getting 1 tiny error about the code in the Licence Check.mqh.
#ifdef LIC_PRIVATE_KEY
long account = AccountInfoInteger(ACCOUNT_LOGIN);
string result = KeyGen(IntegerToString(account), LIC_PRIVATE_KEY);
if (result!=licence) {
Curious if there's something that someone who has been successful implementing this can comment on and possibly host a solution. Coding is new to me but I've been trying to learn as much as I can. I was at 18 errors and I've managed to work my way down to 1. Thanks to anyone in advance for any insight if possible!
I need to know the error to help
‘licence’ - undeclared indentifier
@@arthurmcalister1454 I did that, and realized something major. I deleted everything out of a different .mqh file and tried to use that. That was my issue. I clicked on new, created the option for ‘include (mqh)’ and pasted everything into it. Then it worked. But, I may not be getting errors now, my problem is that with or without the license key, it allows the EA to remain active unless a wrong key is used. If it’s left blank, the EA returns that as True. Now I’m stumped with that.
any MQL ex4 or ex5 will be decompilled - metaquotes russian freaks