Edit an Existing Formula

Top  Previous  Next

The ChaosHunter Formula Editor allows you to change an existing ChaosHunter formula which you can then apply to a data file and immediately view results.  The Editor also gives you the ability to create a formula even if one does not exist.  See Create a New Formula for details on developing new formulas.


Open Data and Model Files

Before you can modify a formula, you must insure that the data file used to create the formula and the model file are both open in ChaosHunter.

Click here for details.


Open the Formula Editor

Click on the Tools Menu and then select the Formula Editor.  If ChaosHunter previously created a formula, it will be displayed in the editor.  Otherwise the formula box will be blank.


Formula Editor Highlight3


The ChaosHunter Formula Editor lets you modify formulas found by ChaosHunter.


Edit Options

Click on any node in the formula to highlight it.  Next click on the Insert/Modify Operand button and a new screen displays five tabs with options for modifying the selected node.   You can change any node to a different value or you can assign the node an entirely different purpose.  For example, you can change a node from a Spread % indicator to a neural network.


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.  The formula outcome on row 1 in your data file is calculated using input data from row 1 and the initial value you set for the chaos variable.  On row 2 the formula uses inputs from row 2 and the calculated formula value from row 1 for the chaos input, and so on.


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 changing the highlighted node, click on the OK button to add your changes to the formula.  Repeat the process for any other node you would like to edit.  


When you're finished modifying the formula, click on the Accept Model button to add the revised 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.  The original formula that you modified in the Formula Editor will also remain on the list.  The original formula will display 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 edited formula.


If you don't like the results of your changes, 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 only 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.


NOTE 3: For an existing model the optimization goal function cannot be changed and stays the same function it was when creating/optimizing the original model. For example, if you originally optimized a model with the Buy/Sell Cutoff trading strategy, then switched the optimization goal function to Buy/Sell True/False, then edited and accepted the modified formula in the Formula Editor, the model will still be in the Buy/Sell Cutoff trading strategy mode.  The Formula Editor can only recognize the setting for the optimization goal function when there is no existing model in memory prior to entering the Editor.