Get Back Your Money

Monday, October 4, 2010

Finding Optimal Value without Optimization (Part 2 of 2)

In my opinion, lack of MetaTrader is a lack of information we get from the Detailed Statement. Perhaps because of the Detailed Statement of MetaTrader is also used by the broker to send to its customers. Clearly it is enough of the investors, but not for trading system developers. As an illustration, you can observe the MQL championship. At the end of the championship, you can see how they analyze the performance of a trading system. I wish such that report will be in the detailed statement.
I will show the detailed statement of the results of my test on my previous post.
You can notice that the detailed statement only provides general information about the profit / loss. But consider the following picture. This journal is a place where an EA can write down it's activities.
Script Report
Profit hari 4: 82 Los hari 4: 15 sumprofit: -138.42
What does it mean? EA to report profit / loss based on the Day(Hari). Profitable trades on the 4th day (Thursday) is 82 (trades), while losses is 15 (trades). And Net Profit is -138.42 ($).
Profit Jam 23: 37 Los Jam 23: 0 sumprofit: 190.39
What does it mean? EA to report profit / loss hourly. Profit for all trading at 23 is 37(trades). And losses for all trading at 23(trades) is 0. And net profit for all trading at 23 is 190.39 ($).
So just based on the above information I could find out that I will get optimal results if I restrict trading time at around 21 to 1. But you are wrong if you guessed that the backtest results from 21 to 1 will be the same if you add up the net profit from 21 to 1. From the reports mentioned above, only one is for sure, that I was not allowed to start trading at 19! For more details, let you see the following picture:
n backtest I did, I set the EA only took one trade for each position. While EA could have produced more than a signal at a certain period. From the above picture there are 5 trades that generate profit (1 trade per hour), but on my backtest, the EA is only allowed to take a trade for each position.
But anyway, for me the above approach is sufficient for my EA. Based on reports from my journal, i perform 3 backtest with different periods, but all of them lie between 21 and 1.

You can download the function that i used to create hourly/daily detailed statement. There are only 2 functions in text file, deinit() and Analyze().Moreover it just loop from 19 to 6.
Maybe you can make it better, and have a more brilliant idea. Every trading system has a different characteristics. What I would like to make is how to get the optimal value of a variable without any optimization. Or at least when designing an EA, we can create a report that is more detailed and rich information on trading results.

Sunday, October 3, 2010

Finding Optimal Value without Optimization (Part 1 of 2)

When a trading system suffered a drawdown phase, mostly what we do is performing optimization on a few variables to make adjustment to market condition. I do not want to debate whether the optimization will guarantee profitability or not. But one thing is for sure, do the optimization would take its own time in making trading system. But depending on a trading system that we make, sometimes there are some variables that we can actually know their optimal value without performing optimization.
In recent months I forced myself to complete an EA who worked on the USDJPY pair. This is based on several requests from my friends who came from Japan, and in general most of the visitors of this blog in recent months came from Japan.
I also get some input on the settings used on my EA, both vs_eurocross or on vs_eurchf. Actually I was a little worried about seeing their courage to use my EA on USDJPY pair, especially if they use vs_eurocross. But despite it all, what my concern is how they do the optimization in several variables, especially the trading time.
Finally I got the idea to create a function that analyzes the trading results as a whole when we make the process of backtesting. I think this should be better if the developer of MetaTrader include this report in a detailed statement. What I want from MetaTrader developer, as appropriate, we can get a detailed statement of profit / loss based on the hours or days. Isn't it interesting one?
Now to see how the script / functions work, I insert this function in the EA that I have just created. Then the functions / scripts will work right when EA completes an backtest. Or in other words, this function will be called from deinit functions in MQL4. As an experiment, I arranged for this EA to work from 19 o'clock until 4 o'clock. I do not want to mention the time zone, but for the record I always use data from Alpari broker. Apart from all the other variables, I do backtest from the period January 2010 to August 2010 and it's equity curve looks like the picture on the following image:
Befor OptimizationAh .. I do not think anyone wants to invest his money in the system like this. But maybe the person will change his mind after seeing the optimal value of the trading time that obtained without optimization.

Risk Warning

Please note that Trading in the Foreign Exchange market might carry potential rewards, but also potential risks. You must be aware of the risks and are willing to accept them in order to trade in the foreign exchange market. Don't trade with money you can't afford to lose.