How to learn to code a "system" to backtest

Discussion in 'Strategy Building' started by jrlvnv, Jan 6, 2011.

  1. jrlvnv

    jrlvnv

    I have found something looking at some charts in the forex that looks interesting to say the least. I know it can be coded but I have no idea on where to start. I have 2 brokers and have been testing the "system" out in live trading. I have scanned back in time and can the system failing at times but many many profitable trades.

    So how do I learn how to code using MT4? I have no background in programming :/ Can it be done? LOL
     
  2. Probably the easiest way is to bring up one the sample EA's , go through the code and hit F1 when on any commands you're interested in to see the help topic on it.

    Also stick message boxes in different sections of the code, so you get an idea of how the EA flows after each price tick.


    If you PM the details of your system I'll give you a hand if you like.
     
  3. PLease tell me the idea, I will trade it for a while and then I will help you when I come back from Hawaii. :)
     
  4. Dan_Gor

    Dan_Gor

    2 options for you my dear friend

    1) pay some one to do it for you, just look up Custom MQL programming
    2) go to the official site http://www.mql5.com/en/docs, or check out the online tutorials, it is not to hard but you have to really get the basics right
     
  5. I was in a similar position a while ago.

    The best place to start is learn how to program in any language of your choice (stick to the usual Python, C++, Java). This is not necessary, but will certainly help you develop coherent coding logic.

    Next, learn how to build EAs (I'm currently at this stage). Online tutorial are a great way to start, however I'd suggest getting these books:
    http://www.amazon.com/High-Probabil...=sr_1_1?s=books&ie=UTF8&qid=1300512324&sr=1-1

    ^Has a section on building basic trading systems without any prior programming experience.



    http://www.amazon.com/Expert-Advisor-Programming-Automated-MetaTrader/dp/0982645902

    ^This book is definitely up on my summer reading list.
     
  6. Murray Ruggiero

    Murray Ruggiero Sponsor

    If you want to combine ease of learning with flexibility
    and power then you should take a look at TradersStudio.

    Please look at the TradersStudio overview.

    http://tradersstudio.com/Overview.aspx
     
  7. Good1

    Good1

    One way to start is to write pseudo-code, in your own words, what you think needs to be done by the program. Then break it down into small manageable tasks. If you don't know how to program that task, just search the forums, especially the MQ4 forum, for code or a tutorial that accomplishes that task, or near enough you can adapt it. Read tutorials on how MetaTrader works and run some simple sample EA to get a feel for it. Open the code editor with a blank EA and see that there are three main functions to consider:
    1)Init
    2)start
    3)deInit
    Init runs once when the EA is loaded. DeInit runs once when the EA is unloaded. Start runs on every tick, depending on how much time it takes to run. Most of your focus will be on the Start function. If you code is simple enough, it can all be typed inside the Start function. As it get's more complex, you'll want to make custom functions, type them elsewhere, name them, and call them from the Start function, keeping everything very readable. Punctuate with comments now and then. Figure out, by taking the time to set up a kind of development environment/routine within MetaTrader, to get immediate feedback on the code you type. There are ways. One way is to learn to write output (ie. variable values) to basic text files for immediate feedback and debugging. Keep it fun by frequent successes...by keeping it simple. Build piece by piece. I would suggest skimming over the help files once quickly, then go back as needed. Skim over tutorials for anything that might apply to your project, and go back as needed, where they apply to your project. Scan the forum and make a folder for any code snippets you can find that might relate to your needs. Cut and paste before you try to come up with something original. This (learning curve) all depends if you are in this for the long haul, or just want to test this one little idea to gather stats on it and/or to automate it...or to get feedback sooner than later. I might be able to help you get feedback sooner than later if you be willing to discuss details with me.

    Good1
     
  8. Good1

    Good1

    Ha, somebody put together Visual Studio-like software to build EA's without hardly knowing any code. $150 or so.
     
  9. I can say this that TradersStudio has a easy programming wizard. You can wite different codes like systems, functions, tradeplans etc. using this wizard. It is easy to use for people who do not know programming.
     
  10. For those with zero programming experience. All I can advise is to start with a simple Excel spreadsheet to do some back testing analysis. Here is tutorial on how to do it simply: http://www.stock-trading.me/2010/11...esting-of-stocks-using-ms-excel-the-easy-way/

    Once you get a good foundation out of your system, you can then start learning programming languages used in back testing software. Even expensive trading software like eSignal allows you configure backtesting parameters without necessarily dealing with source code and doing some programming.

    It really depends on your experience.
     
    #10     Apr 28, 2011