Designing an Automated Trading Program

Discussion in 'Journals' started by expiated, Dec 16, 2018.

  1. expiated

    expiated

    I have added a specific moving average for letting me know when I should let my profits run. All my proprietary indicators have now been converted to standard moving averages (i.e., close approximations). Something I found interesting was that they did not necessarily generate what one might expect when switching from one timeframe to another. For example, given an indicator equivalent to SMA (11) on a five-minute chart, one would expect it to be replaced by SMA (55) on a one-minute chart. But as it turns out, this was not necessarily the case.

    None of the tools I am using is anything I haven’t used in the past, but the significance (or function) of each is simply that much clearer. For example, the short-term trend of a given asset might be headed north, but if the overall consensus of the other indicators is that the instrument is ultimately headed south, then I know I can feel relatively comfortable being rather aggressive about entering a short position as soon as the short-term moving average reverses direction (at an established level of statistical resistance) without having to worry about head fakes, and without having to wait for confirmation—thus maximizing profits along with the probability of executing successful trades.
     
    #41     Dec 21, 2018
  2. expiated

    expiated

    There were a lot more than seven trade opportunities this morning, but I devoted most of my attention to converting what I was doing and the reasons I was doing it into written text, and then I left early to hopefully get to the shopping malls before the lines of customers buying Christmas gifts got too long.

    ScreenHunter_2865 Dec. 21 16.35.jpg

    The system is already working, so it would be terrific to see it work even better as I become more expert at executing it. So now I will begin researching how expert advisors (EAs) are actually used by retail traders to determine whether what I am doing might actually be codable into instructions for MetaTrader 4 to implement, and if so, what will be the best course of action for me to take to get this done without putting my intellectual property in jeopardy.
     
    #42     Dec 21, 2018
  3. expiated

    expiated

    I spent literally years in search of a way to measure momentum that was compatible with both my skill level and my psychological makeup, unable to find anything I could sink my teeth into.

    However, this morning, while in the process of completing my initial attempt to convert my day trading strategy into written text that might later be coded into MetaQuotes Language (MQL4), I finally discovered what I had been searching for all that time.

    It is a comparison of the slopes of two painstakingly selected simple moving averages:
    ScreenHunter_2870 Dec. 21 22.40.jpg
    When the difference is extreme, I know the momentum is unsustainable and I wait and watch for a reversal.

    When the slopes of both moving averages remain relatively equidistant from one another within a carefully defined set of parameters, I know I am looking at a trending asset for which momentum is of significant strength.
     
    #43     Dec 22, 2018
  4. qlai

    qlai

    Can you please elaborate on this if you don't mind?
     
    #44     Dec 22, 2018
  5. expiated

    expiated

    It was clear that my initial attempt to convert my day trading strategy into written text that might later be coded into MetaQuotes Language (MQL4) would have been unable to handle every possible scenario. I therefore took another crack at it this morning and I believe what I came up with just might do the trick.

    That being the case, I turned my attention to evaluating some of the expert advisors (EAs) offered online that one can supposedly download at no cost to help me prepare for writing a description of what I need that I can submit when searching for a programmer to write the code for me.

    ScreenHunter_2871 Dec. 22 12.11.jpg

    In the process, I discovered step-by-step instructions for coding an EA that I’m planning to tackle as soon as I have the time (which will be sometime after Christmas at the earliest). At the very least, this should help educate me in terms of how to best communicate with potential programmers for hire—though the best case scenario would be for this to be my first step in eventually reaching the point where I can automate the system for myself.

    (Another possible benefit of this whole process is that it is likely to up my game by refining the manual trading I do in the meantime.)
     
    #45     Dec 22, 2018
  6. expiated

    expiated

    I began exploring the step-by-step directions/instructions for creating an expert advisor this morning. However, it was written for MetaTrader 5, whereas I am using MetaTrader 4, so it looks like I am finally going to be forced to switch to the newer platform.

    In completing the initial steps, MetaTrader 4 pulled up this window…

    ScreenHunter_2871 Dec. 23 09.35.jpg

    …which was nonexistent in the MetaTrader 5 instructions, leaving it unclear as to what I should do, or not do, with it.

    Moreover, I received a notice of where to go to find out how to create trading robots without having to write any code, but this too was designed for MetaTrader 5.

    I looked at the video, but the information in it went by too fast, so I’m going to type it out here in text form so I can review it at my own pace/leisure…


    CREATE TRADING ROBOTS WITHOUT WRITING A SINGLE LINE OF CODE:

    Even if you are not a programmer, you still may develop your own trading robots and technical indicators in MetaTrader trading platforms. By using MQL5 Wizard, you can assemble a robot without writing a single code string.

    The trading platform contains an editor of trading strategies called MetaEditor, which allows creating trading robots without programming. With the built-in MQL5 Wizard, you simply select the components and assemble the new expert advisor.

    Over 50 expert advisers have been created in the MQL5 Wizard, and their detailed descriptions and screenshots are all available in the code base. All of these trading robots are composed of three main units, which include: (1) the generation of buy an dell signals, (2) trailing of open positions, and (3) money management.

    The default MQL5 Wizard standard package of modules contains:
    1. Twenty (20) units of trading signals
    2. Three (3) position trading modules, and
    3. Five (5) lot management modules.
    By simply combining these units, you can generate 300 expert advisors. However, the actual number of possible combinations is almost unlimited. Here is why…

    Start the MQL5 Wizard and select the generate expert advisor option. (The only required field that need be completed here is the name of the expert advisor. The other fields are optional.)

    The first unit is responsible for the generation of trading signals, so choose the required signals. For example, you might want a trading signal that is based on a stochastic indicator. (Click on the question mark or F1 to read its description.) The MQL5 Wizard allows creating complex strategies, so let’s add signals based on the envelope indicator.

    Additionally, we turn on the intraday filter, which will help find favorable and unfavorable trading hours during optimization. Furthermore, individual weights can be set for each type of signal, to define their contribution to the resulting trading signal. The closer the weight of a module to zero, the weaker its influence on the final trading decision made by the expert advisor.

    As you can see, we have used a unit with three modules of trading signals in one robot. It means any number of combinations can be created using the standard 20 modules for the generation of trading signals.

    The second unit is the protection of open positions. Type of trading should be chosen in this step. For example, take a popular trading method based on the parabolic indicator.

    Next, one of the modules for lot size calculation should be selected for the third unit of money management. For example, this expert advisor will trade with the risk level of three percent (3%) of the deposit.

    That’s all! We have developed a trading robot which is ready for compilation now!

    We can then test and optimize the input parameters of the resulting expert advisor and run it on a demo account for online testing. A complex trading system consisting of various complexes has been created without programming.

    But that’s not all!

    The MQL5 Wizard allows using custom modules. You can develop such modules or order them from professionals. This will provide even more opportunities for creating expert advisors. Now you know how to create a trading robot without writing a single line of code.
     
    #46     Dec 23, 2018
  7. expiated

    expiated

    Last edited: Dec 23, 2018
    #47     Dec 23, 2018
  8. expiated

    expiated

    The above concept has just led to another "revelation" with the potential to serve as the basis for an extremely simple, yet highly profitable day trading strategy that would be an absolute cinch to automate—so much so (in fact) that if it actually works this week, I will be tempted to set aside everything else I was planning and trade this new strategy exclusively.
     
    #48     Dec 23, 2018
  9. expiated

    expiated

    So Expert Advisors (EAs) do not graph the indicators they use to execute trades? What a bummer! This makes me a little less gung-ho about learning how to code EAs as quickly as possible.

     
    #49     Dec 25, 2018
  10. userque

    userque

    Unless I'm missing something:

    I code, but I do not code MT stuff. But I know enough about coding to believe you must be mistaking. (I haven't watched the video you posted.)

    I've read about EA's being coded to perform machine learning. So, I would bet big money that an EA can be coded to plot the indicators it uses to trade (or, it can be done 'outside' of the EA--but still accomplished). This is so fundamental to a trading system building platform, imo.

    So after a quick search, I found evidence of this simple capability from way back in 2012:

    Display indicator plots in EA
    https://www.mql5.com/en/forum/5790

    "
    Ian Harris 2012.01.02 04:14
    All,

    I have two indicators that draw on the chart and display a plot in a separate window. I have an EA that uses the indicators, but when I add the EA to a chart it does not display the plots. It draws the varius lines and arrows on the chart, but no plot. Do I need to specify anything special in the EA to ensure the indicators are plotted when the EA is attached to a charts?

    This is the indicator when attached to a chart.

    This is the chart when the EA is attached.

    Thanks, Ian
    --------------------------------------
    --------------------------------------
    Andriy Moraru
    2012.01.02
    04:44
    #1
    You have to attach the indicators separately if you want to see their plot. EA doesn't attach an indicator to a chart, it just uses its data.
    ..."

    Good luck.
     
    #50     Dec 25, 2018