OneStopTesting - Quality Testing Jobs, eBooks, Articles, FAQs, Training Institutes, Testing Software, Testing downloads, testing news, testing tools, learn testing, manual testing, automated testing, load runner, winrunner, test director, silk test, STLC

Forum| Contact Us| Testimonials| Sitemap| Employee Referrals| News| Articles| Feedback| Enquiry
Testing Resources
  • Testing Articles
  • Testing Books
  • Testing Certification
  • Testing FAQs
  • Testing Downloads
  • Testing Interview Questions
  • Career In Software Testing
  • Testing Jobs
  • Testing Job Consultants
  • Testing News
  • Testing Training Institutes
  • Introduction
  • Designing Test Cases
  • Developing Test Cases
  • Writing Test Cases
  • Test Case Templates
  • Purpose
  • What Is a Good Test Case?
  • Test Specifications
  • UML
  • Scenario Testing
  • Test Script
  • Test Summary Report
  • Test Data
  • Defect Tracking
    Software testing
  • Testing Forum
  • Introduction
  • Testing Start Process
  • Testing Stop Process
  • Testing Strategy
  • Risk Analysis
  • Software Listings
  • Test Metrics
  • Release Life Cycle
  • Interoperability Testing
  • Extreme Programming
  • Cyclomatic Complexity
  • Equivalence Partitioning
  • Error Guessing
  • Boundary Value Analysis
  • Traceability Matrix
    SDLC Models
  • Introduction
  • Waterfall Model
  • Iterative Model
  • V-Model
  • Spiral Model
  • Big Bang Model
  • RAD Model
  • Prototyping Model
    Software Testing Types
  • Static Testing
  • Dynamic Testing
  • Blackbox Testing
  • Whitebox Testing
  • Unit Testing
  • Requirements Testing
  • Regression Testing
  • Error Handling Testing
  • Manual support Testing
  • Intersystem Testing
  • Control Testing
  • Parallel Testing
  • Volume Testing
  • Stress Testing
  • Performance Testing
  • Agile Testing
  • Localization Testing
  • Globalization Testing
  • Internationalization Testing
    Test Plan
  • Introduction
  • Test Plan Development
  • Test Plan Template
  • Regional Differences
  • Criticism
  • Hardware Development
  • IEEE 829-1998
  • Testing Without a TestPlan
    Code Coverage
  • Introduction
  • Measures
  • Working
  • Statement Coverage
  • Branch Coverage
  • Path Coverage
  • Coverage criteria
  • Code coverage in practice
  • Tools
  • Features
    Quality Management
  • Introduction
  • Components
  • Capability Maturity Model
  • CMMI
  • Six Sigma
    Project Management
  • Introduction
  • PM Activities
  • Project Control Variables
  • PM Methodology
  • PM Phases
  • PM Templates
  • Agile PM
    Automated Testing Tools
  • Quick Test Professional
  • WinRunner
  • LoadRunner
  • Test Director
  • Silk Test
  • Test Partner
  • Rational Robot
    Performance Testing Tools
  • Apache JMeter
  • Rational Performance Tester
  • LoadRunner
  • NeoLoad
  • WAPT
  • WebLOAD
  • Loadster
  • OpenSTA
  • LoadUI
  • Appvance
  • Loadstorm
  • LoadImpact
  • QEngine
  • Httperf
  • CloudTest
  • Perl Testing
  • Python Testing
  • JUnit Testing
  • Unix Shell Scripting
    Automation Framework
  • Introduction
  • Keyword-driven Testing
  • Data-driven Testing
    Configuration Management
  • History
  • What is CM?
  • Meaning of CM
  • Graphically Representation
  • Traditional CM
  • CM Activities
  • Tools
  • What Is Software Testing?
  • Effective Defect Reports
  • Software Security
  • Tracking Defects
  • Bug Report
  • Web Testing
  • Exploratory Testing
  • Good Test Case
  • Write a Test
  • Code Coverage
  • WinRunner vs. QuickTest
  • Web Testing Tools
  • Automated Testing
  • Testing Estimation Process
  • Quality Assurance
  • The Interview Guide
  • Upgrade Path Testing
  • Priority and Severity of Bug
  • Three Questions About Bug
    Home » Testing Articles » Manual Testing Articles » Testing Visualization: Manual Trading

    Testing Visualization: Manual Trading

    A D V E R T I S E M E N T


    A function of testing visualization has now appeared in the MetaTrader 4 Client Terminal. The function allows controlling of Expert Advisors' testing. But not every strategy can be programmed, not every trader can code a good Expert Advisor.

    This article describes how to use visualizing function to test manual strategies that are not programmed in form of an Expert Advisor. Only basic knowledge of the terminal and no knowledge of programming are needed to trade on Manual Strategy Tester, so every trader will be able to use it.

    The article mentions programs that realize 'Trade' and 'Account History' tabs during visualization. The use of these programs is described in more details in articles named Testing Visualization: Functionality Enhancement and Testing Visualization: Trade History.

    If you have never worked with visualizer, you have to read the article named Testing of Expert Advisors in the MetaTrader 4 Client Terminal: An Outward Glance.

    Preparation for Use

    So you can use testing visualizer and would like to start testing your strategy immediately. What should be done for this?

    First of all, download all necessary files from CodeBase to your PC:

    • Expert Advisor vHandsTrade.mq4 to the directory of \MetaTrader 4 Work\experts\;
    • the included file VisualTestingTools.mq4to the directory of \MetaTrader 4 Work\experts\include\; and
    • 2 indicators - vTerminal.mq4 and vHistory.mq4 - to the directory of \MetaTrader 4 Work\experts\indicators\.

    Note that file VisualTestingTools.mq4 mentioned in the preceding articles has been changed, so it is the version from the above source (CodeBase) where you should download it from.

    After that, open Expert Advisor vHandsTrade.mq4 in MetaEditor and compile it (use F5). Message in the "Tools" window will confirm that the EA has been successfully compiled:

    Now, when the program is ready, we can start preparing the chart template. To do it, open a chart, set it up according to your taste, attach indicators vTerminal.mq4 and vHistory.mq4, and save the template as vHandsTrade.tpl:

    Please keep in mind that there must be enough space in the right part of the chart to work with Tester of Manual Strategies - the controls will be placed there. So the "Chart shift" option must be enabled when creating the template:

    Now we can go to the EA's setting as such.

    Setting of the Expert Advisor

    Every trader has his or her own trading habits. To make the use of Manual Strategy Tester most comfortable for yourself, spend about five minutes on adjusting the Expert Advisor to your preferences.

    In your trading, you will open and close positions, place pending orders, move Stop Loss and Take Profit levels of positions. You will be able to choose the lot size for positions to be opened, expiration time and date for pending orders and so on. Each of adjustable characteristics corresponds with a line on the control panel:

    and two lines in the Expert Advisor's code:

    Their function is intuitive:
    - RISK (Risk) -
    % of the deposit to be used for opening a position;
    - LOT (Lot) -
    lot size to be used for opening a position if RISK = 0;
    - STOPLOSS (SL) -
    StopLoss value for positions to be opened, if the StopLoss line does not move when opening;
    TakeProfit value for positions to be opened, if the TakeProfit line does not move when opening;
    size of the TrailingStop that will follow all the positions;
    - EXPIRATION (Exp) -
    pending order expiration time in hours.

    You can change values of any predefined characteristic directly in the code. For example, if you usually open positions with volumes of 1.0, 2.0, 5.0, 10.0 or 50.0 lots, replace the line indicating lot size for such a line:

         double LOT[] = { 1.0, 2.0, 5.0, 10.0, 50.0 };

    After you have compiled and restarted it, you will see the following:

    If you want 5.0 lots to be selected by default at startup, replace "int SELECTED_LOT = 1;" with:

    int SELECTED_LOT = 3;

    Now, the 3rd дще will be selected by default:

    Values of any other characteristics can be changed in the same way. The rule is common: in the array, in braces, there must be 5 numbers separated by commas, value of variables SELECTED_*** must range from 1 to 5.

    External Variables and Starting

    Now we can start our Manual Strategy Tester. Let us open the Tester window, select the vHandsTrade in the Expert Advisors list, select a currency pair and a timeframe, and enable modelling on "Every tick" for testing to be as real as possible:

    Before pressing the "Start" button, let us look at the Expert Advisor's properties window. In this way, we will complete adjusting the Expert using external variables:

    Actually, the Expert has only four external variables, it inherited other ones from the included file VisualTestingTools.mq4. All variables must be set up for normal and convenient working:
    - CommentsCount -
    maximal amount of messages to be displayed by the Expert;
    - SelectedColor -
    color of the selected value of Risk, Lot, SL, TP, etc.;
    - ModifyColor -
    color of the order modification icon to be used for manual modification;
    - TrailingColor -
    color of the order modification icon to be used for TrailingStop;
    - TerminalRows -
    maximal amount of the 'Terminal' tab lines to be displayed. If you set TerminalRows = 0, the terminal will not be updated;
    - HistoryRows -
    maximal amount of the 'Account History' tab lines to be displayed. If you set HistoryRows = 0, the account history will not be updated;
    - BigText -
    set true if you want to enlarge the font size;
    - SignalPoints -
    the distance in points, starting from which the Stop Loss, Take Profit and Open Price fields for pending orders will be highlighted. For example, for SignalPoints = 10, the Stop Loss field will change its color when the price is at the 10-point distance from the Stop Loss of the position;
    - ShowCancelled -
    set true if you want to see cancelled orders in the trade history;
    - ShowExpired -
    set true if you want to see expired pending orders in the trade history;
    - MainColor -
    color of headlines of "Terminal" and "Account History" and of the Terminal account information line (Balance, Equity, ...).
    - BuyColor -
    color of information about Buy positions;
    - BuyOPColor -
    color of the Open Price field in the Terminal tab; this color will replace the main color when the current price approaches to the open level of Buy Stop and Buy Limit;
    - BuySLColor -
    in the "Terminal" tab: color, which will replace the main color when the price approaches to the Stop Loss of Buy positions; for the "Account History" tab: color, which will replace the main color if the Buy position has been closed by Stop Loss;
    - BuyTPColor -
    the same as for BuySLColor, but applied to the Take Profit of positions;
    - SellOPColor, SellSLColor и SellTPColor -
    the same for Sell positions.

    It must be noted that the Expert Advisor was created to be used on a chart with black background, this is why many default colors are light. If you use white background, set dark colors. This is what I have done when testing the Expert for this article.


    Well, finally, we press the Start button. The first thing we see in the chart is the Toolbox mentioned before:

    It helps to open positions, place pending orders and choose values of predefined characteristics. We will study each of the actions listed before in the corresponding section. Now, I would only remark that all operations with the Toolbox are safer to be performed in the pause mode. Any action will be understood by the Expert as a command and cannot be cancelled. Since the Expert is intended for testing only, inaccuracy will not cause material losses for you, but you can ruin in this way the results obtained in your long-term and diligent testing.

    The "Terminal" anf "Account History" windows are below in the chart. they remain empty until we start trading:

    We can close and modify positions using the "Terminal" window, while the "Account History" window brings us information.

    Position Opening

    Let us try to open a position. First of all, it is necessary to define the lot size and the distances to StopLoss and to TakeProfit since we don't want to waste our time on modifications later.

    As it was said before, the values are set using the toolbox: We must select the object containing the desired value and move it to any point in the screen. Any amounts og objects can be moved simultaneously, i.e., if we want to set lot size for 1 and TakeProfit for 100, we have to drag the corresponding values to a random point:

    Now press F12 - the next tick incomes, and the Expert Advisor checks the selected values:

    When opening a position, the Expert will use the selected value of the characteristic:
    - the lot size is calculated according to the following formula:
    Free Margin * Risk * 0.01 * Leverage / Contract Size. If Risk=0, the selected Lot value is used;
    distance to the Stop Loss is defined by the corresponding line (to be described below). If the StopLoss line has not moved, the selected value of SL will be used;
    - distance to the Take Profit is defined by the corresponding line. If the TakeProfit line has not moved, the selected value of
    TP will be used;
    - expiration time (for pending orders only) - the selected value of
    Exp will be used.

    Positions are opened in a very simple way - it is sufficient just to drag the corresponding line to the chart. there are 3 lines for each order type:
    - Open Price line
    (solid for positions Buy and Sell, dashed for pending orders) is in the center, between Stop Loss and Take Profit lines;
    - Stop Loss line
    (dash-and dot) is located below the OpenPrice line for Buy positions and above it for Sell positions;
    - Take Profit line
    (dashed) - above for Buy positions, below for Sell positions.

    Pending orders placed above the current price (Buy Stop and Sell Limit) are in the upper row. Those to be placed below the price (Buy Limit and Sell Stop) - in the lower row.

    So if you want to open a Buy position with the selected values of Stop Loss and Take Profit (as for now, 50 and 100, respectively), just drag the Buy open line of the position to the chart:

    Then press F12 and admire the results:

    Since positions Buy and Sell are opened solely at current prices, there is no need to place the line exactly onto the price: the Expert will substitute proper values by itself. But it is very important to specify correct prices for pending orders, otherwise the order will not be placed.

    Let us now set the Sell Stop order:
    - lot size - 10% of the deposit;
    - Open Price and Stop Loss to be set manually;
    - Take Profit disabled;
    - expiry time 30 minutes (0.5 hour).

    Let's take all necessary objects and place them in the chart:

    Press F12 and see:

    Everything seems to be ok.

    Order Closing

    Closing of positions and deletion of pending orders are much simpler tasks. All what we have to do is just to select the ticket of the order to be closed and move it:

    The result will not keep us waiting: the Expert will have already closed the position by the next tick:

    Pending orders will be deleted in the same way.

    Position Modification

    Copntrolling order modification combines position closing and opening elements: To select a characteristic to be changed (Open Price, Stop Loss or Take Profit), it is necessary to move the corresponding field.

    After the next tick has income, the Expert Advisor will create the Modifying Line that will help in changing the value of the corresponding characteristic:

    After we have moved the line to its new position, we press F12 and see the result:

    If you want to absolutely delete Stop Loss or Take Profit, just delete the corresponding field:

    After deletion of the Open Price field, one can close the position (delete the order) - some traders may consider this method to be more convenient.

    There are no limitations on the amount of parameters to be modified simultaneously - you can even modify all open positions within one tick.


    After having read the article, you will see that it is not necessary to be a programmer in order to test your strategy on historical data. Using the manual testing mode, you can trade on historical data manually.

    The Expert Advisor, library and indicators given in the article allow simulation of the real trading terminal.

    At the end of my article, I would like to remind you that
    the Expert Advisor is not intended for real trading. Do not trust you money to a test program.

    To simplify controlling of orders in the real-time mode, the online complex AutoGraf was created. It is this complex that produced some ideas and code parts
    for this present article (by courtesy of the creator). Many thanks to the creator for this!

    More Manual Testing Articles

    discussionDiscussion Center


    Yahoo Groups
    Y! Group
    Sirfdosti Groups
    Contact Us

    Looking for Software Testing eBooks and Interview Questions? Join now and get it FREE!
    A D V E R T I S E M E N T

    Members Login

    Email ID:

    Forgot Password
    New User
    Testing Interview Questions
  • General Testing
  • Automation Testing
  • Manual Testing
  • Software Development Life Cycle
  • Software Testing Life Cycle
  • Testing Models
  • Automated Testing Tools
  • Silk Test
  • Win Runner
    Testing Highlights

  • Software Testing Ebooks
  • Testing Jobs
  • Testing Frequently Asked Questions
  • Testing News
  • Testing Interview Questions
  • Testing Jobs
  • Testing Companies
  • Testing Job Consultants
  • ISTQB Certification Questions
    Interview Questions

  • WinRunner
  • LoadRunner
  • SilkTest
  • TestDirector
  • General Testing Questions

  • Testing Forum
  • Downloads
  • E-Books
  • Testing Jobs
  • Testing Interview Questions
  • Testing Tools Questions
  • Testing Jobs
  • A-Z Knowledge
    Study ABROAD ?

    Study Abroad

    Vyom Network : Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Programming & Source Codes | Free eBooks | Job Interview Questions | Free Tutorials | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Bangalore Info | GATE Preparation | MBA Preparation | Free SAP Training
    Privacy Policy | Terms and Conditions
    Sitemap | Sitemap (XML)
    Job Interview Questions | Placement Papers | SMS Jokes | C++ Interview Questions | C Interview Questions | Web Hosting
    German | French | Portugese | Italian