Hi folks,
Today we will talk about How to Control MetaTrader Chart.
Note: Chart is the graphical representation of time (Vertical) and Price (Horizontal) of a currency, where the history data can be loaded and drawn on and as well the new quotations.
Changing the chart type:
There are three charts type you can choose to work with one of them in MetaTrader:
Bar Chart:Candlestick:
View the chart as a sequence of Japanese candlesticks (Figure 2).
You can access the same option by clicking the Candlestick button in MetaTrader toolbar, going to Charts menu and choose Candlesticks or by hitting ALT+2 hotkey.
Figure 2 - Candlesticks
Line Chart:
View the chart as a broken line, connecting bars' closing prices (Figure 3).
You can access the same option by clicking the Line Chart button in MetaTrader toolbar, going to Charts menu and choose Line Chart or by hitting ALT+3 hotkey.
Changing the period:
One of numerous features of MetaTrader is the support of various timeframes (data periods). This variety of timeframes enables you to carry out analysis by using technical indicators and line studies.
There are nine timeframes available in MetaTrader: M1, M15, M30, H1, H4, D1, W1, and MN
M stands for minute.
H stands for hour.
D1 means 1 day.
MN means 1 month.
You can choose the timeframe you want to work with by clicking the timeframe button in the Periodicity toolbar (Figure 4), choosing Periodicity menu from Charts menu then choose the timeframe (Figure 5) or right click the chart to open the context menu and choose the Periodicity menu then choose the timeframe (Figure 6).
Scaling:
You can increase and decrease the number of the Chart Bars displayed in the window to the scale you want.
To do that you can click the Zoom In/Zoom buttons on the toolbar (Figure 7), hitting + and - keyboard keys, choosing Zoom In/Zoom from the Chart menu or you can choose Zoom In/Zoom Out from the context menu.
Note: The maximum and minimum values of the scales limit can be changed from the Chart Properties Window (Common tab) from the Scale Fix, Fixed maximum and Fixed minimum options (Figure 8).
Scrolling the chart:
You can scroll the chart (left to right and right to left) to view the necessary data on the screen. Scrolling the chart can be done with your left and right arrow keys of the keyboard, by pointing the mouse with left click and drag the chart to left and right or you can go directly to the position one the chart you want by using the quick navigation line.
Note: If you have a scroll wheel in your mouse you can use it to scroll the chart left and right. Scrolling the wheel down scrolls the chart Right and up scrolls the chart Left.
Quick navigation line:
Quick navigation line used to fast access to some of the chart tasks. With the aid of this line window you can do the following:
In our article we are concerned about scrolling the chart to exact place, to do that you have to open the Quick navigation window by placing the mouse on the left corner of the horizontal scale banner of the chart (Figure 9) and double clicking there or simply by hitting ENTER key.
Figure 9 - Quick navigation line
A small window like the one you see in figure 9 will appear where you can type there one of these commands and click ENTER to shift the chart to a specified position:
[exact time (hours:minutes)]
Example: 08:30
[exact date]
Example: 2005.10.19
[exact time and date]
Example: 2005.10.19 08:30
We will know more about the Quick navigation window in another article.
Hi folks,
Today we are going to continue our talking about MetaTrader Trading issue. In the previous article we talked about Trade Positions. And today we will take about Orders.
An order is a command you give to your broker through the terminal to carry a trading action.
MetaTrader terminal enables you take one of these Orders types:
Market Order;
Pending Order;
Stop Loss;
Take Profit;
And Trailing Stop.
Let's study each of these orders type.
Symbol list: Clicking this list drops down a list with all the currencies pair which you can use from it the currency you want to open the New Order for.
Volume list: this list drops down a list with predefined volumes you can choose from them the volume of the New Order.
Note: Volume here means the Lots value.
Stop Loss combo: A combo box with up and down arrows enables you to set the Stop Loss level for the New Order. Use the up and down arrows or write the value of the Stop Loss in the text box. It’s optionally to set a Stop Loss level.
Take Profit combo: A combo box with up and down arrows enables you to set the Take Profit level for the New Order. Use the up and down arrows or write the value of the Take Profit in the text box. It’s optionally to set Take Profit level.
Comment field: Type here the comment text you want to assign to the New Order (Figure 2). It’s optionally to set the Comment field for the New Order.
Type list: You can choose from this list one of these two options:
Instant Execution;
Pending Order.
We will talk about Pending Orders later in this article. So you have to choose Instant Execution because you want to make a Market Order.
Sell button: Click this button if you want to open a Sell order. Clicking the Sell button will close the New Order window and send the instructions to the broker.
Buy button: Click this button if you want to open a Buy order. Clicking the Buy button will close the New Order window and send the instructions to the broker.
Enable maximum deviation from quoted price option: Enable this option if your server uses price deviation. Enabling this option will activate the list of Pips you can select from it the value of the maximum deviation.
Maximum deviation list: Select the maximum deviation pips value.
If you have set the Stop Loss and Take Profit levels and pressed the Sell or Buy button and these two levels were too close to the current price you will get the message “Invalid Price” (Figure 3). In this case you have to click OK button and set a new Stop Loss and Take Profit levels.
There are four kinds of Pending Orders:
Buy Limit: You are telling to the broker that he have to buy if the future "ASK" price is equal to the price level you have set to the Pending Order. The price level you have set is below the current price.
Buy Stop: You are telling to the broker that he have to buy if the future "ASK" price is equal to the price level you have set to the Pending Order. The price level you have set is higher than the current price.
Sell Limit: You are telling to the broker that he have to buy if the future " BID" price is equal to the price level you have set to the Pending Order. The price level you have set is higher than the current price.
Sell Stop: You are telling to the broker that he have to buy if the future " BID" price is equal to the price level you have set to the Pending Order. The price level you have set is below the current price.
You place the pending order by opening the New Order window and choose Pending Order from the type list (Figure 5).
Type list: Choose from this list the Pending Order type: Buy Limit, Buy Stop, Sell Limit or Sell Stop.
at price combo: A combo box with up and down arrows enables you to set the Price level for the Pending Order you want the broker to open the order at.
Expiry option & calendar: Check the option and choose from the calendar the time you want your Pending Order to expire at. If the price level of the Pending Order didn’t reach yet and the expiry time has been reached, the Order will be deleted.
Place button: Click this button to place the order. Clicking the Place button will close the New Order window and send the instructions to the broker.
Hi folks,
With you in this journey Coders Guru, I’m trying to simplify the world of MetaTrader, The world of one of the best trading platforms.
Today we are going to study how to open, close and modify trading positions.
Opening and Closing a trade position:
In the first time you decide to open a trade position (short or long), you command the broker though the MetaTrader terminal to execute the order for first time. The broker opens executes the command instantly if it’s an instant order or it wait for the conditions you specified if it’s a pending order.
The opening of a position can be occurred manually from the MetaTrader New Order command or can be occurred automatically from your Expert Advisor.
Closing a position is a same, you command the broker though the MetaTrader terminal to close an opened position instantly.
The closing of a position can be occurred manually from the MetaTrader Close Order command or can be occurred automatically from your Expert Advisor in two cases:
By the execution of the Stop Loss order.
By the execution of the Take Profit order.
Closing a trade position by a reverse order:
You can close a position(s) by executing a reverse order. For example there’s a short opened order and you open a reverse long order which order will close the short position and open the long one. The calculation of the deference between the opened and closed positions will be calculated depending on the size of the both positions.
Instant Execution Technology:
MetaTrader terminal has various execution technologies: Instant Execution, Request Execution and Market Execution. We are concerned in this article about the Instant Execution Technology.
Instant Execution Technology (IE) is the an immediately action be taken by pressing the buttons Sell and Buy in the New Order window (Figure 1). By prssing these buttons execute instantly the order at the appeared quotation.
Figure 1 - New order window
Sometimes and during the pressing of Sell and Buy buttons and because of the fast movement of the price a new quotation has been arrived. In this case the “Requote” window (Figure 2) will appear that enables you to execue your position with the new quotation. The “Requote” window will appear also in the case of closing a position and a new quotation has been arrived.
Figure 2 - Requote window
Modifying a trade position:
The modification of already opened order means changing the Stop Loss and Take Profit levels of the order. This can be done manually from by clicking Modify Or Delete Order and then from the Order window (Figure 3) you change the Stop Loss and Take Profit levels, or automatically from the Expert advisor.
Figure 3 - Modify order
We will discuss in details the Stop Loss and Take Profit (and Trailing Stop) limits in the coming article but you have to know at least the concept of them:
Stop loss:
It’s a limit point you set to your order when reached the order will be closed, this is
useful to minimize your lose when the market going against you.
Stop losses points are always set below the current asking price on a buy or above the
current bid price on a sell.
Trailing Stop:
It’s a kind of stop loss order that is set at a percentage level below (for a long position) or
above (for a short position) the market price. The price is adjusted as the price fluctuates (The price is adjusted by an Expert advisor running).
Take profit:
It’s similar to stop lose in that it’s a limit point you set to your order when reached the
order will be closed
There are, however, two differences:
_ There is no “trailing” point.
_ The exit point must be set above the current market price, instead of below.
I hope you enjoyed the article.
Coders Guru
Hi folks,
You have loaded your favorite indicators on the chart, set the favorite colors for the background and the bars, you have drawn your study lines and you've loaded your best expert advisor.
Tomorrow you don't want to repeat all these steps again and spend your valuable time arranging the chart from scratch for every work day.
Is there a solution to save the chart layout and apply it when you want? Yes! The solution is the Templates.
Note: Templates in MetaTrader terminal is something very different of templates in MQL4. I've started with this note because you will find another article in the development section with the same name and maybe you think we are talking about the same thing.
<chart> symbol=GBPUSD period=30 leftpos=37 digits=4 scale=8 graph=1 fore=1 grid=1 volume=0 scroll=1 shift=1 ohlc=1 askline=0 days=1 descriptions=0 shift_size=20 fixed_pos=0 window_left=307 window_top=0 window_right=614 window_bottom=159 window_type=1 background_color=0 foreground_color=16777215 barup_color=65280 bardown_color=65280 bullcandle_color=0 bearcandle_color=16777215 chartline_color=65280 volumes_color=3329330 grid_color=10061943 askline_color=255 stops_color=255 <window> height=151 <indicator> name=main </indicator> <indicator> name=Moving Average period=21 shift=0 method=0 apply=0 color=65535 style=0 weight=1 period_flags=0 show_data=1 </indicator> </window> <window> height=50 <indicator> name=Average Directional Movement Index period=14 apply=0 color=11119017 style=0 weight=1 color2=64636 style2=0 weight2=1 color3=255 style3=0 weight3=1 period_flags=0 show_data=1 </indicator> </window></chart>
Note: We can not explain in details the elements of the template files, and I think they are self- explicit.
Note: these tags are belonging to the <window>..</ window > tags:
<indicators>..</indicators>, <expert>..</ expert > and <object>..</object>.
Note: the "DEFAULT.TPL" template cannot be removed.
Note: You can access all the commands of loading, saving and removing the templates files from the toolbar from the Templates icon (Figure 6).
Hi folks,
We have talked in a pervious article about the templates in MetaTrader and we have know the importance of using template for saving our setting of the chart and attached expert advisor and indicators
Today we are going to talk about using profiles which enables you to save a group of working charts and their settings.
We can say that Profiles are group of templates.
What are the profiles anyway?
The profile is a set of templates and charts setting stored together in the MetaTrader 4\profiles path. These charts and setting can be uploaded to the terminal at any time.
Saving settings to a profile:
Every profile is saved in a unique folder in the profiles path. The name of the folder is the name of the profile itself; for example: default profile is stored in default folder and Euro profile is stored in Euro folder etc.
If you are interested in the charts set loaded in you terminal and their setting it's recommended to save those charts as a profile for your later loading and use.
To save a profile you have to go to File menu and select the Profiles sub-menu then press Save As command (Figure 1).
Figure 1 - Profiles sub-menu
A little window (Figure 2) will be appear enabling you to enter the profile name or choose existing profile to replace it with the new settings.
Figure 2 - Profile name
Note: You can access all the commands of the Profiles menu from the Profile button on the Standard toolbar (Figure 3).
Figure 3
Let's take a practical example:
1- Load these three charts on an empty terminal window: EURUSD,M15 and EURUSD,H1 and EURUSD, Daily.
2- Load in the Daily chart the Moving Average indicator, in the H1 chart the MACD indicator and in the M15 chart the MACD Sample expert advisor. (Figure 4).
Figure 4
3- Now go to File menu and choose Profiles sub-menu then click Save As command.
4- Type Test as the name of the profile and click Ok button.
Now you have created the new Test profile with the three charts and their settings which you can load it at any time you want.
Note: After clicking Ok button a lot of things have been happened by the MetaTrader. The first thing MetaTrader has been done is creating a new folder called Test in the profiles path. Then he generated four files as the following:
1- chart01.chr <- this file is very like any template file (.tpl) and it contains the settings of the first chart.
2- chart02.chr <- the settings of the second chart.
3- chart03.chr <- the settings of the third chart.
4- order.wnd <- this file holding the order positions of each chart, which is the first chart, the second and third chart.
Loading a profile:
To load a profile you go to File menu and choose the Profiles sub-menu then click the name of the profile.
That will close the currently loaded profile and load the profile you have been chosen. The loaded profile will appear very like the last time you saved the profile with the same charts and their settings. If there are attached indicators and expert advisors they will be loaded as well with their settings and inputs.
Note: The loaded profile name will be appearing in the status bar (Figure 5) and its name will be checked in the Profiles sub-menu.
Figure 5
Navigation between saved profiles:
You can navigate (loading) between your saved profiles by going to Profiles sub-menu and choose Next and Previous commands.
You can also use F5 hotkey for Next navigation and SHIFT+F5 for Previous navigation.
Clicking Next will load the next profile of the current loaded profile and clicking Previous will load the previous profile of the currently loaded profile.
Removing a profile:
You can remove one of the already saved profiles by going to Profiles sub-menu and choose Remove sub-menu (Figure 6), you will find there all the saved profiles except two profiles:
Default profile: which you can remove it at all.
Current profile (test in our case): which you can't remove it because it's the currently loaded. To remove this profile you have to load another profile then delete it as described above.
When you step into the playground it's the game time where there's no place to test, to mistake or to learn.
When you go live trading you can't undo your steps back by clicking CTRL+Z and saying:
"I'm awfully sorry, I'll not do it again". No mercy.
That's why the most of traders spend months and even years testing thier strategies before going to the show.
How to test your strategy?
You've bought the strategy your best friends has told you it'll make you one of the 100 richest forex players by the next summer. Or maybe you have downloaded one of heavily discussed strategies from a forex forum,
Or maybe you have red my lessons carefully and successfully wrote your strategy (I hope).
Anyhow, it's the suitable time to test your strategies before going live trading.
There are two ways to test your strategy; forward testing and back testing:
Forward testing:
Forward means you test your strategy on the future market prices not the history data. In this method you test your strategy in a demo account day by day for a sufficient period before you decide is it a successful or not a successful strategy.
It’s more accurate method than the back testing but it may take months and even years from you to get assured results and it requires a comfortable seat in front of your computer all the day.
Back testing:
Back means you test your strategy on the history market data not the future ones. In the method you run the MetaTrader a built-in feature called Strategy Tester which enables you to test your strategy against the already saved history data.
It’s a less accurate method but it takes minutes from you to determine was it a good or bad strategy.
Back testing debates:
The back testing accuracy issue has been heavily debated between the MetaTrader fans. Those fans have been divided to advocated and opponent groups:
The opponent group are assuring that the MST (MetaTrader Srategy Tester) is not trustworthy and even a useless.
The second group deny these indictments and saying may be that was true for the previous versions of MetaTrader but the strategy tester of the current version is more accurate and trustworthy.
I’m personally partial to a third group saying that there’s nothing is 100% accurate but there’s a possibility of better accuracy if we set all the required conditions.
We will know how to get the maximum of MST accuracy.
Exploring the MetaTrader Strategy Tester:
We are going to study the MST with the MACD Sample expert advisor which shipped with MetaTrader. We are not concerned about is it a good strategy or bad but we have chosen it because you and me have it in our machines.
To run the MST go to View menu and choose Strategy Tester, that will bring the MST window (Figure 1). (You can click CTRL+R or F6 hot keys to bring the MST).

