Description:
As everybody knows in order to achieve and maintain constant gain in the stock market, it is necessary to have discipline, a good risk management, and finally, follow strict rules know to work. It is no the intent to this manual to explain what a Trading System is. Surely, if you are reading this, you know what we are talking about.
This function allows to create, manage, and test any type of trading system, using the Programming Language. In fact, thanks to this, the only limit is the user fantasy.
These trading systems, once created can be associated with the securities, as it is done for Indicators. Using the "Control Panel", in the form "Studies", and selecting from the "Toolbar" the icon Analysis will be shown all available Trading Systems and those currently attached to the active security.
Before associating a Trading System, the only properties to set, are the one defined by the user when he created the Trading System. Default values are the minimum values in the validity range defined by the user when programming the Trading System.
Once all the properties has been set, in order to attach the Trading System to the active security just double click on its name in the treeview of the "Control Panel" and one last click on the chart of the active security. (see also paragraph on "Control Panel")
When all the Trading Systems have been associated with a Security it is possible to switch between them using the list which appears clicking on the icon on the main toolbar.
Use:
To access the function "Trading Systems Management" select this entry from the "Analysis" menu on the main program window, or just press the function key F7 One last option is to click on the icon from the main toolbar.
Table "Build"
In this form it is possible to create, copy, modify and delete any number or trading systems.
Keys of left vertical menu:
|
New
|
Create a new Trading System.
|
|
Copy
|
Copy the selected Trading System to a new one.
|
|
Delete
|
Delete the selected Trading System
|
|
Save
|
Confirm and apply all modifications done so far. Until this key is not pressed, the modification will not be effective.
|
|
Exit
|
Exit from the window.
|
To create a Trading System is necessary to click on the button New from the left vertical menu. A new element will be added in the "Trading Systems" section, and it will be given a default name with a progressive number. The name can be changed to a more significant one.
In the "Note" area is possible to insert a description for the Trading system, which will be useful to remember its working principle.
Now in the "Formula" section should be defined all necessary rules. Entry and exit from the long and short position.
It is not necessary to specify all the rules. For example you can choose not to have any rule for the "Enter Short" position. To do that, uncheck the box "Enter Short" The same principle applies to any other formula.
A specific section is dedicated to "Common Options", where will be inserted all definition for common options and variables used in many functions. In other words all the options or variables if a variable or an option is defined here, they can be used anywhere in a formula of the Trading System.
It is a very useful feature to have variables common to all modules. This allows to exchange information among them. like for example between a stop-loss and a take-profit. The value of these variables will not be reinitialized, and if it will not be explicitly changed, it will stay the same during the all test.
Options are nothing else than "variables" that are used in formulae. There are very useful during the optimization phase (test) of the Trading System. This is because they can assume any value between a min and a max, and the range is defined by the user.
In practice the program will test the Trading System for the various combinations of all options. Because of this, it is recommended not to exceed a reasonable proportion of max, min, and increment. The calculation time could increase a lot.
Let's clarify with an example:
If in the formulae there are 3 options which assume values in a range 1-20 with increment of 1. the number of possible combination will be 20 * 20 * 20 = 8000 It is clear now how easy it is to have a very high number of combinations, and as a consequence a longer calculation time.
Options, other than in the "Common Options" section, can be declared also inside the other modules. In this case, however, their scope will be only the module in which they where declared. If an option is declared in the "Enter Long" module, it will not be visible from the "Enter Short" module. On the other hand, if the option is declared in the "Common Options" module, then it will be visible and can be used in every module.
It has to be noted that if two options with the same name are declared, one in the "Common Options", and the other in the module "Enter Long", inside this module the local option will have precedence. The program will ignore the common option, and consider only the private one.
To see additional information on the use of Options, check the chapter "Programming Language"
Table "Options"
In this form are defined all the options to test the trading systems.
Keys of left vertical menu:
|
Save
|
Confirm and apply all modifications done so far. Until this key is not pressed, the modification will not be effective.
|
|
Exit
|
Exit from the window.
|
The available options are:
|
Positions to test
|
Define the kind of signal to consider in the test. It is possible to choose to test only the Long positions, Short positions, or both.
|
|
Entry Price
|
The Entry price of any single operation (Long or short). In this case, it is possible to choose the Entry price, max, min, or closing period.
|
|
Exit price
|
The Entry price of any single operation (Long or short). In this case, it is possible to choose the Entry price, max, min, or closing period.
|
|
Entry Delay (Periods)
|
It is the number of periods with which the test enters an operation (long or short), after generating the entry signal.
|
|
Exit Delay
|
It is the number of periods with which the test exits from an operation (long or short), after generating the exit signal.
|
|
Point Only Test
|
If its value is "True" the test does not consider the results in terms of Equity, but only as "points" of difference between enter and exit from operations.
|
|
Initial equity
|
Initial equity available for the test. It is used only if the properties "Point Only Test" is set to "False"
|
|
Margin requirement
|
Define in percentage the capita required to enter a single operation.
|
|
Annual interest rate
|
Define in percentage the annual interest rate of the account. This function allows to keep control on the interests gained during the periods with no investments.
|
|
Commissions Type
|
Defined if the entry and exit position are to be considered percentage values of fixed (in currency)
|
|
Entry commission
|
The Entry Commission of any single operation (Long or short). The value in this property can be considered a percentage or in currency, according with the value of the "Commissions Type" property.
|
|
Entry minimum commission
|
The minimum Entry Commission of any single operation (Long or short), expressed in currency. Used only in case "Commissions Type" has value of "Percentage".
|
|
Entry maximum commission
|
The maximum Entry Commission of any single operation (Long or short), expressed in currency. Used only in case "Commissions Type" has value of "Percentage".
|
|
Exit commission
|
The Exit Commission of any single operation (Long or short). The value in this property can be considered a percentage or in currency, according with the value of the "Commissions Type" property.
|
|
Exit minimum commission
|
The minimum Exit Commission of any single operation (Long or short), expressed in currency. Used only in case "Commissions Type" has value of "Percentage".
|
|
Exit maximum commission
|
The maximum Exit Commission of any single operation (Long or short), expressed in currency. Used only in case "Commissions Type" has value of "Percentage".
|
|
Compression
|
It is the compression of the Equity data while testing.
|
|
Minutes / Periods Other Compression
|
Specify the number of minutes for the Minutes Compression Type, or the number of periods for any Other type of compression.
|
|
Intraday day break (only for compression "other")
|
This property allows to break by day, in case of "Other" compression, and intraday data. In practice it allows the last compressed candle of a day, not to slip into the next day, even though this last candle could not have the same number of periods as it would be required by the type of compression. All this allows to keep the gap information visible, with the opening of the next day.
|
|
Data Load Type
|
Define how the test will load the security data. There are two possible types:
|
|
By Periods
|
|
Load the last n periods until the maximum number specified in the property "Max Periods to load"
|
|
|
|
|
By Date
|
|
Load at most the number of periods specified in the property "Max Periods to load", starting from the data and/or time defined in the property "Starting date" and "Starting Time"
|
|
|
Starting Date
|
Specify the start loading date when the property "Data Load Type" is equal to "by date"
|
|
Starting Time
|
Specify the start loading date when the property "Data Load Type" is equal to "by date"
|
|
Max Periods to load
|
Specify the maximum number of periods which the program will load for a given security. The upper limit is 200,000 periods.
|
|
Percent of periods to test
|
Defines the percentage of loaded periods which will be included in the test. This feature is used to divide in two half the periods loaded. In this way will be possible to understand more easily how the Trading System behaves before and after a given period. If for example, the value of the property is 70, in the final report will be highlighted how the Trading System has done in the first 70% of periods, and also how much is should have hypothetically given if it was followed. It can be seen almost a tool to test the future, it is useful to understand which options make the Trading System more stable in the long term.
|
|
Max number of test in report
|
This is the maximum number of test which the program will record in the report. The max number is 200 anyway. Let's suppose to have 10.000 possible "Options" combinations and therefore 10.000 tests, it is not very convenient to record them all. We are interested only in the one which has given the best results.
|
The following four properties are used to decide when a test with a given set of variable options, is better than another.
|
Better test for equity
|
A test is better than another based on the final equity gain. It can assume the following values:
|
|
None
|
|
In this case to decide which is the best test, no equity will be used.
|
|
|
|
|
Max
|
|
A test is better than another if the final equity if worth more, therefore the gain is greater.
|
|
|
Better test for Total positions
|
A test is better than another based on the number of operations. It can assume the following values:
|
|
None
|
|
In this case to determine which test is better, the total number of operations will not be used.
|
|
|
|
|
Min
|
|
A test is better than others if the total number of operations is lesser than the others.
|
|
|
|
|
Max
|
|
A test is better than others if the total number of operations is greater than the others.
|
|
|
Better test for Long positions
|
A test is better than another based on the number of long operations. It can assume the following values:
|
|
None
|
|
In this case to determine which test is better, the total number of long operations will not be used.
|
|
|
|
|
Min
|
|
A test is better than others if the total number of long operations is lesser than the others.
|
|
|
|
|
Max
|
|
A test is better than others if the total number of long operations is greater than the others.
|
|
|
Better test for Short positions
|
A test is better than another based on the number of short operations. It can assume the following values:
|
|
None
|
|
In this case to determine which test is better, the total number of short operations will not be used.
|
|
|
|
|
Min
|
|
A test is better than others if the total number of short operations is lesser than the others.
|
|
|
|
|
Max
|
|
A test is better than others if the total number of short operations is greater than the others.
|
|
In the case of an equity test (with the property "Point Only Test" set to "False") where the system will run out of equity, the test will exit from the current operation, and start with the next test.
Table "Test"
In this form, it is possible to test the Trading Systems, and see the result in a very detailed report on screen:
Keys of left vertical menu:
|
Test
|
Start the Test.
|
|
Cancel
|
Interrupt test execution and show the results calculated so far.
|
|
Check All
|
Select all securities shown in the section.
|
|
Uncheck all
|
Deselect all securities shown in the section.
|
|
Exit
|
Exit from the window.
|
The form "Test" is divided into two other forms.: The first "Reports", it is used to access the reports generated from previous test. The second "Test, where it is possible to start a new test session.
Sub Form "Test".
In this form it is possible to test any existing Trading System, with a group of security of a give workgroup. In the Securities section select the workgroup where the securities to test are, the select the securities (also with the buttons "all" and "none"); eventually select the Trading System to test.
Clicking on the button "Test" from the vertical menu, the test procedure will start.
There are two information displayed in this section:
|
Trading System
|
Is the name of the Trading System being tested.
|
|
Action
|
Describes the running action. Highlight the possible errors
|
|
Total estimated time
|
Shot the estimated total time the test will take to complete.
|
|
Securities in test
|
Is the name of the security beginning tested.
|
|
Time for this security
|
Show the time to complete the test for the give security.
|
|
Best Gain/Loss
|
Is the best value gain/loss obtained for the current security in the test.
|
|
Max Loss
|
Is the value of the maximum loss for the current security in the test.
|
Sub Form "Reports".
In this form are displayed all the test results available for the test already executed.
To access a report, select the workgroup from the "Securities" section, the Trading System, and then the report. On the second level of the treeview, is shown an ordered list of all reports produced for the give security, on that trading system and workgroup.
To show the reports result, just select it.
In the "Test" section are shown all the tests included in the report. Each line of this section, shows the result obtained for a certain combination of the variable options (shown also at the end of this section).
The results are divided into two parts. As explained before, among the test options (in the form "Options") it is possible to decide the percentage of the data to use in the test, and also the part of equity to use to "verify" the Trading System if it was followed from a certain point on.
Therefore there are the "normal" information and the "future" (or verification) information.
These are :
|
Gain/Loss
|
Is the gain/loss produced by the trading system with a certain combination of options variables.
|
|
%
|
Is the gain/loss expressed in percentage.
|
|
Longs
|
Is the number of long operations.
|
|
Winning Longs
|
Is the number of winning long operations.
|
|
Shorts
|
Is the number of short operations.
|
|
Winning Shorts
|
Is the number of winning short operations.
|
|
Totals
|
Is the total number of operations (long + short)
|
|
Total winning
|
Is the total number of winning operations (long + short)
|
|
Gain/Loss (future)
|
Is the gain/loss for the "future" or verification operations.
|
|
%
|
Is the gain/loss expressed in percentage.
|
|
Longs (future)
|
Is the number of long operations on the part of data used for verification.
|
|
Winning Longs (future)
|
Is the number of long operations on the part of data used for verification.
|
|
Shorts (future)
|
Is the number of short operations on the part of data used for verification.
|
|
Winning Shorts (future)
|
Is the number of winning short operations on the part of data used for verification.
|
|
Totals (future)
|
Is the total number of operations (long+short) on the part of data used for verification.
|
|
Winning Totals (future)
|
Is the total number of winning operations (long+short) on the part of data used for verification.
|
|
Options
|
Are all the columns of options variables used in formulae of the Trading System. Their combination is what makes the difference between a test an another. A test is identify by the value of its options.
|
In addition to these information there are other 5 details tables:
|
General
|
Contains general and statistical information.
|
|
Positions
|
Contains the complete list of operations performed on the data to test.
|
|
Equity
|
Shows the equity changes while time goes.
|
|
Future positions
|
Contains the complete list of operations performed on the data to be uses as verification.
|
|
Information
|
Shows the "Options" defined in the table "Options" at the time the test was run.
|
|