Tuesday, September 30, 2014

Maximizing your profit with QuantSense LOG

The aim of this post is to show you how to maximize your trading profit in QuantSense LOG. Before we start make sure you have some reasonable number of trades imported in QuantSense LOG. You can import them automatically if you have your trade history from Meta Trader 4 in .htm file (Statement.htm, DetailedStatement.htm or something similar). The other way is to record your trade manually in QuantSense LOG simply by typing in all parameters of the trade. What is the "reasonable" number of trades? Well, four is not enough. We should speak about hundreds, but for start anything more than 10 should show you something interesting. 

The next assumption for this kind of output from the QuantSense LOG is that all your trades have minimal and maximal values defined. This is a bit complicated since you have to enter them manually even for the imported trades. This is because your trade history do not contain this kind of data. Since I wrote QuantSense primarily for myself and since I am a lazy man the PRO version is able to approximate these values from market quotes. But PRO version is not done yet so we have to do this work manually (ok, not me I got unfinished PRO version where the approximation already works). If you do not have maximal and minimal values of the trades in your records the histogram chart will not display anything and you get some message about the reason why this is not happening.

If we have all necessary data in the database lets display the histogram chart. Probably the best way is to do this at one particular instrument. So switch your trade navigator (the left panel in the Dashboard screen) to the "Instruments" view. Pick an instrument (EURUSD for example) and if you want you can filter the resulting set of trades by date interval (to make the computation on the trades from the last year only for example). Now select the "Histogram" chart from the scrolling chart menu in the top part of the screen. You should see something like this:

Full size image here

Let me describe the displayed data a little bit. The x-axis in the bottom is divided into 20 so called buckets. For simplicity just assume that the number under the green column is a representative of all profits which belongs to this bucket. The height of the column (the y-axis) shows the number of trades from this bucket. These are the trades whose maximal(not realized) profit was approximately the value under the column. From the picture here we can see for example that I have made 10 trades whose maximal position value was around 242 pips (6th column from the left). Note that all of these trades could end with a loss. What we are trying to find here is how good are you in opening positions. It means how high can your position typically go while it is open. If you then wait too long and your position hits stop loss that is the other story and we want this story to finish in green numbers.

We should know now what is the histogram displaying and we can start optimizing our future profits. Lets say that I will change my trading from tomorrow such that I will close the position after it hits the profit of 800 pips. I will make no other changes in my way of trading only this one thing. Just close it after it reaches +800 pips. Will be my profit positive? Of course, nobody knows the future but we have a sample of our behavior and all our reactions to the market actions in our sample of trades we made in the past. So we can guess with some decent probability what will happen after some number of trades. Because we wait until the profit hits 800 pips all the trades whose maximal profit is less will turn against us and will finish with loss by hitting your stop loss. Take a look at the histogram. Those loosing trades will be all the trades to the left from the column with value 854 (15th column from the left). On the other hand some of the trades from column 854 and all the trades to the right of the column 854 will satisfy our condition (their maximal profit was over 800 so we would close them when they hit precisely 800 pips). All we have to do is to count the loosing and winning trades from the histogram (summing up the heights of particular columns). In my case there is something around 136 loosing trades. The number of winning trades is 6. The resulting mathematics now depends on what was your typical stop loss in the displayed sample of trades. Let say it was 50 pips. That means if we trade such that we close the trade when it hits exactly 800 pips of profit we will have 6 winning trades with  4800 pips of profit and 136 loosing trades with loss of 6800 pips. So the clean loss would be -2000 pips. 

Now you should see the point. 800 pips was not a good idea. So try to decrease our take profit value to 50 pips. Then all trades to the right of the column 38 (3rd from the left) will be the winning ones and all the trades to left from the column 38 including the trades from it will be the loosing ones. Again, we sum the counts up and we get 77 winning trades realizing profit 50 pips each and 55 loosing trades realizing loss of 50 pips each. This seems much better with a profit of 1100 pips.

So this is what the histogram in QuantSense LOG is for. Some important remarks at the end.

  1. You should not change your trading strategy in any other point except for the take profit parameter. Remember, all your trades used for the optimization were made in some way - it does not have to be a precise strategy. You can open your trades using your intuition as well. So for example (my case) if you trying to open positions for a longer term awaiting profits in thousands of pips just do the same. Open the position any time you think the price will go very high (or low) in the next few days. With one exception. Close that position after it gets to the computed value of optimized profit. I know its hard especially if you think the position will be in the marked whole week and suddenly you have to close it after one hour because of the optimization. But that is how it works.
  2. Do not start scalping or some kind of very slow high frequency trading :) if your new profit target is very small. If you did 20 trades per month before keep that frequency now as well.
  3. If you find the optimal value of your profit target and you will keep the points 1 and 2, your results should improve.
  4. The optimal value of your profit target does not have to exist. In this case you can only minimize your future loss and you have to think about changing your strategy (or your intuition :)). I hope this is not your case.
One of my goals is to make this process automatic in QuantSense PRO. I know to do this manually with your finger on a chart is a pain. But it is enough to do this once per month to see how you should adjust your trading according to last sample of trades.

Thanks for reading and for using QuantSense LOG.


  1. Hi Lubo.

    Recently I found this app in windows store. I am amazed. It is really excellent.

    I am requesting one more feature. If you can add this this will become real beauty.

    I am entering my trades in to the app manually. I got doubt that If my computer got crash I will loose these data which i entered manually. That's why I need a feature to backup my trade data. If anything unusual happens I can restore the data.

    Thank you very much for this wonder.

    Vamsi Krishna.

    1. Hi Vamsi,
      I have sent you an email. For other readers I just note that import and export of your own trading data will be available for free in the version 1.4 which is currently in development. The format of the data will be xml with publicly available DTD so advanced users can use it for other purposes as well.

  2. I am eagarly waiting for upcoming features.