Figure 1 - MetaTrader Strategy Tester
In the first window (figure 1) you have got when you opened the MST you find the simple yet most important options:
Expert advisor:
Here you choose the expert advisor you want to test, in our lesson we have chosen
MACD Sample.
Symbol:
Choose the currency symbol you want to test your strategy on.
Period:
Choose the timeframe you want to test your strategy in.
Model:
Determine the method that MST will use for price bars modeling which you want to test your strategy.
There are three modeling methods you can choose from:
Every tick (on the basis of all available least timeframes with fractal interpolation of every tick)
In this method the bars generated on the basis of all the smallest available timeframe data not only the data of the nearest timeframe (Control points method) nor the last open price.
If there are duplicated data for the same time span the MST will filter these data based on the volume of them.
Control points (the nearest timeframe with fractal interpolation are used)
In this method MST uses the last 12 bars of the current timeframe and the method of fractal generation. At that, the price development within one bar will resemble the dynamics of the last ten bars. If there are data of a less timeframe, 5 bars of a less timeframes are used for fractal generation.
Open prices only (the fastest method on the bars completed)
In this method the open prices of the current timeframe are used.
Recalculate:
MST can use the data already cashed (from a pervious testing) in the .fxt files.
If you enable this option the tester will delete the existing cashed data and create new one based on available data and chosen modeling method.
Optimization:
When you enable this option you can use the MST optimization features, we will discuss these features later in this article.
Expert properties:
Clicking this button will open the Expert properties window: Where you can set the testing deposit and testing positions (short and long) (Figure 2).
And where you can use it to change the properties of the expert advisor you are testing (Figure 3).
And set the optimization settings (Figure 4).
Figure 2 - Expert advisor properties
Figure 4 - Optimization settings
Symbol properties:
Clicking this button will open the currency symbol properties window (Figure 5).
Figure 5 - Symbol properties
Open chart:
Clicking this button will create and open a new chart based on the symbol you used in testing and the indicators you used in your expert advisor.The arrows of opening and closing and other objects used in your expert advisor will be drawn on the chart as well (Figure 6).
Figure 6 - MST chart window
Modify Expert:
Click this button if you want to see or edit the source code of the expert advisor. The expert advisor will be opened in MetaEditor.
Start:
Clicking this button will strart the testing.
We have too much to say about the MetaTrader Strategy Tester (MST) in the next series of articles.
I hope you enjoyed the article
I welcome very much your questions and suggestions.
Coders’ Guru
We have explored the MetaTrader Strategy Tester (MST) window in the previous article (Figure 1). We know now every option in that window and we have reached the Start button. You are a click away testing your strategy but I have to tell something about the accuracy before starting our testing.

