During the past few months I have been working on the Kantu trading system generator, a program which allows any trader to generate trading strategies that have some desired historical results. Up until now the program has achieved many of the initial goals I had in mind but a key factor that limits the applicability of this program is the limitation in the inputs (in number and description) used to generate trading rules that deliver trading strategies. Right now Kantu uses only the OHLC values of bars and through simple comparative operators creates simple or complex price patterns that generate a desired historical performance result. In order to expand the scope of this program I decided to carry out an extensive addition to the software that will soon allow traders to add custom inputs and generate systems through a potentially limitless system generation paradigm. On today’s post I want to talk a little bit more about how I implemented this and why it adds so much power to the Kantu trading software.
The initial idea surrounding Kantu – to use parameterless price patterns to generate strategies – allows us to come up with a lot of trading systems that may generate satisfactory historical results across several financial instruments but the truth seems to be that the scope of these patterns limits the possible trading solutions that can be found across the board. The main limitation is that the patterns only use OHLC information and derive patterns through an addition of rules of the form  (><)  where  and  are a choice of the open, high, low or close of any given candle available for selection. In order to expand the potential of the program it is necessary to allow the software to generate rules that go outside of this “box” by giving the program freedom to generate rules in another manner. This does not mean that you will go outside of the parameterless price pattern model, but that you will consider other possible choices. For example you could also potentially run comparisons between a candle’s middle value (middle distance between high and low) and the OHLC values, and in this manner you can generate other potential patterns that do not rely on OHLC values.
When this became apparent I decided to implement some additional rules, but after some coding it became obvious that I couldn’t code everything that users might want to use. Since Kantu already implements a powerful back-tester it also seemed unreasonable to limit the scope of the software, given that some users might also want to use things such as traditional indicators or some other type of pattern that requires some limited parameterization, such as the definition of VSA patterns, harmonic patterns, etc. In order to comply with this I modified Kantu to be able to use any type of custom input, so that users can add the inputs that they desire into the software so that they can generate systems that perform comparisons with whatever data they want. The new feature extension for Kantu allows a user to add any input to the software and generate systems that use rules based on these inputs to achieve the desired historical results. It is also important to note that this functionality is completely independent from the previously implemented features, the user can decide whether to use the regular price-pattern generation technique or the new custom inputs when loading data.
The process to do this is fairly simple. When creating data to import into Kantu – either through MT4 or through the F4 framework – the user can add whatever variables he wants to use for strategy creation within the file. For example if I wanted to use the middle point of a bar as an additional input I would simply add it as an additional column to the csv that contains the data. In order to make this process as error-free as possible I can simply add an additional parameter to the code that creates the csv file so that my input for each bar is also saved for the whole array. In The F4 framework the csv file is saved using the RecordBars EA, with this code that saves time and OHLCV values:
fprintf(fp,”%s, %lf, %lf, %lf, %lf\n”,timeString, open(1), high(1), low(1), close(1));
If I want to add the middle point, I would simply add an additional column to the csv:
fprintf(fp,”%s, %lf, %lf, %lf, %lf, %lf\n”,timeString, open(1), high(1), low(1), close(1), (low(1)+(high(1)-low(1))/2));
In this line the (low(1)+(high(1)-low(1))/2) defines the middle point of the bar which we are saving as an additional column. In this same manner I can save anything I would want to use, the average volume, the body as a percentage of the ATR, the candle range, etc. I can also have things such as the body/range ratio or even indicators such as the MA, MACD, etc. I could even add the OHLC of another pair to use multiple pairs for system generation! In fact there is absolutely no limit to the nature or amount of variables I can add. I could add 50 columns with 50 different inputs and the software can then use these inputs to generate strategies. As a matter of fact I could even add fixed constants if I want to make sure that I will be able to generate systems that make some fixed comparison such as RSI(20) > 50. One of the few limitations is clearly that – since Kantu doesn’t know the nature of the inputs – it cannot automatically generate code for the systems but pseudo code is generated as showed on the image above (full code generation is only possible right now for the price pattern functionality).
With this coding addition the scope of Kantu becomes limitless in the sense that the user can now use any given input to generate trading strategies, the limitations on the inputs – such as ensuring them to be parameterless – are the sole responsibility of the user and the software simply finds strategies with some requested historical performance that use the data that has been included within the loaded data file. My idea with this release will be to provide Kantu users with an increased ability to create strategies with whatever inputs they may desire to use. This may also shine some light into the differences between indicators/price action based systems and the differences between different types of indicators. I would also like to point out that all testing functionality – genetic search, walk forward analysis, fixed quota, IS/OS study, etc – is also available when using custom inputs.
This release is currently on the works and will be released before next Monday. If you would like to learn more about system generation and how you too can create trading systems using software please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)