Thursday, February 01, 2007

1. Motivation

Starting from build 196, MetaTrader 4 Client Terminal offers testing visualization function. It allows controlling the Expert Advisors' testing on a brand new level. Now, the trading programmer can watch every action of his or her Expert Advisor checking its operation on history!

You can read about how to use the visualizer in Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance. In my previous article named Testing Visualization: Functionality Enhancement, it was described how to realize the "Trade" tab for testing. We will add the "Account History" tab to it here.

2. The Task and How to Realize It

First of all, we will have to reconcile ourselves to that we cannot create a shadow copy of the "Account History". To create it, we would have to write a complicate program using dlls. But we do not need this at all since the "Test Results" tab of the Tester contains almost the full information about operations made.

Our task is to display actual information. This can be very convenient when analyzing the Expert Advisor's work. There will be no need to switch between tabs all the time.

Since there is not very much space in the display and realization of scrolling is not a very simple task, we will only display the most recent events.

What is left, is to remind that, to create a subwindow where the history will be displayed, it is necessary to create an indicator and, having attached it to the chart, create the template named tester.tpl or in the template <expert_name>.tpl (you can download the indicator directly from this article).

Saving a Template for Testing

Now we can start to prepare the Expert Advisor.

This is not very difficult either:
- save the VisualTestingTools.mq4 file in the directory named ...\MetaTrader 4\experts\include\;
- add the #include <VisualTestingTools.mq4> line to the Expert - now the file content is included into the Expert's code; and
- insert in the Expert's init() and start() functions the calls for functions responsible for trade history updating .

3. Testing

Now, let us try to test the new Expert. For this, open the Strategy Tester window, select the CrossMACD_DeLuxe_VisualHistory in the Expert's menu and press its properties button.

Strategy Tester Window
The Expert has got some new external variables - they are declared in an included file named VisualTestingTools.mq4. Some of them are intended for controlling the "Terminal" tab, the other ones - for the "Account History" tab, but most of them are common:
- TerminalRows - the maximum amount of the "Terminal" tab lines to be displayed. If you make TerminalRows = 0, the terminal will not be updated;
- HistoryRows - the maximum amount of the "Account History" lines to be displayed. If you make HistoryRows = 0, the account history will not be updated;
- BigText - set true if you want to make the fonts larger;
- SignalPoints - the distance, in points, starting from which the Stop Loss, Stop Profit and Open Price fields of pending orders will be highlighted. For example, if SignalPoints = 10, the Stop Loss field will change its color when the price is at a 10-point distance from the Stop Loss of the position;
- ShowCancelled - set true if you want to see the cancelled orders in your trade history;
- ShowExpired - set true if you want to see expired pending orders in your trade history;
- MainColor - color of headlines of the Terminal and Account History, as well as the Terminal's trade account information bar (Balance, Equity, ...).
- BuyColor - color of information about Buy positions;
- BuyOPColor - color of the Open Price field of the Terminal tab; this color will replace the main color when the current price approaches to the open level of orders Buy Stop and Buy Limit;
- BuySLColor - for the Terminal tab: color, which will replace the main color when the price approaches the Stop Loss levels of Buy positions; for the Account History tab: color, which will replace the main color if the Buy position has been closed by StopLoss;
- BuyTPColor - the same as BuySLColor applied to the Take Profit of positions;
- SellOPColor, SellSLColor and SellTPColor - the same for Sell positions.

Trading Tactics on Forex

Trading Tactics on Forex

Trading Tactics on Forex


Trading Tactics


After having analyzed the market, a trader needs to know whether he or she will speculate for a rise or for a fall. Besides, the trader has to decide what part of his or her capital to invest into a trade. And, finally, the last step is buying or selling of a contract. This is the most difficult stage of trading at margin markets where the precision of entering and leaving the market is very important. The final decision about  how and when to enter the market must be based on the combination of technical factors, equity management and order type. 