Accuracy:
As I told you before in the previous article that there’s nothing is 100% accurate but there’s a possibility of better accuracy if we set all the required conditions.
Today we will know how to get the maximum of MST accuracy by the setting some of its conditions.
These are the required steps you must take to get the maximum of MST:
MetaTrader Settings:
The first step you have to take to get the accurate result you desire is changing the Max number of bars in the history in MetaTrader seyyings.
Go to MetaTrader Tools menu and choose Options (or click CTRL+O hotkeys). In the Options windows choose Charts tab and in the field of Max bars in history inter a very large number like "9999999999999" Figure 2. MetaTrader will reset this huge number to the maximum value the program can accept. This might eat some of your hard disk space but it's very important condition for accurate testing.
Figure 2 - Max bars in history.Complete history data:
Complete history data:
The data you getting from the broker server while you are running your demo account is filled with gaps and missing a lot of real data. You can't relay on this data in your strategy testing. So you have to download a complete history data and import it to MetaTrader to have the opportunity to get more accurate results.
You need to have a complete data for all the timeframes available in MetaTrader (1 minute, 5 minutes, 15 minutes, 30 minutes, etc). But if you can get a complete 1 minute data it will be easy to use the Period_Converter script shipped with MetaTrader (we will explain how to use it) to convert the 1 minute data to all the other timeframes data.
The free and complete (from 16/06/2004 up-to-date) 1 minute data can be downloaded from Alpari Databank by following this link:
http://www.alpari-idc.com/en/dc/databank.php
Download the MetaTrader 4 Format 1 minute data and extract the file to clean folder. The extracted file will have this name "M1_EURUSD.hst" which means "1 minute EURUSD history data".
You have to import the 1 minute data to MetaTrader database by going to Tools menu and choose History Center (or click F2 hotkey). Then choose the EURUSD 1 minute period in the left menu (Figure 3).
Click Import button and a window like Figure 4 will be pop up asking you to browse for the ".hst" file contains the data. Click Browse button and the open file dialog window will pop up again (a lot of pops be patient) like Figure 5. Choose from the drop down list of Files of type the option of "MetaQuotes files (*.hst) then browser for the "M1_EURUSD.hst" file you have extracted and click Open.
That will return you to the Import window again filled with the contents of .hst file. Click Ok button to return to the History Center window.
Figure 3 - History Center
Figure 4 - Import
Figure 5 - Browse
Close the History Center and you will be a lucky person with a complete 1 minute history data right now.
It's the time to convert the 1 minute data to the other timeframes, but why are we doing that, isn't the 1 minute data enough?
One of the most important conditions to get accurate results of the MST is using EVERY TICK MODEL which uses for the price generation not only the data of nearest smaller timeframe (like Control Points Model) but also all of the smaller timeframes available. And this is the only way we can fill the gaps and the holes in the history data we test our strategy with.
Converting 1 minute data to the other timeframes:
1- You have to open the 1 minute data on offline chart by going to MetaTrader File menu and choose Open Offline and choose EURUSD,M1 (Figure 6) then click Open. This will open the 1 minute data in new chart.
Figure 6 - Open offline chart
2- Double click the Period_Converter script and that will pop up the Inputs window, change the value of ExtPeriodMultiplier from 3 to 5 minutes (Figure 7).
Figure 7 - Period
This is the period of timeframe you want to convert the 1 minute data to. Click OK to close the Input window and start the conversion. You will notice that in the Expert tab the progress of the conversion (Figure 8).
Figure 8 - Conversion in progress
3- You have to repeat step 2 with changing the ExtPeriodMultiplier for every timeframe. So you will change it to 15, 30, 60,240, and 1440.
Figure 9 - Ignore this message
In the coming part of this article we will start our testing and you will the maximum of MST after the long path of settings we have walked.
Coders' Guru
Hi folks,
Today we are going to study the sub-menus and the commands on the MetaTrader Main menu.
The main menu is located under the title of MetaTrader main window (Figure 1) and contains all the commands available in MetaTrader.
Main menu is a set of sub-menus which we will study them all in this article.
In this menu (Figure 2) you will find the commands enabling you to open the chart, managing profiles, saving the charts, managing your accounts and printing the charts. This is the available commands in this menu:

