May 14, 2012 Last modified May 20th, 2012 (see bottom of page)
After presenting the performance results of the original Ichimoku Kinko Yho script, it was time to start making some improvements, but first, there is a requirement of understanding what the script is doing exactly, and once this understood, proceed to the next phase.
The Ichimoku Kinko Yho charts 5 lines over past data resulting in a variation of a moving average cross-over system. It goes on the assumption that a lagging moving average projected in the future might have some forecasting value! The price 26 days ago is just that, the price 26 days ago.
As such, the script presents little interest, however, its bet sizing procedures might provide some interesting elements should the moving cross-over system have merit. This script could win big when it makes its triple bet on a big move as in PCLN for instance, if such a position was taken.
According to my preliminary analysis, the script has not shown great value at the portfolio level where it counts. As a matter of fact, the Ichimoku Kinko test revealed that performance wise, it was not the star depicted in market folklore.
When analyzing the script, you find that it wins not by executing trades in a timely fashion but by failing to close positions simply because another entry was made. This way, some trades become trapped and stay open for the duration of the test and thereby becoming Buy & Hold positions. It is these unintended left opened positions that can account for most of the generated profits.
For instance, in the original Ichimoku Kinko Yho test, PCLN generated 74 trades over the 1,500 trading days with an ending profit of $538,005, while 6 of the 8 trades left opened due to faulty program logic totaled $570,144 in profits. This makes the Ichimoku Kinko Yho script absolutely worthless since repairing it's logical bug would most likely erase all profits and then some.
On the other hand, I could capitalize on the script's inherent flaw since my techniques are of the Buy & Hold type. This should be funny, you find a script that ends up being logically flawed, not even doing properly what it was intend to do, and then you find ways to accentuate the flaw which should become a feature in your version of the script. Simply amazing.
There will be a need not only to change the underlying trading philosophy but its betting system as well in order to improve performance. Like in all my script modifications, I usually start with data filtering in order to reduce the background noise and this script will not make an exception.
So, let's get started. The task will not be simple as from the start the script is fundamentally flawed; however, this particular flaw might have some value. I don't like much about this script; maybe I should have chosen something else.
May 15th. 2012
Further analysis of the Ichimoku Kinko Yho script provides better understanding of its weaknesses; technically it is a variation of simple moving average cross over system using longer term averages to resize its directional bets. It is a stop and reverse system ready to play long and short based on the two shorter term moving average cross overs. And at times, it misses an exit on a trade which is never revisited making it a long term hold and after investigation is revealed to be the major source of the generated profits.
The ways to improve the script will be first to have it stop shooting itself in the foot. The trading method used gets whipsawed at lot; generating too high a level of stop losses (65%). And the really profitable trades are the result of an unintended side effect of the trading procedures used. The script wins because of its inadvertent Buy & Hold on trades that failed to be exited as if escaping the “else if CrossUnder then” code logic. It can miss exiting a long or a short position.
Added later during the day.
I had an inherent flaw in the original program that I wanted to exploit, not only did I wish to keep it active but I also wanted to enhance its presence as it would be considered a feature in my trading style.
So from the original Ichimoku script which produced the following test results:
I went to the following where the unintended Buy & Hold “feature” of the original script is being exploited for the benefit of a long term view of the market. Even at its initial enhancement stage, the modified script produced the following:
May 16th. 2012
To improve on performance, I wanted to keep the inherent program flaw of failing to exit some of its positions. But at the same time, remove trades that were slowing down the script's progress.
One of the first things I did was to remove the shorting ability of the script. It now only goes long. Removing the short side also removed the short trades that had failed to exit and thereby improving on performance. Also, the shorting abilities of the script were not that good.
The second thing was to enhance the program flaw; force the program to trade more and accumulate more shares. Accept some of the generated profits in order to generate the funds needed to buy more shares.
Already, the trading procedures have changed sufficiently to alter the very nature of the original Ichimoku script. It lost its stop and reverse ability and then its unintended flaw has become a feature. From a flawed design, the Ichimoku script is losing its identity. A few more modifications and it might be necessary to change its name.
Added later during the day.
After having improve the script's design a bit, I wanted to make sure that I would keep control and still have scalability. As stated in an earlier note, if you double the bet size taking the same trades you should double your total profits as it results in: Σ(2H.*ΔP). And increasing the number of profitable trades will also result in increased profits. Therefore, there seems to be two missions in controlling or guiding the portfolio to higher performance levels: controlling the bet size and increasing the number of profitable trades.
My first test was on increasing the number of profitable trades. We can see the progression from the set of charts below. The intention is not to push the machine, it is only to show that increasing trades will generate more profits. It will be at a latter stage that I will start to increase the pressure. So here are the preliminary results:
To show that doubling the bet size should result in practically doubling generated profits, here is the last chart with its bet size having been doubled:
I think the point is being made that I have kept control over the bet size and scalability. This way, I could at any time, invoke scalability, increased bet size and accelerated trading as methods to enhance long term performance.
Time to find better trading methods and correct the other deficiencies of the Ichimoku Kinko Yho trading script.
May 17th. 2012
To go to the next level, it is required to refine the understanding of what's already there.
An American translation of the Ichimoku Kinko Yho script would be a Donchian channel system using only the channel's mid-points as a 7 and 22 bars moving averages cross over system. Is added to the mix two other longer term Donchian channel's average mid-points plotted ahead of their respective lags. You get the impression it is a complex system when in reality you are just dealing with a slight variation of a moving average cross-over system; as if the price 26 bars ago has any predictive powers. The script's main function is to chop a lot due to its mid-point averages criss-crossing the chart all the time. And as such, the Ichimoku script is worth absolutely nothing. The long term expected value of such a script should be zero, is zero, and most probably sub zero.
The original Ichimoku script makes some money, even beats the Buy & Hold, not based on its moving average system, but mostly on the fact that it misses to close some of its trades due to a faulty logical setup. The script wins due to a programming error. It turns some of its trades into a Buy & Hold proposition and indirectly compounds its unintended paper profits. Correcting its error removes all its profits and more.
So there I is, trapped in a script that has little if not no value, trying to show that you can transform a script to produce more than what it was designed for.
I think the next step will be for the Ichimoku script to totally lose its identity: its methodology has no value. It only looked good due to its folkloric interpretations. But after analysis, there really is nothing there.
And, to me, the question remains: how do you improve on something that is not there?
May 18th. 2012
The solution sounds simple: ignore what is there.
Doing so would render all of what the Ichimoku script was designed to do totally irrelevant and worthless. But already, the initial tests have demonstrated that the original script is not worth that much; its design is flawed and what ever it makes as profits are not primarily based on the trading principles it tries to advocate. I should simply admit that my initial chartscript choice was not that great.
Therefore, the next phase will start to almost totally ignoring the Ichomoku Kinko script's identity.
When looking at the trading equation, especially in matrix form, it is easy to represent the generated profits from all sold positions:
Σtn(Qk=s)Pt - Σtn(Qk=s Pt) = Σt profits
where k=s means that the positions k were sold. The above expression simply states that the value of what is sold minus its cost represents the sum of profits earned. What I often see neglected in the above expressing is the number of trades (n). To make a profit it is sufficient to sell the inventory at a higher price than its cost.
Σtn(Qk=s)Pt > Σtn(Qk=s Pt)
The interesting part that should be considered more is the simple fact that increasing the number of such transactions is sufficient to generate even more profits. As if saying that it is desirable to increase the number of trades to extract more profits.
An immediate available solution to increase performance would be to increase the number of profitable trades over the portfolio's life. Naturally within all the portfolio constraints, as usual.
So, back to the drawing board.
May 20th. 2012
Of the original Ichimoku Kinko script all that is left is its entry and bet sizing process. Its stop and reverse ability has been removed as being unproductive; it was my primary reason for having selected the Ichimoku chartscript. It would have been my first attempt at using shorts in my trading methods. Was also removed from the script its exit strategy which was replace by something more productive. To increase performance I can see that both the last two remaining processes will also need to be replaced.
I opted to do a portfolio level test based on my current version (0.05) of the script. All the modifications have been done using AAPL for script development purposes; first to debug the script, and also view part of the script's behavior over time. Doing a portfolio level test will be the same as having 42 of the 43 stocks in the SD1 dataset not having seen the modifications brought to the Ichimoku script. Also, the test will be done after a significant market correction which should have for effect to reduce overall performances.
Here are the portfolio results over the 43 stocks spanning the usual 1,500 trading days:
Some observations on the results. Performance at the portfolio level greatly increased. It was not just AAPL that increased performance, it was 40 out of the 43 stocks in the portfolio. The number of trades when from 3268 to 5894, an 80% increase while the hit rate went from a 35% to a win ratio of 71%; and at the same time increasing the average profit per trade by a factor of 5.67. The procedures increased the number of winners and therefore reduced the number of losers to 29%.
Some negative observations, the script in its present form (version 0.05) still has some weaknesses, most of them still related to the Ichimoku Kinko view of things. For instance, it tends to hold too long to declining stocks as a consequence the lower performers are the stocks that held the longest to losing trades. That can easily be remedied. Not a negative observation, but, there is much room to improve this script, unfortunately, it will totally lose its identity.
Added later during the day.
The Ichimoku script in its present state is still scalable; therefore doubling its initial stake would simply double the final output or close to it. It would maintain its CAGR. Continuing to improve on the Ichimoku script will require to abandon its method of trade entry procedures; and doing so will remove another not so great feature of the Ichimoku procedures. All that would be left is the bet size variations based on the Ichimoku's mid-channel moving average cross-overs. And when you think about it, if none of the Ichimoku procedures managed to make a profit, why should its bet sizing procedures make a difference. However, the very concept of these varying bet sizes could be beneficial under other trading procedures that could render the strategy more profitable. But that is the problem, using other entry procedures renders would render the original Ichimoku absolutely worthless.
And there I am, with a script that I thought could help me for my next phase (hoping to handle the short side of things) I was left with nothing of the original script except for the concept of varying the bet size based on the relative strength of price movements.
Well, this I will have to work on it.
( to be continued...)
Created... May 14, 2012 © Guy R. Fleury. All rights reserved