Decision table

Stock trading decision table.
This example shows a decision table that helps a hypothetical stock trader make trading decisions. Our hypothetical trader believes that the sell/buy decisions should be made based on the trend of both the stock at question, and the market in general.

In the following screenshot, we used two range formulas to create all the nine possible combinations of stock/market trends:


Screenshot: creating market/stock trend combination using data range

We are now ready to add our trading policy, which depends on the market and stock trend. To do this, we add a new column, titled "policy", that lets us type in our trading policy for specific conditions:


Screenshot: Adding policy column to the decision table.


Source code
Following is the source code for this example. To use it in your copy of NumericBase, copy and paste it in the View Source window.

table Table1{   trend:=!   market:=datarange trend!   stock:=datarange trend!   policy:=!   <1>:={trend:="up",}   <2>:={trend:="down",}   <3>:={trend:="same",}   <4>:={policy:="buy",}   <5>:={policy:="strong sell",}   <7>:={policy:="sell",} } optimized(40,40) project(Table1);
Listing: source code of the decision table example
Login to post comments