Figure 2 - File menu
Use this command to open a new chart for a specified symbol. When you click this command another window with the list of all the available symbols will appear (Figure 3) to choose from it the symbol you want to open its chart. You can access the same command from the "New Chart" button at the Standard toolbar (Figure 4).
Figure 3 - Symbols list
Figure 4 - New Chart button
Use this command to open offline charts. Offline charts mean loading the history data of the chart that already stored and prevent the chart from receiving new quotes. You can work with offline charts to test you expert advisors.
When you click this command a window with the list of already saved history data will appear (Figure 5) to choose from the symbol: period you want to open.
Figure 5 - Open offline chart window
If you have enabled the option "Save deleted charts to reopen" in the terminal Options (Figure 6) you can use this command to load the already saved deleted charts templates. The deleted charts templates are saved in /DELETED folder as templates format (.tpl).

Figure 6 - Options window - Chart tab
Clicking this command will open a sub-menu (Figure 7) enabling you to manage profiles. From this sub-menu you save , load and remove the profiles. You can access the same command from the "Profiles" button at the Standard toolbar (Figure 8).
Figure 7- Profiles sub-menu
Figure 8 - Profiles button
Clicking this command closes the current active chart. You can use the hotkeys CTRL+F4 to perform the same action.
Use this command to save the history data of the current active chart. you can save this data in one of these formats:
CSV (Comma Separated Values) format.
PRN (Printer) format.
HTM (Hyper Text Mark-up) format.
You can use the hotkeys CTRL+S to perform the same action.
Use this command to save the current active chart as "BMP" or "GIF" images format. When you click this command another window will appear (Figure 9) to choose one of three options:
Active workspace: Choose this option to save a picture of all the terminal (print screen).
Active chart (as is): Choose this option to save the current chart as it appear in front of you in the same size.
Active chart: Choose this option to save the current chart with the size you want. Not only the part of the chart you see will be saved but the part which fit the size you entered (Use a big width number to save more data back in the history).
Figure 9 - Save as picture options
You can access the same command from the context menu of the active chart (when you right click the active chart) (Figure 10).
Figure 10 - Context menu
Use this command to open new demo account. When you click this command the Open An Account window will appear (Figure 11) which will take you step be step to open your new demo account.
Figure 11 - Open An Account window
You can access the same command from the Navigator window - Accounts list context menu (Figure 12) or press Insert button after selecting the Account list in the Navigator window.
Figure 12 - Navigator window - Accounts list context menu
Use this command to log in your account. When you click this command the Login Window will appear (Figure 13) which asks you for the account number, password and the broker server. In this window you can check the option "Save account information" to save the data you have entered. You can access the same command from the Navigator window - Accounts list by double clicking the account name you want to log to.
Figure 13 - Login Window
Note: If you want to auto login to your account, you have to enable the option "Keep personal settings and data at startup" in the Options window - Server tab (Figure 14).
Figure 14- Options window - Server tab
Use this command to change the settings of the printing. When you click this command the famous Print setup dialogue will appear (Figure 15) which enabling you to change the settings of the printing.
Figure 15 - Print setup dialogue
Use this command to preview the chart you want to print before printing it (Figure 16). The setting of the printing which you have set in the Print Setup window will effect the preview you get. You can access the same command by clicking the Print Preview button on the Standard toolbar (Figure 17) or from the chart context menu.
Figure 16 - Print preview
Figure 17 - Print Preview button
Note: You can choose to print the chart in color or black-and-white from the Options window - Chart tab (Figure 18).
Figure 18 - Options window - Chart tab
Use this command to print the active chart. The settings you have set in the Print Setup window and the color mode you have set in the Options - Chart will effect the print you get. You can access the same command by hitting the hotkeys CTR+P, by clicking the Print button on the Standard toolbar (Figure 19) or from the chart context menu.
Figure 19 - Print button
Use this command to shut down the terminal. You can hit ALT+F4 to close the terminal (or any windows application).
Note: By closing the terminal the Trailing stops will not send to the server anymore.
Hi folks,
Today we are going to study a very important piece of code that handles all the type of closing your opened orders! I'm saying it's important because of the huge number of private messages I'm receiving everyday asking me about this issue!
Our script today is all purposes closing script which you can use it to close your instant orders (the orders you open at the current market price which they are the normal orders and the opposite of pending orders), pending orders and more which we can see in the code. The most important thing is not the usage of the script (which is a very useful) but the understanding of the code.
The script (attached) is all purposes closing script which means you can decide what type orders you want to close; you can choose one of 8 options by its index number by setting the option parameter in the input window you get when you run the script (Figure 1):
These are the options:
0- Close all the orders (instant and pending orders) - this is the default option which mean if you run the script and didn't set any parameters all the orders (instant and pending) will be closed.
1- Close all instant orders; instant orders mean the orders that opened at the market price.
2- Close all pending orders.
3- Close by the magic number. You have to set the magic_number variable.
4- Close by comment. You have to set the comment_text variable.
5- Close orders (instant orders) in profit and leave the orders in loss.
6- Close orders (instant orders) in loss and leave the orders in profit.
7- Close not today orders and leave the orders that opened today.
The other two variables which you can set are:
magic_number: Set it if you'll use closing option 3 - closing by magic number.
comment_text : Set it if you'll use closing option 4 - closing by comment.
Let's give the code a look:
//+------------------------------------------------------------------+
//| CloseAll.mq4 |
//| CodersGuru |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "CodersGuru"
#property link "http://www.forex-tsd.com"
#property show_inputs
extern int option = 0;
//+------------------------------------------------------------------+
// Set this prameter to the type of clsoing you want:
// 0- Close all (instant and pending orders) (Default)
// 1- Close all instant orders
// 2- Close all pending orders
// 3- Close by the magic number
// 4- Close by comment
// 5- Close orders in profit
// 6- Close orders in loss
// 7- Close not today orders
//+------------------------------------------------------------------+
extern int magic_number = 0; // set it if you'll use closing option 3 - closing by magic number
extern string comment_text = ""; // set it if you'll use closing option 4 - closing by comment
int start()
{
CloseAll();
return(0);
}
//+------------------------------------------------------------------+
int CloseAll()
{
int total = OrdersTotal();
int cnt = 0;
switch (option)
{
case 0:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL) //pending orders
OrderDelete(OrderTicket());
}
break;
case 1:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
}
break;
case 2:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
break;
case 3:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == magic_number)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
}
break;
case 4:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if (OrderComment() == comment_text)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
}
break;
case 5:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if (OrderProfit() > 0)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
}
break;
case 6:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if (OrderProfit() < 0)
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
}
break;
case 7:
for (cnt = 0 ; cnt <= total ; cnt++)
{
OrderSelect(0,SELECT_BY_POS,MODE_TRADES);
if (TimeDay(OrderOpenTime()) < TimeDay(CurTime()))
{
if(OrderType()==OP_BUY)
OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet);
if(OrderType()==OP_SELL)
OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet);
if(OrderType()>OP_SELL)
OrderDelete(OrderTicket());
}
}
break;
}
}
Let's give the code a deeper look:
Hi folks,
Today we will discuss and test a simple expert advisor I've created for the purpose of this article and called it EMA_CROSS.
Download: StrategyTesterResult.zip (88.87 KB)
Download: EMA_CROSS.zip (1.31 KB)
The Expert advisor is a program wrote in MQL4 (we are studying MQL4 huh?) uses your favorite indicators and trade methods to automate your orders.
It can buy, sell and modify the orders for you. It enables you to drink a cup of tea and save the salary you gave out to your employee or the bunch of flowers you bring to your assistant wife.
Any expert advisor has to decide when to enter the market and when to exit.
And the idea behind any expert advisor is what the entering and exiting conditions are?
Our expert advisor is a simple one and the idea behind it is a simple too, let’s see it.
We use two EMAs indicators, the first one is the EMA of 10 days (sort EMA) and the
second one is the EMA of 80 days (long EMA).
Note: You can change the values of those two EMAs to the values you are comfortable with. I have chosen those values after running a lot of optimization testes which had changed those values and I’ve picked the best two EMAs as above.
Our expert advisor will enter the market when the short EMA line crosses the long
EMA line, the direction of each lines will determine the order type:
If the short EMA is above the long EMA will buy (long).
If the short EMA is below the long EMA we will sell (short).
We will open only one order at the same time.
Our expert advisor will close the buy order when the short EMA crosses the long EMA
and the short EMA is below the long EMA.
And will close the sell order when the short EMA crosses the long EMA and the short
EMA is above the long EMA.
Our order (buy or sell) will automatically be closed too when the Take profit or the Stop
loss points are reached.
Beside entering (opening) and exiting (closing) the market (positions) our expert advisor
has the ability to modify existing positions based on the idea of Trailing stop point.
You can change the values of the Trailing stop but it’s recommended to keep the default value 35.
You can use these timeframes 15M, 30M, 1H, 4H and 1D. The recommended timeframe is 4H.
Hi folks,
Today we are going to talk about a very important trading idea and take further step by creating a simple Expert Advisor for this idea.
We are going to study the "Hedging"
Hedging is a method the Forex trader take to reduce the risk involved in holding an investment. You can think in it as the insurance!
When you open an EURUSD position, there are only two future possibilities, the price moves in your direction or it moves against you. Hedging this position is the method you'll take to reduce the risk of the open EURUSD position by opening an opposite position (Buy when you've already sold and sell when you've already bought).
Opening an opposite position as mentioned above is is not the only method of hedging positions in Forex. And a lot of brokers do not allow their client to open two opposite positions of the same currency at the same time!
There are a lot of hedging methods but we are going to study one of them that works and in the same time no brokers will prevent you from using this method!
Our method is hedging the position by opening the same position (buy/sell) for another currency pairs that has negative correlation with the first currency we trade.
The correlation is the relation between the currency pairs. When two pairs have a positive correlation that means they are going the same direction. i.e. The EURUSD has a positive correlation with GBPUSD. (figure 1).
When two pairs have a negative correlation that means they are going the opposite direction. i.e. The EURUSD has a negative correlation with USDCHF. (figure 2).
Note: More details about correlation will be discuss in a separated article!
We are going to implement the idea of hedging by using the negative correlation between two pairs to write a simple Expert advisor.
Our expert advisor will open two positions (buy) of EURUSD and USDCHF (no much no less). Just notice the sum of the two trades and you will see clearly how the two positions have been hedged.
Note: You can take this Expert further more if you want to double the lot size of one of the opened traders when it make profit. or you can close the two opened positions when the total profit is a specified value (ex: 100 Pips).
Note: This kind of Expert Advisors (which trade more than one currency pair) couldn't be tested with MetaTrader Strategy Tester due the limitation detailed here:
"Trading is permitted for the symbol under test only, no portfolio testing
Attempts to trade using another symbol will return error"
http://www.metaquotes.net/experts/articles/tester_limits
//+------------------------------------------------------------------+
//| Hedging.mq4 |
//| Coders Guru |
//| http://www.forex-tsd.com |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link "http://www.forex-tsd.com"
extern string Sym_1 = "EURUSD";
extern string Sym_2 = "USDCHF";
extern double Lots = 1;
extern int Slippage = 5;
bool Sell = true;
//+------------------------------------------------------------------+
int start()
{
int cnt,total;
if(Bars<100) {Print("bars less than 100"); return(0);}
total = OrdersTotal();
if(total < 1)
{
if(Sell==0)
{
RefreshRates();
OrderSend(Sym_1,OP_BUY,Lots,MarketInfo(Sym_1,MODE_ASK),Slippage,0,MarketInfo(Sym_1,MODE_ASK)+1000*Point,"Hedging",1234,0,Green);
RefreshRates();
OrderSend(Sym_2,OP_BUY,Lots,MarketInfo(Sym_2,MODE_ASK),Slippage,0,MarketInfo(Sym_2,MODE_ASK)+1000*Point,"Hedging",1234,0,Green);
}
else
{
RefreshRates();
OrderSend(Sym_1,OP_SELL,Lots,MarketInfo(Sym_1,MODE_BID),Slippage,0,MarketInfo(Sym_1,MODE_BID)-1000*Point,"Hedging",1234,0,Red);
RefreshRates();
OrderSend(Sym_2,OP_SELL,Lots,MarketInfo(Sym_2,MODE_BID),Slippage,0,MarketInfo(Sym_2,MODE_BID)-1000*Point,"Hedging",1234,0,Red);
}
return(0);
}
return(0);
}
As you see in the code above we open two similar trades for EURUSD and USDCHF which have a negative correlation.
We used the MarketInfo() function to get the bid/ask price for each pairs. This is the most important thing in this code because MarketInfo() function is the only way to get the bid/ask prices for another pairs of the currently symbol of chart! You can't use here the functions Bid or Ask.
Before using the MarketInfo() we have used the function RefreshRates() to be sure that we getting the up-to-date market data.
Hope you find the code and the article helpful and hope to drop me a comment!
Hi folks,
Today I'm going to answer frequently asked question which it deserve to be answered!
A lot of people asking:
How could I host more than expert advisor in the same instance of MetaTrader? What should I change in the code to prevent the conflict between the multi expert advisors hosted in MetaTrader?
You'll find the answer here!
You can load more than one EA for the same currency and the same timeframe by:
1- Opening the charts you want to load your EA on (Figure 1 and 2).


