Returning to Puria
The Puria trading advisor is well known in the traders. The algorithm of the Expert Advisor is widely described on the Internet. The original description of the principle of the Expert Advisor was as follows:
Indicators used:
1. Moving Average MA(85), Linear Weighted apply to Low, color red;
2. Moving Average MA (75), Linear Weighted apply to Low, color red;
3. Moving average EMA (5), apply to Close, color yellow;
The MACD indicator (15, 26, 1).
Entering the market to sell: The yellow moving average crosses two red ones from top to bottom, the MACD confirms the signal if it is below zero.
Entering the market to buy: The yellow MA crosses both red ones from bottom to top, the MACD confirms the signal, being above the zero mark.
The author has suggested small TakeProfits from 10 to 20 pips, and StopLoss of 14 pips. Further there were recommendations on ten currency pairs and their timeframes (only M30 and H1), on which it was recommended to use the Expert Advisor. Immediately, the Expert Advisor was offered and published several realizations of the strategy for free use, but the interest was quickly lost.
A new wave of interest to Puria trading strategy appeared at the end of December 2010, when the Championship of Expert Advisors was over, and the Expert Advisor of this trading strategy got the 2nd place out of several hundreds. It is because of this close attention to the tactics that I called these notes "going back...". But I describe my implementation of the Puria trading strategy, which is noticeably different from the originally described trading strategy, so I will call it Puria2M - Puria, which has gone through two successive rounds of transformation.
The logic of the Puria2M trading strategy
The differences between this system and the previous version are as follows:
- everyone numerical strategy parameters (smoothing periods in indicators, values of stop levels) are not fixed, but optimization parameters;
- in the advisor are rewritten strict "intersection of curves" criteria (as opposed to the Puria implementations walking around the net), now these are really strict rules of intersections, which, when used, can result in several (2, 3, ...) open orders of one direction (Buy, Sell) in some parts of quotations;
- trend advisorTherefore, it makes absolutely no sense to allow the possibility of simultaneous opposite orders in it - in this implementation, when a signal to open, all previously open orders of the opposite direction are closed forcibly;
- added to the Expert Advisor (alternatively) capital management algorithm (MM) - one of 5 ways;
- added to the Expert Advisor the ability to track the StopLoss level to achieve Breakeven.
Optimization and testing of the Expert Advisor
I do not think it is appropriate to show unoptimized test results. So let's go straight to an overview of some optimized results.
The Expert Advisor has a large number of adjustable parameters in order to optimize it thoroughly. In addition, extensive testing has shown that the modified EA behaves quite well on a much wider set of currency pairs and timeframes (very good results on M15 and even M5).
Below is the chart of advisor on EURUSD M15 for the period of history 2010.10.01-2011.02.16 (a little over 4 months). The work is carried out by a fixed and very small (0.1) lot, the initial deposit is 1000 USD.
Fig.1. A chart of the Expert Advisor on EURUSD. Time frame M15.
Data of averaging periods optimized for the test conditions shown, radically (many times) different from those recommended in the original Puria method.
Testing of the advisor on different dealing centers
Much more revealing is the testing, conducted on historical data from several different brokerage companies (in different instances of the MT4 terminal). Shown below are 4 such charts, obtained on quotation sequences of different DCs. Testing was conducted on EURUSD, M15 for the history period 01.01.2011-16.02.2011.
Fig. 2. Testing of the Expert Advisor on Alpari.
Fig. 3. Testing of the Expert Advisor on NortdFX.
Fig. 4. Testing of the Expert Advisor at Forex4you DC.
Fig. 5. Testing of the Expert Advisor on InstaForex.
All 4 tests were performed under the same conditions, with the same pre-optimized values of the EA parameters. I should admit at once that it was very difficult to obtain such synchronism of curves: contrary to initial expectations, the initially obtained curves radically differ (for any Expert Advisor!), up to the number of trades on the same time interval. This is due to the simultaneous influence of several factors:
- different time scales used by servers of different DCs (shift by 1-2 hours, and nowhere this scale is the same as GMT);
- different number of characters (4 or 5) in the representation of quote prices (5 on Alpari, and 4 on all the others listed);
- different value of the "standard lot", adopted by different brokerage companies (100 000 units of quoted currency at all, except for Insta Forex, where this value is 10 000).
In the end, as we can see: the curves coincide with great accuracy, but the exact numerical values differ. This is a very interesting question, but it requires a rather detailed discussion and is beyond the scope of this article. Nevertheless I will dare to formulate the following statement: if you do not get the same kind of test curves on the data of several different brokerage companies, then the tested Expert Advisor contains serious errorswhich will eventually "come out" on the real account.
Connecting money management
The advisor provides a choice of several mechanisms for money management (MM, numbers. 54 и 65 ForTrader.org magazine), one of which is the complete absence of money management, trading with a fixed lot, the results of which were shown above.
For testing this time I chose a very large interval 2010.01.01-2011.02.25 (more than a year), at a very small initial deposit of 100 USD and a very small initial lot 0,01 (in the absence of money management it is a fixed lot size, and if it is available - the initial value of the lot), the dealing center of testing - Alpari (5 characters).
Note: I give optimized test parameters, for possible repetition of the experiments:
? EURUSD (Euro vs US Dollar),
? Timeframe 15 Minutes (M15),
? Testing period: 2010.01.04 00:00-2011.02.25 21:59 (2009.12.31-2011.02.25);
? Model: On the opening prices (this is enough - the Expert Advisor works on the previous closed bars);
? Parameters: FixLotSize=0.01; RiskPercent=3; StopLossPts=60; TakeProfitPts=310; MovingPeriod1=18; MovingPeriod2=60; MovingPeriod3=220; DebugLevel=2; ConfigureFile="PuriaM2.cfg"; MM_method=0; MM_parameter_1=0.01; MM_parameter_2=0; Bezubitok=false.
Fig. 6. Working with a fixed lot 0.01.
The following result was obtained under the same conditions, at proportional lot size managementThe size of the next lot is calculated in proportion (both increasing and decreasing) to the ratio of the current accumulated deposit size to the initial one.
Fig. 7. Proportional management of lot size.
The last graph is shown at The Ryan Jones method of money management (fixed proportion method), with a very small (aggressive) value of the "delta" parameter of the method.
Fig. 8. Ryan Jones' method of capital management.
Very briefly, a couple of words should be said about caution in choosing a money management strategy for a specific EA: using an unsuccessful money management can reduce the profitability of an EA (or even turn it into a loss-making one). One of such dangerous practices can become a proportional control of the size of lot (shown above) for the Expert Advisor, which "alternates" profitable and losing trades, and PuriaM2 is such. In this case after a profitable trade (potentially, under the next losing trade) the increased lot will be "inserted", and after a losing trade (under the profitable one) the lot will be decreased.
Conclusions
From the above, it is possible to draw more than enough conclusions and discussions that go far beyond the reasonable length of an article. But I will highlight the main ones:
Shown at Puria advisor - profitableBut, most importantly, at the same time: a) it does not require large deposits, b) does not carry high risks, such as, for example, any advisors that use the "Martingale principle".
1. Check your Expert Advisor on the quotation histories of several dealing centers, if you fail to achieve their sufficient similarity - your Expert Advisor contains serious errors. There cannot be exact coincidence of test results on quotation histories of different dealing centers fundamentally.
Trading strategy (algorithm of advisor's work) and money management strategy (MM) - 2 different, and largely independent mechanisms, which are combined in one advisor. To almost any TS can be "screwed on" almost any money management strategyAlthough there may be contraindications here as well. The MM successfully added to the TS increases the effectiveness of the TS many, many times over, or quickly kills an unfinished TS.
3. testing confirms the statement Larry Williams: "Successful trading makes money. Successful trading with proper money management can create untold wealth" and what The capital management strategy is more important than the trading strategy of the Expert Advisor.
Evaluate the quality of a new Expert Advisor (Expert Advisor trading strategy) only when the money management system (if any) is disabled, working with fixed lot, - It's the only way to judge whether this one is good or bad. trading strategy.
У меня при компиляции советника PuriaM2_07 выскакивает ошибка «AboveMaProfit» — function is not defined. Что делать?
I have the same thing...
Dear author, I am very interested in the Expert Advisor modified by you. But tell me how to compile it correctly, because when you try to do this, you get errors related to the connection of libraries. Thank you in advance.
Dear author, could you please tell me how to set up the puria2m Expert Advisor for the Ryan Jones method? Thank you.