I have been thinking a bit about how much work it has to be to compile uniqe algos/indicators for each customer every time you rent something out.
When only renting out a few algos to a few customers it is manageable, but when you have alot of algos and alot of customers you would have to spend wast time and energy to modify indicators and set valid-to-dates for each customer.
Since PRT doesnt have a built in way to handle this i thought of a better way, a way that we can code ourselves to handle this. So i wrote up this code today that I think handles the problem in quite a neat way.
Basically you can keep publishing the strategy with open code.
You then implement, in each indicator that you want to rent out, a simple checksum generator.
So, you compile the indicators that you want to rent out with hidden code but not limited to single import.
These indicators you can publish for everyone to download on a website for example.
Then, for each customer that rents an algo from you, you compile a user uniqe “Licence-indicator” with the algos that this customer payed for, and the date up until this should be valid.
This “Licence-indicator” is compiled with hidden code and limited to a single import.
The “Licence-indicator” has the same generator-code as all the indicators you have published, so what an indicator does is that it calls this “Licence-indicator” that checks if the customer has acces to this algo during this date.
If they do, it returns a checksum (generated by generator-code) and the indicator can, with the same code, verify that this actually is a valid checksum.
This would mean that when renting out algos, you dont have to compile multiple indicators for each customer, you simply compile one “Licence-indicator” for each customer.
I havent been able to debunk this myself, so I turn to you guys to “crack” this system.
//This is the strategy file that takes all the trades
//This file is "compiled" completely open code so that users can fiddle with pos-size and SL/TS/TP
//This can be published on a website for example, but if the user doesnt have a valid licence file it wont trigger any signals
DEFPARAM CUMULATEORDERS = False
TradeSignal = CALL "License Test - Indicator"(close)
If TradeSignal Then
Buy 1 Contract At Market
SET STOP LOSS 10
SET TARGET PPROFIT 10
EndIf
//This is the Indicator file that contains all conditions to trigger a trade
//The file is "compiled" copy protected with the code hidden, but NOT locked for single import
//This can be published on a website for example, but if the user doesnt have a valid licence file it wont trigger any signals
//The uniqe AlgoNo int for each published algo
ThisAlgoNo = 3
//Check that the user has a License file valid for this date and for this algo
//This code is the same in all published indicators
Checksum = CALL "License Test - License"[ThisAlgoNo](close)
//This is where the publisher inserts its own uniqe checksum generator code.
//This code is the same in the licence file and in each published indicator, but only the publisher knows this "code"
Generator = Average[3] / ThisAlgoNo + Date / (Average[7] / ThisAlgoNo) * RSI[11]
If Checksum = Generator Then
LicenseIsValid = 1
Else
LicenseIsValid = 0
EndIf
//Your normal indicator business, finding triggers and filtering trends....
If Average[8] Crosses Over Average[20] Then
TradeSignal = 1
Else
TradeSignal = 0
EndIf
//You return the signals to the strategy if LicenseIsValid, else return 0
If Not LicenseIsValid Then
TradeSignal = 0
EndIf
Return TradeSignal
//This is the License-file that is made uniqe for each paying customer
//The file is "compiled" copy protected with the code hidden AND locked for single import
//Settings to change for each customer depending on purchase
ValidUntil = 20211201 //Do not return a valid checksum after this date
$ValidForAlgo[0] = 3 //Algos (each algo gets a uniqe int) that the customer payed for (99 = All algos)
$ValidForAlgo[1] = 7 //...
$ValidForAlgo[2] = 13 //...
$ValidForAlgo[3] = 19 //...
$ValidForAlgo[4] = 21 //...
//Check that licence is valid at this date
IsValidUntil = Date < ValidUntil
//Reset IsValidForAlgo each time
IsValidForAlgo = 0
i = 0
//Set IsValidForAlgo to 1 if AlgoNo (from indicator) is in the $ValidForAlgo array
While ISSET($ValidForAlgo[i])
If $ValidForAlgo[i] = AlgoNo Then
IsValidForAlgo = 1
EndIf
i = i + 1
Wend
//If $ValidForAlgo[0] = 99 then the customer payd for all algos
If $ValidForAlgo[0] = 99 Then
IsValidForAlgo = 1
EndIf
//The licence file is valid this date and for this algo, calculate and return correct checksum to incicator
//If the licence file is not valid, Checksum = 0 is returned
Checksum = 0
If IsValidUntil And IsValidForAlgo Then
//This is the checksum generator if the licence is valid, the same code is used as a de-generator in the indicator to verify that
//the licence file has "approved" the indicator at a specific time, this can be modified how ever you like, as long as the generator
//is the same in the License file and in the indicator, and that it implements AlgoNo that is hard coded in the indicator
//The generator should be advanced enough to not be able to reverse-engineer
Checksum = Average[3] / AlgoNo + Date / (Average[7] / AlgoNo) * RSI[11]
//In the indicator the checksum is verified with the same code, for example in algo no 15 the code would be
//Checksum = CALL "License Test - License"[15](close)
//Generator = Average[3] / 15 + Date / (Average[7] / 15) * RSI[11]
//If Checksum = Generator Then
//LicenseIsValid = 1
//Else
//LicenseIsValid = 0
//EndIf
EndIf
Return Checksum