The precising the market entering/quitting time based on technical analyses is specific for very short-term nature of such analyses. It is determined by days, hours, and even minutes, but not by weeks or months. In all cases, the same technical tools are used. The most common principles of these analyses are given below.

  1. Tactics at Price Breaks.

    There are three variations of the trader's action at price breaks:

    • to take a position in advance, forecasting the break;

    • to open a position when the break is in progress;

    • to wait for the inevitable rollback after break.

    There are pros and contras about each of the above approaches, sometimes a combined approach is used. When working with several lots, a trader can open one position at each of the three stages. One can open a small position before the forecasted break, then buy some more immediately after the break, and finally open additional positions at an insignificant price fall during correction that follows the break. If one trades with small positions, two questions will have impact on one's decisions first of all:

     

    • what amount of money can one risk on this trade?

    • how agressive will one act?

    The most conservative trader will in this situation open a long position at the rollback. However, paradoxical as it is the wait-and-see tactics can also be risky meaning one can miss the opportunity to enter the market while waiting for a rollback.

  2. Trendline Cross

    This alert allows to enter the market or to leave it early enough, especially if a significant, many times "approved" trendline has been crossed. Of course, other technical factors should not be left out.

    If a trendline is used as a support/resistance level, long positions will be opened when prices fall to the level of a stable up-trend line, short positions will be opened when prices rise to the down-trend level.

  3. Support/Resistance Levels

    A break of the support level can be a signal to open a long position, which can later be protected using a stop order. The latter can be placed below the nearest support level or, to be more protective, just below the break level, which now will perform a supporting function.

    Prices rising to the resistance level at a down-trend and falling to the support level at an up-trend can be used to open new positions and to add lots to profitable positions already opened. When choosing protective stop levels, it is important to take support/resistance levels into consideration.

  4. Price Correction

    For an up-trend, the intermediate price falls that make percentages of the previous growth by Fibonacci can be used to open new or additional long positions. It must be noted that, in this case, analysis of percentages of correction length relates to very short market movements.

    A proper moment to open a long position would be a 38-% price rollback that takes place after a Bull break at an up-trend. It would be rather reasonable to open short positions when, at a down-trend, prices jump up covering 38 to 62% of the preceding fall length.

  5. Gaps

    Price gaps that are formed on bar charts can also be sued to choose a proper moment to open or close positions. For example, gaps formed during price growth often become support levels. That is why, at an up-trend, it is reasonable to open long positions when prices fall to the upper border of the gap or a bit below it. A stop order can be placed below the gap. At a down-trend, an open position should be opened when prices reach the lower border of the gap or a bit above it. The protective stop order is placed above the gap, in this case.

  6. Averaging

    Averaging is a trading strategy used when one has made a mistake or just made a trade (the first coming to one's mind) and the price has moved against, and one makes a new operation of the same type but at a more profitable price. The most important disadvantage of averaging is that one cannot know to what price the market will go against the trader. The averaging demands to invest a double amount of money compared to that invested before. If one has much money on the account, he or she can stand the price movement of 100, 200 and even more pips. Such movements are not very frequent on the market, though. This strategy is not the best one, especially if you have made a mistake by trend direction sensing.  

Practicable Strategies


The first strategy consists in the long keeping positions opened for the period from several days to several months. This strategy is used by strategic investors and semiprofessional traders. It is most effective on arising trends and it is least effective on sideways and slow trends. This strategy needs additional protection and the corresponding work on the terminal options market. When working with long positions, it is also important to make both technical and fundamental analyses. The share of long positions in the trader's practical work should not exceed 15% of the equity. Analyses made for opening long positions will help you in a shorter game, too. Namely, they will help to define long-term support/resistance levels:

Another strategy consists in working on middle-termed trends, up to a few days long. It is also desirable to secure with options, which are most attractive for amateur traders. The middle-sized positions are more stable for gaining profits, though such a play needs more complicated analyses. The trading quality also depends on the ability to play a short-term game (to choose the right time for opening/closing a position). To open a middle-sized position, on has to both make a technical analysis and be attentive about news: Are any fundamental news income before the position is closed? Are any regional markets closed at that time? Psychological factors will pale into insignificance. For all its external stability, the market must be closely watched as it can spring all possible surprises at the very wrong time. If you play a middle-term game based on fundamental factors, you should also make sure that the technical analysis does not contradict your positions.

The third strategy consists in opening a position for a short time, from a few minutes to a few hours. This strategy is used by professionals. Pros: there is no risk of unfavorable fundamental news and price changes during the time when you are away. Contras: large expenditures (commissions, spread, internet providing, etc.), high probability of unfavorable price movements, the necessity of steady monitoring, concentration and exertion during the working day. The main help can be provided by occilators (you should follow the rules of open time choosing). You should not rejoice at small profits obtained using this strategy. You are in danger to lose all profits gained for a long time and on many trades.


Recommended Practices of Forex Trading Tactics


A trading technique consists of five stages:

  1. trend detection;
  2. detection of the rollback start point;
  3. detection of the rollback end point;
  4. getting confirmation from another indicator or system;
  5. entering the market with placing stop order and TP.

http://articles.mql4.com/236


Trading Strategies

Trading Strategies

All categories classifying trading strategies are fully arbitrary. The classification below is to emphasize the basic differences between possible approaches to trading.

  1. Following the trend

    The following-the-trend strategy lies in waiting for a certain price movement followed by opening a position in the same direction. Doing so, one supposes that the trend will keep moving in the same direction. When following the trend, one never sells near maximum or buy near minimum since a significant price movement is needed to signal that the trend has started. So, using systems of this type, the trader will always skip the first phase of the price movement and can miss significant part of profit before the signal to close position comes. The main issue concerns choice of sensitivity of the trend-following strategy. A sensitive system that quickly responds to signs of trend change work more efficiently during strong trends, but generate much more false signals. A non-sensitive system will have a reverse set of characteristics.

    Many traders try again and again to earn money on every movement of the market. This results in choosing of faster and faster systems following the trend. Although on some markets quick systems are usually more efficient than slow ones, on the most markets it is quite opposite since minimizing of losing trades and commissions in slower systems more than pays the reduced profits at good trades. This is why it is recommended to limit the natural effort to search for more sensitive systems. In all cases, the choice between quick and slow systems should be based on experiences and individual intentions of the trader. There is a great variety of trend-following strategies available.

    Below are the main strategies of the kind:

    • Strategies based on moving average

      When an up-trend is replaced with the down-trend, prices must intersect the moving average top-down. Similarly, when the down-trend is replaced with the up-trend, prices must intersect the moving average bottom-up. In the most moving-average systems, these cross points are considered as trade signals.

    • Break-through strategy

      The basic conception underlying the break-through strategy is rather simple: the market ability to reach a new maximum or minimum shows potential trend in the breakthrough direction.


  2. Against-the-trend strategies

    Against-the-trend strategies are based on waiting for a significant price movement followed by opening a position in the opposite direction, assuming that the market will start correction. Systems working against the trend are often attractive for many traders since they are aimed at buying at minimum and selling at maximum. Unfortunately, the solving complexity of this task is inversely proportional to attraction of such systems. The most important difference to be remembered is that the trend-following systems are self-correcting and against-the-trend systems implicate possibility of unlimited losses. Thus, it is necessary to include protecting stops in any against-the-trend system. Otherwise, the system may keep a long position during the entire large-scaled down-trend or a short position during the entire large-scaled up-trend.

    The prime advantage of against-the-trend systems consists in that they give a great diversification opportunity when simultaneously used together with trend-following systems. Related to this, it must be noted that an against-the-trend system can be desirable if even it loses money moderately. The reason for this is that, if an against-the-trend system is oppositely correlated with a trend-following system, trading with both systems bears fewer risks than trading with only one of them. Thus, it is highly possible that combination of these two systems can earn more at the same risk level if even the against-the-trend system itself loses money.

  3. Model recognition of price behavior

    All systems can, in some sense, be classified as systems of model recognition. Finally, conditions that give a signal to open position in or against the trend direction are a kind of price models, too. Neverthless, this means that the chosen models are not primarily based on price movements in certain directions as it is in case of trend-following or against-the-trend systems.

    Systems of this type can sometimes use probable models when making trade decisions. In this case, researchers will try to identify models that, according to their behavior, were supposed to precede price increases or decreases. Such behavior models are considered to be used for assessment of the current probabilities of the market growth or fall.

    Model RecognitionIt must be noted that the above strategies are not always clearly separated from each other. Being modified, the systems can be classified as of another type.

  4. Trading in channel

    Trading in channel represents trading up and down from resistance/support levels, lines of which are the channel borders. Such tactics are good for sideways trends (flats), but are not practically applicable in up-trends or down-trends. Trading in channel is shown in a chart below:

    Positions should be opened under the following rules:

    • Determine support/resistance levels. A correct computation will help to have clear borders of the channel, in which the market moves.

    • As soon as the price reaches a border of the channel and jumps back in the opposite direction, a buy position should be opened. Short positions should be opened if prices reach the resistance level.

    • As soon as the price reaches the opposite border, the position should be closed. It must be noted that reversal can happen before the price line reaches the channel borders, so positions can be closed before the price reaches levels of support or resistance.

    The advantage of such tactics is possible maximization of profit through opening and closing of positions several times if the sideways trend continues. The main disadvantage thereof is that the break thourgh the channel lines can result in significant and undjustified losses. To avoid the latter ones, it is necessary to set Stop Loss correctly that losing positions are closed if the market moves in an opposite direction compared to the planned one.

http://articles.mql4.com/207


Technical Analysis with MQL4 and MetaTrader4

Technical Analysis with MQL4 and MetaTrader4

Introduction

Technical analysis is research of market dynamics that is done mainly with the help of charts and with the purpose of forecasting future price development. Technical analysis comprises several approaches to the study of price movement which are interconnected in the framework of one harmonious theory. This type of analysis studies the price movement on the market by means of analyzing three market factors: price, volumes, and, in case of study of futures contracts’ market, of an open interest (number of open positions). Of these three factors the primary one for technical analysis is the prices, while the alterations in other factors are studies mainly in order to confirm the correctness of the identified price trend. This technical theory, just like any theory, has its core postulates.

Technical analysts base their research on the following three axioms:

 

http://ta.mql4.com/


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

Climatology degree