Part 3 Meta Trader 4 Show – How To Use A Strategy

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Best Choice!
    Free Trading Education!
    Free Demo Account!
    Big Sign-Up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!!!

Part 3: Meta Trader 4 Show – How To Use A Strategy

Today we will talk about embedding indicators and temples into Meta Trader 4 and how to use them. For each strategy you can find on our website, there will be an archive available for download. In the archive, you will find necessary indicators and templates. But how to insert and use them in MT4? From the beginning, i was baffled and that is why I want to show you step by step how to do it.

  • Download the archive with files from our website. Here you can find a list of strategies. After clicking on various strategies you can download an archive with the template and indicators.
  • Extract the archive. There are 2 folders inside – Templates and Indicators
  • In Meta Trader 4 click on the left of the menu File > Open folder data
  • It will open the folder, called something like this 50CA3DFB520CC1A8F28Bj44D1BF2A5702
  • Open the folder Templates and copy/paste the entire content of the folder Templates, that we have downloaded in it.
  • Go back and this time open the folder MQL4 > Indicators, here you copy/paste the entire content of the folder Indicators, that we have downloaded.
  • Quit and open again the program MT4
  • Open a new chart, for example EUR/USD
  • Click anywhere in the empty space of the chart > Template > And select the one you have just downloaded.
  • Trade as directed by the instructions written by the to the strategy. ��

Author

More about the author Step

I’ve wanted to build a business of some kind and earn money since I was in middle school. I wasn’t very successful though until my senior year in highschool, when I finally started to think about doing online business. Nowadays I profitably trade binary options full-time and thus gladly share my experiences with you. More posts by this author

MT4 EA Course: our first forex expert advisor

This article is part of a series. Here are the other parts:

Welcome to the second part of our MetaTrader4 Expert Advisor course! Missed the first part? Go read the MT4 EA course Intro now, I’ll wait!

Looking for a video course instead?

In this part, we’re going to learn how to use the MetaEditor – the Integrated Development Environment or IDE for MetaTrader4 – to develop those exceptional expert advisors! I’ll show you around the editor and we’re even going to create our first expert advisor. Let’s call that EA the Forex Wall-E.

Get it? Robots, automated programs. Ah, moooving on!

After this article, you will feel comfortable with the MetaEditor and know how to create a new expert advisor. That’s almost halfway to raking in those pips with our automated strategy!

These are your first steps into a new world – with a huge potential pay-off.

Let’s do this.

“Invest in yourself. Your career is the engine of your wealth.”

Preface

Before we begin, please make sure that from now on, everything you run is on a demo account! I wouldn’t want to see you wipe out your account because you made a coding error. We will use demo accounts and testing strategies to make sure everything is well tested, there’s no need for a live account.

You should also be somewhat familiar with MetaTrader. If not, MetaTrader 4 is the trading software we’re going to use. If you haven’t yet set this up, find yourself a broker (the people at FxPro are solid, but any regulated big-name broker should be fine) and install according to the instructions by your broker.

The MetaTrader Strategy Tester

The toolbar in this screenshot should be a familiar sight to you. These are the default controls that more or less every MetaTrader application should have. If you don’t see them, have a look at View – Toolbars to enable the right toolbars.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Best Choice!
    Free Trading Education!
    Free Demo Account!
    Big Sign-Up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!!!

Click on the Strategy Tester button (left circle) and you should see the following at the bottom of the window:

This is where we are going to run our expert advisors! You’ll be able to configure which currency pair and timeframe you want to test it on and a couple of other settings we’ll get back to later on. This is also where you will be able to backtest your strategies. You can think of this as the control center of your future expert advisors!

The MetaEditor

But first of all, let’s go back to the toolbar and click the MetaQuotes Language Editor (right circle). This should open the editor I was talking about earlier on. A new window will open, which should look similar to this:

This is where the magic happens. This is like Disneyland for us EA developers. Unless you don’t like Disneyland I guess. Next up: some wizardry!

The MQL Wizard

Here, you’ll be able to create new Expert Advisors, write the code that makes them tick, compile and debug your strategy. Let’s start with creating a new Expert Advisor, shall we?

After clicking the “New” button in the upper left corner, this window should appear:

You can already see that you can do much more with MQL4 than just create Expert Advisors! You can also create your own indicators, create a script (which is just another name for a piece of code that runs just once in the client terminal) and create libraries (which are sets of functionality that can be used by multiple expert advisors).

Whoa, not too much in one go! Make sure “Expert Advisor (template)” is selected and click next.

Give the expert advisor a catchy name, such as ForexWall-E. Leave all other settings as they are and click Next.

A note on Events

The next 2 screens in the wizard will show you some options related to events. Events are moments in the execution of the expert advisor where we will be able to “hook into” the expert advisor by running some custom code. Let’s quickly go over the different types of events that are available to us:

  • OnTimer: event that is executed when a timer is used. We can set the frequency in seconds ourselves. This is useful if you want to run or check something every X seconds.
  • OnChartEvent: handles a collection of events related to chart actions (click of mouse, chart changes, objects that get created, when something is dragged on the chart). Useful if you want to intercept user actions while the EA is running.
  • OnTester: this event gets called only when testing the EA, just before the test is done. This is where you could request testing data from the EA, such as profit, the balance, the number of trades your EA has made, etc.

For now, don’t worry too much about these events. Leave everything on its default settings and click next and finish.

Ta-da! You have just created your first expert advisor. Well done, give yourself a quick pat on the back!

Good. Let’s continue on our adventure!

Running an Expert Advisor

What you have just created is is a fully functioning Expert Advisor. Don’t believe me? You can test it out, by clicking the big “Compile” button (compiling means that the MetaEditor will transform our human-readable code into machine instructions suited to actually running as an EA). On the bottom part of the MetaEditor, you should see something like this:

Now go back to MetaTrader 4. You should still have the Strategy Tester on the bottom of the window. In the first dropdown, you should now be able to find your new EA:

When you use the same Strategy Tester settings (the From and To date are not too important yet), you can click Start to test your newly created strategy. Give it a moment to calculate, and you should be presented with a green bar on the bottom, indicating your EA finished running.

Notice the new tabs that have appeared at the bottom:

Have a browse through them. For now, Results and Graph will be empty (since no trades have been made yet), but the Report and Journal tabs will show information about the expert advisor test run and some logging information, respectively:

Pretty nice huh? The report tab is where you’ll spend much time analysing the trades your expert advisor took. But of course, this expert advisor isn’t actually doing much. Let’s change that now.

Our first EA – ForexWall-E

Things might get a bit technical now, we’re going to use actual code. But I promise, it will be easy to digest, we’ll probably breeze through it.

First of all, let’s open our MetaEditor again and edit the void OnTick() method so it looks like this:

After you’ve updated the code, hit the “Compile” button to make sure there are no errors. It should build without issues (difficulties with this? Let me know in the comments, I can help you out!).

The code may seem a bit complex, so let’s go over it line by line. But first: what are ticks?

About forex ticks

A tick in the context of forex means the smallest increase or decrease in price that a currency pair can make. Therefore, every time you see the price move up or down in the smallest way, that is a tick. It is also when the OnTick event gets called.

Code walkthrough

This is our function declaration. We indicate the availability of this function, so it can be called.

This if-statement makes sure that if there already is an open order, we don’t open another one. OrdersTotal() is a built-in function in the MQL4 language and returns the number of orders that are currently open.

Here, we define some variables:

  • The lot size will be 0.01
  • The stop loss is 500 points, which equates to 50 pips on a broker that uses 5 digits, since in that case 1 pip = 1/10th of a point. If this confuses you right now, don’t worry and just assume we use a stop loss of 50 pips.
  • The take profit will also be 50 pips (for the same reason as above).

This line means that we fetch the value of the 300 exponential moving average (or EMA). We will use this moving average value to determine if we should enter a trade or not. Now, a lot of parameters are used with this EMA! This is what they mean:

This is the first time we’re using the value of an indicator! There are loads more built-in indicator in MQL4, such as iStochastic and iRSI. In upcoming parts of this series, we’ll cover those and lots more.

What happens here, is that we will only enter a trade if the Ask price + 50 pips is still lower than the EMA value. In other words: if the price is more than 50 pips below the 300 EMA line, we should buy.

Finally, we get to make the actual order! The OrderSend() function is another built-in function that allows us to programmatically create an order. In this case, we create a buy order for 0.01 lots, with the stop loss and take profit we defined earlier.

