Reply

Read only str/mql4/ex4 file

2 replies

Patrick

Customer, bbp_participant, community, 424 replies.

Visit profile

7 years ago #115357

Hi,

 

when we export strategy to mql4, can be adedded format dedicated only for backtest? 

 

Example: i will export mql4 file of my strategy and i want to share it with some stranger. so i compile the mql4 file to ex4 and the ex4 file will be locked to backtesting only, trading not allowed. 

 

the same could be with str file, create str that will be reading only-no exporting mql4 etc. not showing the source code. But can be shared with others.

 

Thanks for considering it.

 

0

mikeyc

Customer, bbp_participant, community, 877 replies.

Visit profile

7 years ago #138326

For the MQ4, just edit the last function in the file like this and then compile to ex4:

bool customStart() {
   return IsTesting();
}

If the EA is not running in the tester, it will not trade.

0

Karish

Customer, bbp_participant, community, sq-ultimate, 443 replies.

Visit profile

7 years ago #138331

First of all there are DeCopmpailers that can decompail your ex4 into mq4, but they are not that smart..,

make sure to add those lines above all of your code:

#property copyright       "Copyright © 2016, YOUR NAME HERE."
#property description          "MAYBE AN EMAIL HERE BUT SOMETHING GOT TO BE HERE"

And to your question add this under your OnStart() function:

if(!IsTesting()) {return(true); Print("THIS EA IS LOCKED AND CAN BE USED ONLY IN BACKTESTING.");}

0

Viewing 2 replies - 1 through 2 (of 2 total)