Simulation Setup for MT4 Expert Advisor

Posted: Jun 20, 2010 |Comments: 0 | Views: 277 |

Simulation Setup

These are a few issue that I discovered when simulating with MT4 using History data. As the quality and accuracy of the history depends very much related to your trading strategy indicator and stoploss & profit taking.

a) Simulating M1 period result seems to yield the most accurate results from your EA. If you are using period H1 or any other period indicator or measurement of time, please replace 0 with PERIOD_H1 or any other time frame. Don't use in the strategy tester period H1, as the results will not be accurate if you plan to compare with real result. Therefore, use period M1 in your strategy tester. And modify your EA to run on in.

b) Downloading M1 result and using period_converter for 5, 15, 30, 60, 240, 1440 minutes will be getting more accurate results rather then just download and import M1 result from the internet. This will synchronize all other time frame with M1 as the base. The most realistic result you can get is from M1 timeframe, thus all other timeframe is actually using this M1 base. You can download from any internet website that provide time frame M1 from 2001 till date.

c) In order to use the strategy tester in MT4 platform, you need to declare

static datetime nextRund

and use

if( nextRund > TimeCurrent() ) return(0);

nextRund = TimeCurrent() + 30;

The above will step thru your Period M1 and your Use date from yyyy.mm.dd to yyyy.mm.dd As the program automatically increment 30 seconds into nextRund (just a name datetime variable) and cause the if statement to exit the program via return(0). Which will exit the program or looping function (also eventually exit the program), and cause the strategy tester to step the TimeCurrent() to next period M1. During the tester, the TimeCurrent() will be simulated from start to end. As the program will exit, so all your variables that need to be valid (stay in memory when your program exist and execute again), please indicate static infront. This will enable that variable to be able to be use again (retain previous value) by the program.

You may need some times to understand the above, but read thru and try it out on the EA and you will learn how to use the above to your advantage.

d) Delay is not applicable to the strategy but you can use it freely on your EA while running live account. But using it in your EA to delay your looping or program while waiting for new live currency price is useful if you plan to run multiple currency using multiple strategy. Play around with different delay and you will notice the utilization of your CPU averaging over time instead of peaking at one point.

Please go try and use the above to improve your EA.

Questions and Answers

Ask
200 Characters left
Rate this Article
  • 1
  • 2
  • 3
  • 4
  • 5
  • 0 vote(s)
    Feedback
    Print
    Re-Publish
    Source:  http://www.articlesbase.com/currency-trading-articles/simulation-setup-for-mt4-expert-advisor-2690896.html

    Article Tags:

    forex

    ,

    sng

    Gbenga Kayode

    There is, arguably, no other way the current Administration in Nigeria could prove to many anxious Nigerians and members of the international world, that it really means business in tackling the endemic corruption seriously retarding the progress of the country than implementing the recommendations in the Fuel Subsidy Report. The document recently, was submitted to the House Leadership at plenary of the House of Representatives, Lower Chamber of Nigeria's National Assembly (NASS), in Abuja.

    By: Gbenga Kayodel News and Societyl May 07, 2012
    Sngerge

    There is always difference with your demo results and your live trading results due to the different Demo/Live server and different broker. The way to make your result convincing is to close the gap as follow..

    By: Sngergel Finance> Currency Tradingl Apr 03, 2009 lViews: 177
    Sngerge

    After some times running live account with coded expert advisor, i notice some problem faced. When restart of MT4, use modifyorder if encounter #129, #130 error and cancel trades if direction go opposite/timeout.

    By: Sngergel Finance> Currency Tradingl Feb 11, 2009 lViews: 738
    Sngerge

    Simulation result can be a good proof that your trading strategy works but there are many factors that are not able to be simulated and have to be taken in to account when dealing with live trading.

    By: Sngergel Finance> Currency Tradingl Jan 24, 2009 lViews: 316
    Sngerge

    A look at some of the factor in determine which platform software to choose to automate your trading strategy

    By: Sngergel Finance> Currency Tradingl Jan 07, 2009

    The fully automated service sends an email confirmation in receipt of the amount and then processes the order. Among the reputed agencies to order foreign currency from is Pawnbroker.

    By: vinkenthomasl Finance> Currency Tradingl May 29, 2012

    Created by David Lambert, the CCI was first used as an indicator for determining reversal points in the Commodities Markets. It was then discovered to be very useful in the share and forex markets. It is based on the theory that all activities move under the influence of cycles. The Maxima (+100) and the Minima (-100) occurring at regular intervals. The CCI measures the speed of price fluxuations as determined by oscillators.

    By: John Hauserl Finance> Currency Tradingl May 25, 2012

    Credit card services are important to help your business increase sales. Consumers today are more comfortable than ever to pay in means other than cash. Plus, many customers don't keep a high volume of cash on hand. Credit cards allow people to pay back expenses over time.

    By: Davidl Finance> Currency Tradingl May 25, 2012

    A merchant cash advance is a cash payment to a business in exchange for an agreed upon percentage of future credit and/or debit card sales. This relatively new industry provides business owners quick access to capital coupled with benefits not see with traditional loans.

    By: Davidl Finance> Currency Tradingl May 25, 2012
    Sngerge

    Leverage is the greatest asset for Forex over stocks and shares. For stocks, you are buying single shares with single share price. For forex you are getting 100 times more with leverage 100:1

    By: Sngergel Finance> Currency Tradingl May 24, 2012
    Sngerge

    Leverage is the greatest asset for Forex over stocks and shares. For stocks, you are buying single shares with single share price. For forex you are getting 100 times more with leverage 100:1

    By: Sngergel Finance> Currency Tradingl May 24, 2012
    Sngerge

    Mission Impossible by Tom Cruise lay out very difficult task but things always goes wrong and he will always recalculate his risk and proceed on till the end to achieve mission success. This is similar to Forex Trading.

    By: Sngergel Finance> Currency Tradingl May 24, 2012
    Sngerge

    Forex is the most widely traded financial market around the world. Top bankers, exporters, government, investment firms and venture capital deals with foreign exchange or Forex at any point of time.

    By: Sngergel Finance> Currency Tradingl May 24, 2012
    Sngerge

    I would like you to know about the different automated trading strategies in Forex and which is the best automated trading system.

    By: Sngergel Finance> Currency Tradingl May 24, 2012
    Sngerge

    Carry Trade is using one currency to purchase another currency to earn money from the difference between the interest rate of the two currencies. You can gain upto 4.5% annually if the currency exchange rate remain the stand for the two currencies.

    By: Sngergel Finance> Currency Tradingl May 16, 2012

    Discuss this Article

    Author Box
    Articles Categories
    All Categories
    Quantcast