2- Setting the timeframe (Figure 3).
3- Attaching the expert advisor to each chart by activating the chart you want to attach the EA on (Activating means clicking the chart window) then from the Navigator window choose the EA and right click to the get the context menu (Figure 4) then choose "attach to a chart" command.
I know by asking the above question you know very much the previous steps but they are for the novices, don't be in a hurry! the coming section needs an advanced user of MetaTrader and who can handle MQL4 programs.
Just imagine you have an expert advisor that buying EURUSD when - for instance - the price crosses the EMA13 upward on 1 hour timeframe. There's no problem yet!
You have another EURUSD 15 minutes chart that hosts another expert advisor. The second expert advisor will buying EURUSD when the price crosses - say - EMA24.
Where are the conflicts?
1- The most of the expert advisor checks how many order had been opened and decide to enter the market only of the total of the orders are 0, this is the frequently used code:
total = OrdersTotal();
if(total < 1)
{
//Do trade
}
When you host more than expert advisor a code like above will lead to a lot of problems when on of the expert advisors open a trade; the other expert advisor will not work because total opened trades are not 0.
2- If the expert advisors you are hosting use different Trailing Stop values you will get a lot of trouble if you used the normal trailing stop code like that:
// check for trailing stop
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
3- There is no problem for the normal Take Profit and Stop Loss levels because you sent them with OrderSend function when you open the trade; but if the expert advisor uses Total Profit/Loss calculation (for example the expert advisor closes all the opened trade when the total of profits of the orders open by the expert advisor is 100 Pips). In this case there will be another conflict.
These were some of the conflicts of hosting more than expert advisors in the same instance of MetaTrader.
The conflict between the expert advisors occur when the code of them is not "exclusive code".
Exclusive code means you have to write (or modify) you expert advisor to the way they can live with the other expert advisors without problems by distinguishing the orders the expert advisor opens so he can work with them and with them only, at the same time the expert advisor hasn't to use general codes like OrdersTotal() without looping through all the opened orders to examine who opened them.
The best way to distinguish the orders the expert advisor opens is using the MagicNumber.
Review: The Magic Number is one of the parameters (optional parameter) of the OrderSend Function.
OrderSend() is the function you use in MQL4 to open a new order (instant or pending order) and the magic parameter (the ninth parameter ) is an integer value you set as a magic number of the opened order!
The Magic Number is a unique number you assign to your order(s) as a reference enables you to distinguish between the orders that opened by your expert advisor and the orders that opened by another expert advisors or manually.
Let's solve our first code problem, How could an exclusive version of OrdersTotal to get the only count of orders opened by our expert advisor.
Let's create a function that returns the count of orders opened by our expert advisor:
int ExOrdersTotal(int MagicNumber)
{
int total = OrdersTotal();
int extotal = 0;
for(int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if ( OrderMagicNumber()==MagicNumber)
extotal++;
}
return (extotal);
}
The ExOrderTotal is equivalent to OrderTotal function with only one difference; it takes the MagicNumber constant you use in your expert advisor and returns only the count of orders opened by our expert advisor.
The function loop through all the opened orders and select them one by one, then it compares the magic number of the selected order with the MagicNumber constant of your expert advisor and increase the count of orders (extotal variable) in the case the two are identical.
Lets create two functions that trail and close only our opened orders:
void TrailOrder(int type)
{
if(TrailingStop>0)
{
if(OrderMagicNumber() == MagicNumber)
{
if(type==OP_BUY)
{
if(Bid-OrderOpenPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
}
}
}
if(type==OP_SELL)
{
if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
}
}
}
}
}
}
The TrailOrder function use the same technique of ExOrdersTotal function by comparing the MagicNumber constant of the expert advisor against the magic number of the selected order and Trail only the orders that has identical magic numbers.
bool CloseOrder(int type)
{
if(OrderMagicNumber() == MagicNumber)
{
if(type==OP_BUY)
return (OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,Violet));
if(type==OP_SELL)
return (OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,Violet));
}
}
The CloseOrder function closes only the orders opened by the expert advisor (which has an identical magic numbers).
Note: to use the TrailOrder and CloseOrder functions you have to use the normal loop used in the most of expert advisors to select the order you want to trail or close upon the conditions of trailing or closing, like this code:
//some code ......
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY) //<-- Long position is opened
{
if(CloseBuyCondition) //<-- Close the order and exit!
{
CloseOrder(OrderType());
}
TrailOrder(OrderType()); //<-- Trailling the order
}
if(OrderType()==OP_SELL) //<-- Go to short position
{
if(CloseSellCondition) //<-- Close the order and exit!
{
CloseOrder(OP_SELL);
}
TrailOrder(OrderType()); //<-- Trailling the order
}
}
}
//some code ......
It's very rare to find two expert advisors use the same magic number, the magic is an integer data type which vary from -2147483648 to 2147483647. At the same time you can check the MagicNumber of the expert advisors you want to host in MetaTrader and change them in the code.
But if you want to generate a unique MagicNumber you can use this script.
Run it and copy from the alert window the generated MagicNumber (Figure 5).
Hope you find it a helpful article and any comments are welcomed!
Coders Guru
Hi folks,
Today we will talk about the line studies usage in MetaTrader.
The line studies are lines and geometrical figures you can draw them on the chart. The line studies enable you studying the chart, therefore, analyzing the market for the purpose of effective strategies.
You can insert a line study two ways; 1- by choosing the line study you want to insert from the Insert menu (Figure 1) or by clicking the line study button you want to insert from the line studies toolbar (Figure 2).
Note: In the line studies toolbar (Figure 2) you will not find all the line studies available in MetaTrader, MetaTrader saves the toolbar place by showing a few of the available item in a toolbar. But you can add/remove one or more of the available line studies to the toolbar by taking these steps:
1- Right click on the line studies toolbar and you will get a menu like figure 3.
2- Choose Customize command from the menu and that will pop up the line studies toolbar customize window as shown in figure 4.
3- To add new item to the toolbar select it from the right list and click the Insert -> button.
4- To remove an item from the toolbar select it from the right list and click <-Remove button.
5- To set the order of the button in the toolbar select the item and use the Up and Down buttons.
6- To reset the toolbar items to the default items shown in figure 2 click the reset button.
Choosing the line study from the menu or clicking the line study on the toolbar will convert the mouse cursor to a different shape according to the line study, and you are ready now to draw the line study you have be chosen.
You draw the line study by clicking the left mouse on the point you want to start the drawing the line on and dragging the mouse while you are holding the left button of the mouse then release the mouse on the point you want to end the drawing in.
Drawing a line study will set it you the default properties of the line study (Except the position and the size which you set while you drawing the line).
To change the properties of the line study you can double click the line study you want to select it then right click the mouse on it (the line study) and a context menu will appear (Figure 5) from it choose the line study properties… , a window based on the kind of the line will appear (Figure 6).
From this window you can change the properties of the line study, like the Name of the line, the Description of the line, the Style of the line, the start Time and end Time of the line, the start Value and end Value of the line and the timeframe you want to draw the line in.
Note: You can access the properties of the line study by accessing the Object List window (from the Charts->Objects menu, from Object List command in the context menu of the chart or by hitting CTRL+B) figure 7. From this window you can double click the line study you want to edit or click Edit button to bring the line study properties window.
You can delete a line study you already have drawn by clicking it to select it and hit Delete keyboard key, you can access the same command from the context menu show in figure 5 and select Delete command, you can delete a line study too from the Object List window (Figure 7).
To delete more than one line study you have to select them by clicking the first line study you want to delete and hold the SHIFT key while you are double clicking the other line studies you want to select then hit the DELETE keyboard key or choose Delete All Selected command from the context menu in figure 5.
Note: In MQL4, it's very easy to write a program to delete all the line studies drawn on the chart in the main window and the other window.
You can download this script from here:
Hi folks,
I couldn't count how many messages/emails I'm getting everyday asking me about MetaTrader email notification function and about the email extension I've created to enhance the functionality of the MetaTrader email notification function.
For all of my readers I'm re-writing the email notification article in more details.
First of all I want to complain about the email functionality of MetaTrader which made me mad a lot of times. Anyway let's step-by-step see how could we set the email options and send our "test message"? Yep! it finally worked!
Don't believe the all of the required configurations you will be asked for when you open Tools -> Option -> Email tab.

As you see in figure 1 you have to set only these fields:
1- You have to check Enabled check box.
2- You have to enter your SMTP server (It'll not work with web mail accounts).
3- Leave SMTP login and SMTP password fields empty.
4- Set the From & To fields to the emails you want.
Now, you can click the Test button to check the correctness of the configurations you set. You will get a message box like the one showed in figure 2 asking you to be patient and to give the journal tab a look to know the result.
And if you are a lucky person like me you will get this line "Test message has been sent" ) Figure 3. And seconds and your outlook express telling you that you've got a new mail.
Hi folks,
In the previous article we knew that MetaTrader could speak our tongue language, which means we can add our own language to the languages list of MetaTrader interface.
And we knew our tool to edit/add languages is Multi Language Pack (MLP) program that shipped with MetaTrader. And we even loaded the MLP and viewed its Main window (Figure 1).
Today we are going to know everything about editing/adding languages using the MLP program.
Editing a language is a rare task because you rarely find a mistake in the translation of the shipped with MetaTrader language list.
Anyway, knowing how to edit language file will give us a good hint of how to add our new language pack.
Note: We are going to work only with the terminal project (terminal.prl) and every concept you'll learn here is a suitable for the other projects (MetaEditor.prl and LiveUpdate.prl).
Let's say we want to edit the terminal string ID 5017 which telling us the message "Account disabled" which in Spanish must to be "Cuenta desactivada".
But wait! what the terminal string means?
In terminal project you can work with three categories of interfaces:
Strings:
These are the general information texts for example the messages the terminal telling the user and the captions of the buttons etc.
Menu:
These are the menus and sub-menus captions that appear to the user, for example the Chart menu and its sub-menus.
Dialog:
These are the dialogs windows that appear to the user, for example the Options windows (Figure 2).
You find these three categories as trees under each language tree (Figure 3).
Now we can edit the string ID 5017 in the Spanish translation by going to Strings in the left tab and find the string ID 5017 in the right tab then we have to double click the text to edit it (Figure 4). Please notice in figure 4 the little tool tip above the text editor field that gives you the English translation! That's really cool!
You have to save the changes to the project by going to File menu and choose Save Project (or hit CTRL+S hot keys) and that enables you to load the project in the next time with the changes you have made.
But the changes you have made hadn't effect the MetaTrader interface yet, you have to Compile the project to make the changes take place.
To compile the project you can Click the Compile button on the toolbar (Figure 5), hitting CTRL+F9 hotkeys or you can access the same action from the Tools menu where you'll find Compile Project command.
The MLP program will compile you project and showing you this message box (Figure 6) telling you that everything is OK.
Hi folks,
Concentrating in trading and price movements only requires an easy platform to use, a platform that you can learn it in a few period of time and to easily memorize how to access its features and interface!
One of the problems that faces the most of the users of any platforms is the language of its interface (Menus, Windows and Commands etc). Not all of us fluent (or like) the English language and the most of platforms speaks English!
MetaTrader terminal shipped with a list of languages that's rarely you'll not found your tongue language on them.
To get the list of the available languages and to change the language of the terminal interface you have to go to View menu and choose the Languages sub-menu which will drop down the list of the language to choose from (Figure 1).
Figure 1 - Languages menu
It's not a problem, you can use the Multi Language Pack software and compiler shipped with MetaTrader to build and add your language to the list and above all to make all the users of MetaTrader around the world to use your language.
Today we are going to learn step-by-step how to use MLP (Multi Language Pack) to create our own language pack.
You'll find the MLP program (mlp.exe) in the path of MetaTrader, you can browse there and double click it.
But the quick method is going to the View menu and choose the Languages sub-menu then click the last command Multilanguage Pack (Figure 1).
That will bring the MLP program which welcome you (Figure 2), click ok to dismiss the welcome window and you'll get the main window of the MLP (Figure 3).

