Protecting Your Formulas and Including an Expiration Date

Occasionally we receive requests from traders asking how to protect their own formulas from being viewed and modified by someone else. Here is a short guide detailing the steps.

The quick way is to select the Hide Formula when 'Deny Copy' is set in Permissions checkbox when you write your formula. The system will prompt you with the information you need to know as shown in Figure 1.

Figure 1

If you select Yes, you just need to enter your password twice and the formula is hidden.

If you click Permissions... at the top of the Define User Formulas dialog and click Change Component Info..., you can tailor the permissions to your own needs as shown in Figures 2 and 3.

Figure 2

Figure 3

If the protection is already on, it will ask you for the password again. Make sure you do not lose the password. CQG cannot retrieve the password if you lose it.

If you want to give studies away but you want to let the function expire at a certain date; for example, those that need to be updated quarterly, there is a very simple way to do this: For a condition, you simply add AND TimeLT(@) from the Time Compare section in the Formula Toolbox (see Figure 4).

Figure 4

Highlight the function and set the date when it should expire (see Figure 5). TimeLT stands for "time is less than a certain value," so the condition can only be true if today is before that date and time.

Figure 5

This only works if you protect the formula.

For custom studies, the process is a little more complex. You need to use an "if-then" statement to make it work:

IF(TimeLT(@), "your study code goes here"), none)

The way "if-then" works is straightforward:

IF(TEST, happens when test is true, happens when test is false)

Here, the test is that the time (today's date) is less than the expiry date using the TIMELT(@) function.

If that is true, it delivers the calculation after the first comma. If the test is negative, (i.e., we are beyond the date), it delivers what follows the second comma - in this case "none," and the curve will be blank after the expiry date, as shown in Figure 6.

Figure 6

Learn more from CQG HTML Help