That’s it!

Click the Compile button once again and then go back to MetaTrader. Start the expert advisor test in the Strategy Tester.

Now, the Results, Graph and Report tabs are not so boring anymore:

And as you can see, it even seems our first expert advisor even made a modest profit (largely by luck, no doubt. your results may be different depending on the currency pair, chosen timeframe and broker).

But it’s an encouraging result nonetheless! Everyone loves a graph going up, right?

Conclusion

Whoop, part two of our MT4 expert advisor course packed a lot of information!

You’ve learned how to use the Strategy Tester.

You’ve familiarised yourself with the MetaEditor and created a new expert advisor.

You’ve built your first EA and simultaneously taken the first steps with MQL4.

That’s it for this time. I encourage you to play with your newly created expert advisor, change some of the parameters we’ve defined and see how they influence the outcome of running your EA in the strategy tester.

Next time, we will continue with our expert advisor and step by step improve it and make it more solid. If you have questions, please let me know in the comments.

Subscribe to my newsletter below if you want to be kept up to date on when the next part of this course is published!

MT4 Basics: How to Set Orders

Now that you’ve set up your MT4 account, it’s time to learn how to use it!

We know, we know. With so many tabs, windows, and buttons, the MT4 platform can look a little bit intimidating if it’s your first time using it.

But don’t worry, it won’t bite! Besides, we’ll be holding your hand through the entire process and go nice and slow.

By the time you’re done with this lesson, you’ll know how to:

  1. Buy or sell via market execution
  2. Buy or sell via pending order
  3. Modify a trade after it has been entered

Are you ready? Great! Let’s begin!

Entering a Trade via Market Execution

Click the New Order button. You’ll find it in the standard toolbar.

  • A dialogue box should appear. From the drop-down list, select the currency pair you want to trade.
  • Next, select Market Execution in the Order Type drop-down list.
  • Enter the size of the position you want to open. Keep in mind that volume, which indicates the size of your position, is expressed in terms of standard lot sizes. Remember, one standard lot is worth 100,000 units. Hence, if you wish to buy 5,000 units of a certain currency pair, you would enter “0.05” in the volume field.
  • If you have any remarks or notes you would like to include about your trade, you can do so in the comment field. This is optional.
  • Finally, determine whether to BUY or SELL the currency pair. A dialogue box will appear to confirm that your trade has been executed.

These options have only been disabled to help you get in on a trade as fast as possible when price is already moving.

You can still specify your exit levels by modifying the trade AFTER it has been entered. We’ll teach you all about editing existing orders later on.

Entering a Trade via Pending Order

1. Click the New Order button.

2. From the drop-down list, select the currency pair you want to trade.

3. Next, select Pending Order in the Order Type dropdown list.

4. Determine whether you want to BUY or SELL the pair in the Order Type dropdown list.

You will be presented with 4 options:

Buy Limit – if you plan on going long at a level lower than market price

Sell Limit – if you plan on going short at a level higher than market price

Buy Stop – if you plan on going long at a level higher than market price

Sell Stop – if you plan on going short at a level lower than market price

6. Then, enter the size of the position you want to open in the volume field.

7. Fill in the stop loss and take profit fields.

8. You’ll notice that by using a Pending Order, you also have the option to set an expiry date on your order.

9. Once you’ve filled everything out, click the Place button to enter your trade. A dialogue box will appear to confirm that your trade has been executed.

Modifying Trades

Click on the Trade tab. There, you will find all of your trades, including their entry prices, position sizes, stop losses, and profit targets.

To add/modify stop loss or profit target:

  • Right-click on the trade that you want to modify and select the “Modify or Delete Order” option.
  • Next, fill in the Stop Loss and Take Profit fields with your desired levels. When you’re done, hit the Modify button.
  • A dialogue box should appear to confirm that your trade adjustments have been executed.

To close an open trade:

  • Right-click the trade you wish to close and click the “Close Order” option.
  • If you want to close your entire position, select the yellow button below the Buy and Sell options.
  • After hitting close, your profit balance should change and reflect the profit or loss you made on your recently closed trade.
Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Best Choice!
    Free Trading Education!
    Free Demo Account!
    Big Sign-Up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!!!

Like this post? Please share to your friends:
Binary Options Trading Guide
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: