The effect of the environment

A very important human skill is the ability to maintain a balance in every aspect of life, to observe a certain golden mean. Any business, on which exactly as much effort and time was spent as was required to achieve the result, brings immeasurably greater satisfaction, compared to the complete waste of all physical and moral spirit at the same results.

The third day of the working week - Wednesday - is an obvious golden mean for stock trading. The antagonists in this case are Monday and Friday. Trading activity at the beginning of Monday can be called a venture in terms of thoughtfulness, but no movements will be missed. Concluding deals on Friday is like running in the hope to catch up with the departing train, but the probability of choosing the right train is incomparably higher than on any other day of the week.

The convenience of Wednesday is that there is enough data to analyze from Monday and Tuesday. At the same time, there are still two full days left to make some steps, plus Wednesday itself. That is, a trading decision made on Wednesday will be the golden mean between the weightedness of the decision and the speed of its making.

It was in this direction, apparently, that Andrei from Kursk (NutCracker), who authored the advisor, was thinking "The effect of the environment.". The first acquaintance with his creation by testing sets a positive mood (see Figure 1).

Testing the author's version of the Expert Advisor

Testing period affects five years - from January 1, 2003 to January 1, 2008. Small number of deals for such a long period of time is explained by low frequency of their making - 1 deal every Wednesday. To increase the number of transactions it is necessary to increase the testing period or use a more radical method, increasing the number of Wednesdays in a week.

Testing the Expert Advisor on the recent history (from 2008 to today) may suggest that there is no environment effect at all, but only a random coincidence of circumstances (see Fig. 2).

The reason for such behavior of the Expert Advisor should be sought in the strategy rules, as no gross errors were found in the program code. In the description of the rules for concluding trades, Andrey writes: "The Expert Advisor trades the flat pattern of Wednesday by the signals of the Stochastic oscillator. Checks the condition of the oscillator line crossing the levels overbought or oversold."

In other words, the answer is in the very formulation of the problem: everything is oriented towards small price fluctuations - on the Flat. As many people remember, 2008 marked the transition to a completely different type of market - the trend market. Since then, few people are surprised by average daily price changes of several hundred points. Before 2008 such fluctuations were perceived as something out of the ordinary. It is not surprising that the Stochastic oscillator settings, designed for flat conditions, were powerless before the trend.

In addition to the problem of "flatness" of the strategy, it should be noted its edentulousness. In spite of the fact that the Expert Advisor settings contain such control levers as the level of stop order, profit and even a trailing stop, their values in the author's testing do not affect anything. These values are too large, which makes the set levels unattainable for the time of a deal's existence.

The only factor of closing positions in the Expert Advisor is time. The existence of the transaction shall be limited to one day and at the end of the nineteenth hour of the day, liquidation shall take place.

As a result, we come to the conclusion that the Expert Advisor does not perform any analysis of the past two days of the week, using the environment effect as an axiomthat has to do everything for the trader.

Finalizing the strategy and the expert

"Trust in God, but do not fail" - this proverb describes the situation very well. The environment is the environment, but you cannot rely on it alone, miraculous. In addition to the direction of the transaction, you need to take at least one more, two solutions. Both decisions deal with determining the level of deal closure, i.e., not "when" but under "under what circumstances."

The first circumstance would be unfavorable the development of events that determines the level of stop order, and the second - the favorableindicating the level of profit taking. Both levels can be calculated based on the range of price movements during Monday and Tuesday.

We leave the same strategy signal for making a deal. Opening long position will occur when the price leaves the oversold zone of the oscillator Stochasticand the discovery short position will occur when the main indicator line leaves the overbought zone. Periods of stochastic lines are specified in the external parameters of the Expert Advisor K (period %K), D (period %D) and S (deceleration period).

Zone boundaries We leave the overbought and oversold oscillator at the same level - 79 lower boundary of the overbought zone and 21 upper boundary of the oversold zone. These values can be changed by correcting the L_open parameter. The boundary of the overbought zone is defined as 100 - L_open.

Determining stop order and profit levels we will make on the basis of current maximum and minimum of the week, using such a convenient tool as "Fibonacci lines" (see Fig. 3). In case of getting a signal to open a long deal, line 100% is located at the maximum of the week, and line 0% - at the minimum. From the received borders of the current week channel it is possible to build additional lines.

In case of USDCHF pair we will set the stop order level at the line "-11.8%". The profit taking order should be placed just above the maximum of the week - at the level of "120%". Changing the values of the levels is possible thanks to the FiboStop and FiboTarget parameters.

An important consideration is the price trade opening. In many cases, the main oscillator line exit from the oversold zone occurs too late, when the market price is in the upper part of the weekly channel. This situation initially puts the trader in a losing position, as the risk of the transaction far exceeds the potential profit. Therefore, it is worth waiting for the price to return to the lower part of the channel. For this purpose, we will use the Buy Limit order set at the level of the line "45%" (regulated with the help of FiboOpen). Figure 3 does not show that this is how the long position was opened, as the price captured the order very quickly. Finding the position opening price above the "45%" line is explained by the presence of a large spread - 4 points.

Tactics deal closure by time, used in the original version, will not be completely discarded. Its disadvantage was the quick closing of a position, which did not allow the success of the trade to develop. It would be logical to give each position a chance to exist until the end of the week. After all, Wednesday was chosen for this very purpose, after which there are two more trading days.

Therefore, in the new version of the Expert Advisor, trades that could not close naturally (by reaching a profit or stop) will be closed at the end of Friday. The last trading hour of Friday differs from broker to broker, so it is necessary to set it using the external parameter WeekEndHour.

In case of receiving an opening signal short sale the algorithm of actions is similar, but it is reversed by 180 degrees (see Fig. 4).

The level "0%" is located at the maximum of the week, and the level "100%" - at the minimum. In this case, it is clearly visible that when receiving the signal, the price was in the lower part of the channel. To open a deal at the best price, which is located in the upper part of the channel, a Sell Limit order was set at the level of "45%". The order worked and brought the final profit by reaching the line "120%".

The same external parameters - FiboOpen, FiboStop and FiboTarget - are used to set the required levels of Fibonacci lines.

Testing of the finalized strategy

Before performing full-fledged testing, optimization of the Expert Advisor was carried out to select the most optimal values of input parameters for each currency pair. A big, but bad, surprise was the optimization results on GBPUSD and USDJPY currency pairs. There were simply no results worthy of presentation there. Taking into account the fact that the original version of the Expert Advisor is not very convincing on other currency pairs, we can say that our oil of innovations did not spoil the common porridge.

The currency pair was the most successful USDCHF. For comparison, here are the results of testing the original version of the Expert Advisor (see Fig. 5)

Testing of the updated version was carried out on M15 timeframewhich was proposed by NutCracker. The full historical period including the recent history, 01.01.2003-03.04.2010, was used. Stochastic oscillator parameters were also left untouched: K = 20, D = 24 and S = 35. The levels used in the "Fibonacci lines" object are taken as follows: FiboOpen = 45, FiboStop = -11.8, FiboTarget = 120 (see Fig. 6).

The improvement in results is noticeable. When looking at the statistical figures, the difference becomes even more apparent. Net profit came to the level of 3124 dollars at the maximum drawdown 968 dollars, which results in a recovery factor of 3.22. All profit is achieved due to qualitative superiority of profitable trades over unprofitable ones. Thus, the average profitable deal is 97 dollars, and the average losing deal is 51 dollars. In quantitative ratio, there are fewer profitable trades - 41% vs. 59%, but their quality is enough to generate total profit at moderate drawdown.

Significant improvement in the results shown when testing on the currency pair EURUSD, did not occur (see Fig. 7).

The increase in the final profit from 1651 dollars (original version on the whole plot) to 3303 dollars was possible only due to the increase in the maximum drawdown from 1200 dollars to 2443. As we can see, both indicators have doubled, which practically did not affect the recovery factor. In the original version it was 1.38, and in the updated version it is 1.35.

It should be noted that the sharp trend of the second half of 2008 the strategy did not survive with honor and experienced a large drawdown. Therefore, we cannot speak about absolute success in changing the strategy.

Conclusion

As it turned out, the "Wednesday effect" is not an identified market regularity. It is wrong to say that on certain days of the week the price movement is similar to the previous days. The importance of Wednesday lies in the very approach to trading, when there is an opportunity to project the existing market behavior for the second half of the week without missing the "train".

Files for downloading:

Test.zip - detailed results of testing the Expert Advisors.
Wednesday v7.mq4 - The original version of the advisor.
Wednessday_Edit_Fibo.mq4 - updated version of the advisor.

Leave a Reply

Back to top button