Create a New Formula

Top  Previous  Next

The ChaosHunter Formula Editor gives you the ability to create a formula even if one does not exist.


Open Data and Model Files

Before you can modify a formula, you must insure that the data file is open in ChaosHunter. Click here for details.


Open the Formula Editor

Click on the Tools Menu and then select the Formula Editor.  If you have not previously created a formula in ChaosHunter, the Formula Editor will display a blank formula.  


Blank Formula Editor


The ChaosHunter Formula Editor lets you create a formula for your data.


Create a Formula

Click on the Insert/Modify Operand button and a new screen displays five tabs with options for creating a formula.  The formula is constructed in a hierarchical manner, so the first node you insert is the overall operation that governs formula calculations.


It is suggested that you begin the formula with a selection from the Operations tab, which will insert nodes with operands that will allow you to construct more complex formulas.  Operands may be filled in with columns from your data file, constants ChaosHunter indicators, and the chaos variable.  You may also choose to insert other operations, which will lead to the construction of nested, more complex models.


Selecting an input from your data, a constant value, or the Chaos Input for the first node will mean that the formula will compare a single value against a threshold for trading strategy buy/sell decisions.  For a scientific or business model, the chosen input, constant value, or the Chaos Input is compared to the ChaosHunter output value in order to compute model statistics.  For instance, in the ChaosHunter pH example if the chosen output is pH and the input selected in the Formula Editor is temperature, the formula pH = Temperature is constructed and model statistics are calculated based on the differences between those two values.



Formula Editor Tabs


Tab Options:


Operation: The tab displays a list of the functions that were originally available on the ChaosHunter Formula tab.  Click on the function you want to substitute for the highlighted node in the formula and then click the OK button. The function will be added to the formula.  Depending on which function is chosen, one or more operands will be displayed as sub-nodes to the function.  Click on each operand and then click on the Insert/Modify Operand button to complete the operand just as you would any other node in the formula.


Input:  The tab displays a list of column names from the open data file.  Click on the column name you want to use to replace the highlighted node in the formula and then click the OK button.  The values for the selected column will be used to compute the formula.


Constant: The tab displays a text edit box in which you can enter a single numeric value to replace the selected node.


Indicator: The tab displays a drop down list from which you can select any ChaosHunter technical indicator to replace a node.  Depending on which indicator you choose, you must select one or more columns from your data file for use as a time series in indicator calculations.  Some indicators require that you enter a number of periods for indicator calculations.


Formula Editor Indicator


Chaos Input: The tab displays an edit box where you can enter an initial value for calculation of the chaos formula.  On the very first row the chaos variable is set to the initial value you enter.  This value will not change for each row in your data file as it does when ChaosHunter creates the formula.


Since you can enter the Chaos Input in multiple nodes throughout the formula and possibly change the Chaos Input’s initial value while doing it, the Formula Editor will only remember the last chosen initial Chaos Input value. This value will be applied to all Chaos Input nodes in the formula on the very first row of data.

When you're finished creating the formula, click on the Accept Model button to add the new formula to the list of available formulas in the ChaosHunter Apply screen .


Click on the ChaosHunter Apply icon apply icon2 and you will see that a new row is displayed at the top of the list of "The winner and runners-up (optimization results)."  Any formula modified or created in the Formula Editor will display a row of asterisks in place of optimization results.  If you had any other formulas optimized by ChaosHunter, they will also be displayed on the list with optimization statistics.


1.  Click on the row with asterisks to make it the active model.


2.  Choose the data set for which you want to view results by clicking on either the optimization set, out-of-sample set, or all rows.


3.  Click the Apply Model button to view the predicted values and graphic display generated by the newly created formula.


If you don't like the results of the new formula, you can return to the Formula Editor and make additional changes.  If you want to return to a model generated by ChaosHunter, click on either the last row that displays results (rather than asterisks) or any previous model that displays results and then click on the Apply Model button.


ChaosHunter does not allow any formula to be deleted from the list in order to prevent accidentally losing a good formula.



Nodes with Subnodes

Note that if you change any node that includes sub-nodes, you will need to recreate the sub-nodes as well as the original node.  For example, if your ChaosHunter formula includes a node such as


x + y

  Eff (Close,10)

  Eff (Close, 3)


and you click on the term x + y and want to change that node to x - y with the same values for sub-nodes, you will have to re-enter the Eff (close, 10) and Eff (close, 3) operands.  To keep a record of the original tree version of the formula, you might want to click on the Model Menu, and select Model Info before you open the Formula Editor.  If you right click on the tree view of the formula, you'll see options to Print Tree, Copy tree to clipboard as image, and Copy selected item to clipboard, so you can record the terms in the original model.


Delete Node

If you highlight a node and click on the Delete Node button, the Editor deletes the highlighted node as well as all connected sub-nodes.


Clear Formula

If you click on the Clear Formula button, the entire formula is removed from the editing screen.


Threshold Values

If you are creating a formula with a trading strategy objective, you will see edit boxes for threshold values displayed in the Formula Editor.  The number of threshold edit boxes will vary depending on the trading positions settings in the ChaosHunter optimization tab.


For long and short as well as true reversal trading strategies, two threshold edit boxes will be displayed.  The trading rules for the formula will be calculated as follows:


Long and Short:


Long and short rules


True Reversal:

True reversal


For long only and short only, one threshold edit box will be displayed.  The trading rules will be calculated as follows:


Long only:


Long rules


Short only:


Short rules


Save the New Model
The last model that you applied to your data file is the one that will be saved.  To save the model for later use, click on the save model icon on the toolbarsave model icon or select Save Model from the ChaosHunter File Menu.



NOTE 1:  ChaosHunter will not optimize a model created or modified by the Formula Editor. Therefore, any formula that displays a row of asterisks in the Results Screen cannot be optimized.  If you continue optimization, the process will continue using the last formula created by ChaosHunter if one exists.


NOTE 2:  Some ChaosHunter settings may affect the results of a modified formula. For example, if you set the numbers of shares and commissions for a trading strategy on the Optimization tab, those values will be used to compute the modified formula. Click here for details.