As you can see in figure 3 the main window of the MLP is split to two parts; the left part is the list of the languages already installed which you can view and edit them. The right part is the editor window which display the editable strings of the language's Strings, Menus and Dialogs (Figure 4).
We are going to know everything about editing and adding languages using the MLP later in this article but let's know what's the programs we can change its language (Interface language) using the MLP program.
There are three programs that MLP working with their language files and enable you to edit them:
Terminal: This is the MetaTrader itself.
MetaEditor: The MetaQuotes Programming Language Editor (where your write your MQ4 programs).
Live update dialog: It's the dialog appears when there's a new version released in MetaQuotes server and the terminal wants to download it (Figure 5).
Each program of these programs has its own language file (.prl files) which you can find them in MetaTrader_installed_path/languages folder.
To open this files you have to go to the File menu in MLP program and choose Open Project command (or simple hit CTRL+O hot keys) then browser for the languages folder to open the project of the three projects you can edit.
Note: You'll find two another file types while you are browsing the languages folder:
.lng files: These are the files MLP saves each language to it, you can export/import these file to MLP and edit them.
.xml files: For the MetaEditor only you will find some of .xml files which contain the Dictionary (Help) translation for MetaEditor.
We are happy that we knew we can add our own language to MetaTrader program(s) and we are ready to learn more about the Multi Languages Pack. We will know all about the MLP in the next article.
I hope you find it a helpful article and wait your comment!
Hi folks,
Today we are going to talk about one of hard understood issue in MetaTrader and Forex (at least for the new comers); Pending orders.
When you take your decision to enter the market and to sell/buy a currency pair you order you brokerage to make to sell/buy for you.
There are two types of orders you can make:
Instant (Market) order:
In this type of orders you order the brokerage to sell/buy the currency instantly and at the current price you see in the terminal. The broker executes your order without any delay and return OK for you.
In this type of orders you use the BID and ASK prices to sell/buy the currency.
In MetaTrader you make the instant order by going to Tools menu and choose New Order command or hitting F9 hotkey to open the Order window (Figure 1).
Figure 1 - Order window
As you see in figure 1 you have the current price of the currency written as ASK/BID pair (1.2100/1210) and when you click Sell or Buy buttons you sell/buy instantly at these prices.
Pending orders:
In this type of orders you order the brokerage to sell/buy the currency in the future and not now. You ask him to sell/buy the currency when the price of the currency reaches a specified price above or below the current price.
Example: the current Ask price of the EURUSD pair is 1.2100 and going up, and you guess the price will go down a little before continuing to go up, in this case you can order the brokerage to Sell the EURUSD when the price at the 1.250.
The brokerage will obey your order and wait the price of the EURUSD to reach 1.250. If your prediction was right and the price went reached 1.250 the brokerage will Buy the EURUSD at the price 1.250 and convert your pending order into market order.
If the price didn't reach the 1.250 what will happen? The brokerage can wait for ever so you can set an expiration time to your order that if has been reached the brokerage cancel the order.
The type of the pending order explained in the example above called Buy Limit order; there are four types of pending orders.
Buy Limit order:
In this type of pending orders you want to Buy a currency pair and you guess that the price will go down for a few period of time and then will go up again. You set the price level below the current Ask price and send the order to the brokerage.
When the price goes down to the level you have specified the order will be opened for you and the brokerage buys the currency pair.
Buy Stop order:
In this type of pending orders you want to Buy a currency pair and you guess that the price will keep going up but you are not sure, you set the price level above the current Ask price and send the order to the brokerage.
When the price goes up to the level you have specified the order will be opened for you and the brokerage buys the currency pair.
Sell Limit order:
In this type of pending orders you want to Sell a currency pair and you guess that the price will go up for a few period of time and then will go down again. You set the price level above the current Bid price and send the order to the brokerage.
When the price goes up to the level you have specified the order will be opened for you and the brokerage sells the currency pair.
Sell Stop order:
In this type of pending orders you want to Sell a currency pair and you guess that the price will keep going down but you are not sure, you set the price level below the current Bid price and send the order to the brokerage.
When the price goes down to the level you have specified the order will be opened for you and the brokerage sells the currency pair.
in windows xp on ntfs file system there is an option to seem-less compression of files "on the fly" by the file system.
may be some time you should do it again. for new files.
because it seems that windows do not make new files compressed automatically.
but those that already marked as compressed they still save space( like common log files).
my metatrader folder was 3G and after that it became 1G and the charts load faster.
Hi folks,
In my humble opinion, there are two things make any software a professional software. The first thing is the stability of the software, the second and the most important thing is the usability of the program.
The Wikipedia defines the usability as: “Usability is the degree to which the design of a particular user interface takes into account the human psychology and physiology of the users, and makes the process of using the system effective, efficient and satisfying.”
We are going to study the user interface of MetaTrader in these series of articles and you (the user) the only one who can decide the usability degree of MetaTrader.
The top most area of any application called the application title. In MetaTrader this title (Figure 1) contains: the current account number, the program name and the title of the active chart and its timeframe.
Figure 1 - Application title
Under the application title in the most of Microsoft Windows applications you will find the main menu (Figure 2). The main menu of MetaTrader contains all the available commands and functions in the terminal client. The main menu includes the following sub-menus: "File", "View", "Insert", "Charts", "Tools", "Window" and "Help".
Figure 2 - Main menu
The toolbar(s) is a little window(s) under the main menu enables you to easy access some of MetaTrader commands and functions (Figure 3). The most important commands and functions have been grouped in four toolbars: "Standard", "Charts", "Line Studies" and "Periodicity".
These toolbars are customizable and you can change the commands of any of the toolbars.
Figure 3 - Toolbars
In this window you will find a list of financial instruments and their current prices (Figure 4). This window enables you to manage trade positions and charts. Double click the currency pair you want to open new order for or drag it to the price chart window to open its chart.
Figure 4 - Market watch
In this window you find useful information about the prices and programs (experts and indicators) attached to chart (Figure 5). just drag the mouse over the chart or the programs on the chart and you will see this information.
Figure 5 - Data window
This is the window of the easy access to the opened accounts, advisors, indicators and scripts (Figure 6). From this window you can manage your accounts and your programs (advisors, indicators and scripts).
Figure 6 - Navigator window
In this window you can work with account history, news, alerts, internal mail, news and logs (Figure 7). In this window you can see the opened and pending orders and manage them. Notice the tabs at the bottom of this window which enable it to host a lot of useful windows.
Figure 7 - Terminal window
The price chart window is the main tool for market data analysis. The terminal plots here the history data as well as the received quotations (Figure 8). Besides you can load your custom indicators and you can draw line studies and graphics.
Figure 8 - Price chart
At the bottom of terminal client you will find the Statusbar (Figure 9). The statuesbar shows various information like: the statue of connection to the server, the name of currently loaded profile, hints for the under mouse command and the price data.
Figure 9 - Satusbar
Clicking the left corner of the horizontal bar of the chart window will open text box called quick navigation box (Figure 10). In this box you can quickly navigate among the opened chart and chart periods. You can too to go to a specified position in the chart.
Figure 10 - Quick navigation box
Hi folks,
Today we are going to study one of the most used MetaTrader's menus; the Chart menu.
The chart menu (Figure 1) enables you to work effectively with the charts and the attached indicators and objects. You will spend 50% of your menu work in this important menu so, let's CHART!
Figure 1 - Chart menu
These are the commands available in the Chart menu:
Clicking this command will open to you Indicators Manager window (Figure 2). In this window you will find all the attached indicators to the active chart grouped by the drawn window (Main window , separate window(s)).
Figure 2 - Indicators Manager window
You can delete any attached indicator on the chart by selecting it from the Indicators Manager then clicking Delete button. And you can to change the settings of any indicator by selecting it then clicking Edit button.
Note: Edit button will open the Indicator Settings window (Figure 3).
Figure 3 - Indicator Settings window
You can access the same action of this commend by clicking the right mouse button on the chart and that will open a context menu (Figure 4) which you can choose the Indicators List command from it or simply you can hit the CTRL+I hotkeys to access the same action.
Figure 4 - Context menu
Clicking this command will open a sub-menu (Figure 5) enables you to manage all the drawn Objects on your chart.
Figure 5 - Objects sub-menu
These are the commands of this sub-menu:
Hi folks,
We talked in the previous two articles about two of important menus; the File menu and the View menu.
Today we are going to talk about the Insert menu. Insert menu is less used menu because all of its commands (except inserting Indicators) are located in the Line Studies toolbar (Figure 1).
We too have not too much to say about Insert menu. Because the most of the commands of this menu will be in a separate article which discuses using Line Studies.
Figure 1 - Line studies toolbar
The Insert menu groups all the Objects you can draw on the chart. You use these Objects as visual aid and in order to understand an analyze the chart (Figure 2). Besides you will find a sub-menu with a list of all the available Indicators in your system (Figure 3).
Figure 2 -Insert menu
Figure 3 - Indicators sub-menu
These are the commands available in Insert menu:
When you click this command you will get a sub-menu with a list of all the available indicators in your system. There are two kinds of MetaTrader indicators:
This is a set of indicator shipped with MetaTrader and considered the standard indicators. This kind of indicators are for use only and you can open them to see/modify their source code. You can access these indicators from the Navigator window - Indicators list (Figure 4).
Figure 4 - Navigator window - Indicators list
These are the indicators which located at experts/indicators folder. the most of these indicators are open source (came in .mq4 format then compiled to .ex4 format). you can open these indicator in MetaEditor to see/modify their source code. You can access these indicators from the Navigator window - Custom Indicators list (Figure 5).
Figure 5 - Navigator window -Custom Indicators list
In the Indicators sub-menu you will find all the built-in indicators grouped in categories (ex: Trends, Oscillators and Volumes). And all the Custom Indicator located in the Custom sub-menu.
To insert an indicator to the active chart, simply click its name in the Insert - Indictors menus and you will prompt with the Indicator Parameters window (Figure 6) to set the indicator parameters. Clicking OK button in the Indicator Parameters window will attach the indicator to the chart.
Figure 6 - Indicator Parameters window
All the other commands in the Insert menu are all the available objects in MetaTrader. We will discuss these objects in detail in another article.
Hi folks,
Our menu today is the menu of accessing the Tools available in MetaTrader. We are going to talk about Tools Menu (Figure 1).
Figure 1 - Tools menu
These are the commands available in the Tool menu:
It's the command of courage, when you decide to make a New Order. Clicking this command will open the New Order window.
Hi folks,
In the previous article we have studied the File menu, it was very useful and heavily used menu. Actually all the menus of the terminal are very important way to manage effectively the terminal.
Today we are going to study the View menu. Let's view!
In this menu (Figure 1) you will find the commands enabling you to manage the interface of the terminal. You can open/close windows and the toolbars to fit your needs. You can also change the language of the terminal interface to the language you understand. This is the available commands in this menu:
Figure 1 - View menu
Clicking this command will prompt you with a list of the available languages (Figure 2) to choose from. Besides, you can translate the interface into your own language by using the MultiLanguage Pack program shipped with MetaTrader. You access the MultiLanguage Pack program from the same menu.
Figure 2 - Languages list
Note: Changing the interface language takes effect when the terminal be restarted.
Clicking this command will prompt you with a list of MetaTrader toolbars (Figure 3). To enable a toolbar (viewing) you have to check it (click to check/uncheck) and to disable a toolbar you have to uncheck it.
Figure 3 - Toolbars list
Besides, you can customize the buttons on any of the toolbars by clicking "Customize..." command (Figure 4).
Figure 4 - Customizing toolbars window
Check/Uncheck this command option to view or un-view the status bar. The statues bar is the lower part of the terminal window (Figure 5). The statues bar shows various information like: the statue of connection to the server, the name of currently loaded profile, hints for the under mouse command and the price data.

Figure 5 - Statues bar
Check/Uncheck this command option to view or un-view the chart bar. The chart bar is a little bar lower the Chart window(s) (Figure 6) enabling you to switch between the opened charts.

Figure 6 - Chart bar
Check/Uncheck this command option to view or un-view the Market Watch window (Figure 7). In this window you will find a list of financial instruments and their current prices and enables you to manage trade positions and charts. You can access the same command by clicking the Market Watch button on Standard toolbar (Figure 8).
Figure 7 - Market Watch window
Figure 8- Market Watch button
Hi folks,
Today we have two menu to talk about; Windows menu and Help menu.
You use this menu (Figure 1) to manage the chart windows on you workspace, you can open new window and manage the already opened one from the Window menu.
These are the command available in this menu:
This command is the same as the File -> New Chart command. You use it to open new chart window for a currency pair.
When you click the New Window command MetaTrader will prompt you with the currency sub-menu (Figure 2) to choose from it the currency you want to open a chart for it.
Note: The first commands in this sub menu are the common pairs, if you can't find the pair you want to open its chart in these commands click the Forex command and another list will be opened (Figure 3). If you still can't find the pair you want to open its chart you have to go to the Market Watch window and right click it and from the context menu choose Show All command (Figure 4).
Figure 3
Figure 4
This is the first command of the three windows arrangement commands. You use this command to arrange the opened chart windows in stages (Figure 5) where every window is behind the other so can manage them easily.
Figure 5 - Cascade
Use this command to arrange the windows horizontality (Figure 6) where every window is beside the other.
Figure 6 - Tile Horizontally
Use this command to arrange the windows vertically (Figure 7) where every window is below the other.
Figure 7 - Tile Vertically
Use this command to arrange the minimized windows one beside the other (Figure 8 & 9).
Figure 8 - Arrange Icons
Figure 9 - Arrange Icons
Besides the above commands you will find all the opened chart windows located in lower part of the Window menu (Figure 10) where you can activate the chart you want by clicking it from the menu.
Figure 10 - Opend charts
You use this menu (Figure 11) to access the help file of MetaTrader.
There are two commands in this menu:
Figur