MetaTrader 4 is a trading platform enables you to process your trades and technically analyze the market in real time with a build-in language (MQL4) for programming your indicators and expert advisors.
These are some of MetaTrader features:
These are the steps you have to take to setup MetaTrader 4:
If you didn't download the MetaTrader 4 program yet it's the time to get your free version by going to: http://www.metaquotes.net/downloads and choose to download the last version of MetaTrader 4 Client Terminal (Current version is 4.00 Build 190).
Get a cup of tea if you have a slow internet connection or a cup of water if you have a DSL while the downloading process (Figure 1).
When the download completed double click the setup program (mt4setup.exe) and you will get a screen like this:
Figure 2 - Choose the language
You can choose the language you prefer for the MetaTrader used interface. Then Click Next button to go to the second step:
Hi folks,
Finally you have decided to trade Forex! Or you are a new comer to MetaTrader from the another platform? whatever the case I congratulate you for your choice!
MetaTrader is the platform of choice for automating your trades
These are some of MetaTrader features:
Today we are going to take the first step to profit from this great platform. We are going to download the MetaTrader platform!
There are two versions of MetaTrader. MetaTrader 3 and the up-to-date version is MetaTrader 4. Some of broker still has not support MetaTrader 4 and in this case you have to download MetaTrader 3.
But the most of brokers now support MetaTrader 4 and that's the version we are going to download today!
There are a lot of places you can download Metatrader 4 from. The most of brokers who support MetaTrader 4 present their version to download. You have to download the version of the broker you are going to work with because this version has the server settings of that broker.
These are the steps you have to take to setup MetaTrader 4:
If you didn't download the MetaTrader 4 program yet it's the time to get your free version by going to: http://www.metaquotes.net/downloads and choose to download the last version of MetaTrader 4 Client Terminal (Current version is 4.00 Build 190).
Get a cup of tea if you have a slow internet connection or a cup of water if you have a DSL while the downloading process (Figure 1).
When the download completed double click the setup program (mt4setup.exe) and you will get a screen like this:
Figure 2 - Choose the language
You can choose the language you prefer for the MetaTrader used interface. Then Click Next button to go to the second step:
You will be asked to wait a few seconds then you get your account details, Keep them in a safe place because you'll need them (Login and Password) to login to your demo account. Click Finish button to log to your account and start trading.
Hi folks,
One of the most important features of MetaTrader is the ability to write your own programs and attach them to MetaTrader terminal.
Programs includes Indicators , Expert advisors , Scripts and Libraries.
These programs written in a programming language called MQL4 and can be used in MetaTrader by proper installing.
Today we are going to study how to install these program to use them in MetaTrader.
There are two kinds of files that you'll use with MetaTrader; the programs files and the executables files.
The program files are normal text files but have one of these extensions: .mq4 and .mgh.
These files are the source code of the programs wrote in MQL4 programming language; source code means they could be opened for viewing or editing.
You open these files with a program shipped with MetaTrader called MetaEditor.
MetaEditor is the program enabling you to view, edit and compiling these files (we are going to know what compiling means).
The executable files are binary files (you can't open them for viewing or editing) and has the extension .ex4.
These files are the result of compiling the .mq4 files using MetaEditor. And these are the files that you can load them in MetaTrader and use them.
Note: the .mgh files are header files which mean they have line of codes and the MQL4 programmer can include them in his MQL4 programs. So they couldn't be compiled to .ex4 files.
Compiling is an operation taken by a special program (called a compiler) to convert from text (readable) format to the binary format which the computer can understand (computers think in binary).
This is the general definition of compiling. Compiling in our case is converting the mq4 files to ex4 for file using MetaEditor program.
To do that we simply open the mq4 files in MetaEditor then pressing F5 hot key.
MetaEditor will compile (convert) the file to ex4 format and keeping the mq4 file untouched.
MetaEditor will place the generated ex4 file at the same path as the mq4 file.
We compile the mq4 files because the MetaTrader can't load any files except ex4 files.
So, when we get the mq4 files and compile them, does it mean we've finished installing them and ready to use them?
Actually no! There's a further step we have to take. This step is putting the ex4 file in its proper folder.
Note: it's recommended to take the folder step before the compiling step that's because the compiler will place the ex4 file at the same place as the mq4 files.
You knew that there are four kinds of MetaTrader programs; expert advisors, indicators, scripts, libraries, besides the header files (.mgh files).
MetaTrader is very tidy program and he set a folder for each type of programs and he expects that you are a tidy trader and will place every program in its proper folder.
MetaTrader search the folder of the experts for the experts and the folder of indicators for the indicators etc.
And MetaTrader only interested in the ex4 files and they are the files he searches the proper folders for!
So, you have to place the source code of the expert advisors in the folder of the expert advisors and use MetaEditor to compile them to generate ex4 files in the expert advisors folder. The same with the indicators, the scripts and the libraries.
These are the folders used:
Expert advisors folder:
MetaTrader_Dir\experts
Indicators folder:
MetaTrader_Dir\experts\indicators
Scripts folder:
MetaTrader_Dir\experts\scripts
Libraries folder:
MetaTrader_Dir\experts\libraries
Include folder (mqh files)
MetaTrader_Dir\experts/include
I hope installing MetaTrader programs now is an easy task and if you have any question please don't hesitate to ask!
Coders Guru!
Hi folks,
We have placed our first order in the previous article. Today we are going to know how to modify and close this placed order.
Let's start by the limits which we can set to an order!
Order limits mean you set boundaries to the order to prevent big losses and aiming to take the profit as soon as you can.
These are the types of the order limits
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.
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).
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.
In the terminal window right click on the order you want to modify. And from the context menu choose Modify or Delete Order (Figure 1).
Figure 1
This will pop up the Order Window but in this case it's in a medication order mode (Figure 2).
Figure 2
In this window you will find to text boxes to set (in pips) the Stop Loss and Take Profit prices (Figure 3). When you put the prices in pips in those text boxes you have to click the "Copy as:" buttons under the two boxes to let MetaTrader to convert your levels into prices.
Or you can write the prices of Stop Loss and Take Profit directly in the Stop Loss and Take Profit combo boxes (Figure 4).
Figure 3
Figure 4
Now you have to click the Modify button (Figure 5) to send your modification to the broker. And you will prompt with a window like figure 6. Click Ok button.

Figure 5
Figure 6
This will set the limits you've chosen to the order and will appear in the terminal window as shown in figure 7.
Figure 7
Congratulation! You have set the Stop Loss and Take Profit levels to your order. When the price reach these level it will be closed automatically and you prevent more losses (if the Stop Loss price is the one that has been reached) or take your profit (if the Take Profit price is the one that has been reached).
Now, you could ask me, What about setting the Trailing Stop?
The Stop Loss and Take Profit limits which you have been learnt to set them above were sent to the broker and even you close MetaTrader the broker knows now when to stop the order.
But in the case of Trailing Stop MetaTrader have to be on because he sends the new Stop Loss level continuously to the broker. And when you close it the broker will know only the last Stop Loss level MetaTrader has been sent before shutting down.
Now let's set the Trailing Stop level to our Order.
In the terminal window right click on the order you want to set its Trailing Stop. And from the context menu choose the Trailing Stop sub-menu (Figure 8). The sub-menu will show you these commands:
Delete All: To delete and previous Trailing Stops you have set.
None: It means there's no Trailing Stop level has been set.
15 Points, 20 Points .. 50 Points: These the default points (Pips) level which you can choose from them. If you not interested in them you can choose the custom command.
Custom..: Clicking this command will open the Custom Trailing Stop Window (Figure 9) which in it you can set the level of the Trailing Stop. But note that the trailing stop must be greater than 15 Points.
Choose the level from the context menu or set the custom level and click OK will save the Trailing Stop. MetaTrader will use this setting to move your Stop Loss level automatically as long as you running the program.
Hi folks,
MetaTrader is the platform which enable you to send your orders to the brokerage to Sell or But a currency pair.
Today we are going to place our first order in MetaTrader.
Load your instance of MetaTrader and log to your account (MetaTrader will automatically log to your default account).
To place an order (Sell or Buy) you have to open the Order window (Figure 1).
Figure 1
There are a lot of methods to open the Order window:
You can press F9 hot key.
You can right click the chart of the currency you want to Buy/Sell it and choose New Order from the contest menu that will appear (Figure 2).
You can right click the Market Watch window on the currency you want to Buy/Sell and choose New Order from the contest menu that will appear (Figure 3). or you can double click this currency.
Figure 2
Figure 3
Now, in the Order window (Figure 1) you see two buttons: Sell and Buy button. you have to decide you want to Sell or Buy the currency and click the appropriate button.
In the Buy order the ASK price used to open the order and in the Sell order the Bid price used to open the order.
As you can see in figure 1 the New Order window you can set these options:
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. 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.
You have to choose Instant Execution because you want to make a Buy/Sell instantly.
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.
I chose to buy the EURUSD so I clicked the Buy button and this was the result (Figure 4).
Clicking Ok will place the order (send it to the broker) and you will can watch your profits or loss in the terminal window as shown in figure 5.
Figure 4

Figure 5
Hi folks,
Today – and in these series of articles – we are going to take the Forex new comers hand and guide them to understand the fundamentals of the Forex.
All of us know that the shortest (and maybe the only) way to the money is the trading.
We have an imaginary character called Mr. X.
Mr. X wants to trade in cars, he wants to buy cars and sell them when the price increases.
Mr. X has a big problem to start his trading, the Capital. Mr. X has 1000USD and the price of the car he wants to trade in is 10000USD.
Mr. X confident that if he has the 10000USD he can sell the car for 12000USD and make 2000USD net profit.
None want to lend Mr. X the capital to start his trading. And no cars’ company will agree to lend him the car.
The capital problem of Mr. X is the problem facing all the people around the world and killing their trading dream.
The good news is: you can trade without a capital.
Mr. X can buy the car with his small capital and when sell it he can take the 2000USD profit for himself! Yes this is possible with the Margin Basis Trading!
In this system you shouldn’t pay the whole price of the goods but you can pay a deposit and when you sell the goods you take the net profit for you or you bear the loss.
Mr. X can buy the 10000USD car with his 1000USD deposit with the aid of margin basis trading and when he sell the car for 120000USD he can take the profit and return the 9000USD to the company who sold him the car with the 1000USD deposit.
The company who will sell the car to Mr. X for 1000USD deposit has a condition.
Its condition is: you will not possess the car but we will hold it to you and when you find a customer to buy it we will sell it to him and take the 9000USD the remaining of the car price (10000USD) and give you the profit.
Mr. X agreed with pleasure!
With the trading in margin basis you will not process the goods but you can trade in it and the company holds the goods for you.
You take the whole profit and bear the whole loss.
In our example Mr. X paid the 1000USD and he is searching for a buyer for the car, he didn’t find a price more than 9000USD for the car.
In this case he made a loss of 1000USD. The Company in this case will take the 9000USD from Mr. X plus the deposit of 1000USD.
Mr. X think if he wait for more days the price will go up again and he can make profit, two days later the price went down more and the price of the car now is 8000USD. If Mr. X sold the car at this price he will lose and the company too will loss!!
In the trading in margin basis there’s a rule:
The company couldn’t loss!
So, the company will not wait to the day that the price of the car drop to 8000USD and will ask Mr. X to sell the car at the price 9000USD because any drop in the price means the company will loss too and that can be!
This called “margin call” and we are going to talk about it in more details later!
Now! The most important thing we have to know is: How the company who sold the car to Mr. X gave him a 10000USD car for 1000USD?
This is the leverage!
The company who sold the car to Mr. X gave him the ability to trade in a 10000USD car for 1000USD capital. It had duplicated his capital 10 times and this called 1/10 leverage. Because the company allowed Mr. X to trade 10 x his capital.
If the leverage of this company was 1/100 that means Mr. X can trade in goods equal to 100000 (100 x his capital 1000).
The leverage is the backbone of trading in margin basis.
Hi folks,
Your speaker today Coders’ Guru, One of Mars planet residents who have been decided to travel to the Earth when I heard about the great advantages of using MetaTrader Expert Advisors.
Unbelievable story huh? Ok this is a real one:
It was a full of traffic day, the trend going the expected direction and the pips fall down one after one from the sky. I have to stay in front of my terminal these hours to fill my pocket to the maximum gain I could make.
Suddenly, I found my little daughter crossing my room and shouting at me “Father, you promised me to teach me today how to set the chess board”. I promised here today? I don’t remember!
My wife entered the room and said to my daughter “don’t bother your father” I smiled “Your father always forgets his promises” I shocked “didn’t you promise me to go shopping together today?” I promised here today? I don’t remember!
Well, I have to use an expert advisor to automate my trade and to safe my family!
The expert advisor is a piece of code (Some of instructions you give to MetaTrader) written in a specific programming language called MetaQuotes Programming Language Version 4 (abbreviated to MQL4) compiled to a program which can stay in front of the terminal instead of you and automates your trades. It can analyze the chart as any indicator do plus it can at specific conditions to open, modify and close the trading orders.
The expert advisor can do anything you can do except one only thing, it can't do a mistake!
Our task today is talking to the new comers to MetaTrader who want to know how to use the expert advisors in MetaTrader.
Logically, to use the expert advisor you have to have it.
There are two formats of expert advisors you maybe have:
If you have the expert advisor in xxx.mq4 format (where the xxx is the expert advisor name followed by dot then the mq4 extension) that means you have the source code of the expert advisor.
Source code means you have the expert advisor as a piece of code that written in MQL4. You can open this file in any text editor and read it but you can't use it in MetaTrader yet. Why?
That's because, MetaTrader can't load this kind of expert advisors and requires an extra step before loading it.
It requires converting this expert advisor to another format it understands, it the .ex4 format.
MetaTrader can load only the expert advisors which have the .ex4 extension.
The ex4 files are the executable version of the mq4. (Executable means they are not in text format anymore but they are in binary format).
To convert the mq4 to ex4 you have to do the following:
Open the mq4 file in the MetaEditor (Figure 1). MetaEditor is a program shipped with MetaTrader enabling you to write your own expert advisors and to convert them to ex4 format. To open MetaEditor you can double click the .mq4 file or you can click the Start button then Program Files (All Programs in windows XP) and search for MetaTrader menu then choose MetaEditor (Figure 2). But if you opened the MetaEditor from the Program Files you have to click File menu in MetaEditor then Open command (Figure 3) to browse for the .mq4 file you want to convert to .ex4.
Figure 1 - MetaEditor
Figure 2 - Program Files
Figure 3 - Open command
After loading the mq4 file into MetaTrader, go to File menu and choose Compile command (Figure 4) or hit F5.
Figure 4 - Compile command
This will produce a file name as same as the name of the mq4 file but with .ex4 file extension. This file will be created in the same path of the .mq4.
This is the executable version of the expert advisor. It's ready to use expert advisor but unfortunately you can not open it in the text editor to view the source code (because it’s in binary format not text format like the mq4 files).
Wait! You can't load the expert advisor to MetaTrader yet.
MetaTrader require extra step before loading the expert advisor (which I consider it a shortage in this great program).
You have to copy the .ex4 file to the /experts folder.
You will find the /experts folder is in the installing folder of MetaTrader.
If you not sure where is this folder just right click on the MetaTrader icon and select Properties from the context menu then click Find Target button (Figure 5).
Congratulations! You can load the expert advisor to MetaTrader now and only now.
You have the .ex4 version of the expert advisor and the expert advisor is located at /experts folder. Well, you are ready now to use the expert advisor.
You will find the name of the expert advisor in the MetaTrader Navigator window (Figure 6).
As you can see in figure 6, the Navigator window is divided to tree of lists; the list which we interest in is Expert Advisors list.
In this list you will find all the expert advisors that in your /experts folder and of course which are already compiled to .ex4 format.
Note: If you don't see the Navigator window in your terminal or you closed it, you can bring it back by clicking the Navigator button in the MetaTrader toolbar (Figure 7), clicking View menu and choose Navigator or simply hit CTRL+N hotkeys.
To load the expert advisor from the navigator window you can do one of two things:
Drag the expert advisor to the chart you want it to automate. (Dragging means selecting the expert advisor from the Navigator window and holding the left button of the mouse while moving the mouse to the chart then releasing the left button on the chart).
Double click the expert advisor you want to attach to the chart. But be sure you have activated the chart you want to work with. (Activating the chart means simply clicking it).
When you load the expert advisor to the chart you will prompt with the expert advisor input windows (Figure 8).
In this window you can input the required data to the expert advisor, for example: Take Profit value, Stop Loss value and Lots value.
Note: You will get the details of all the inputs of every expert advisor from the creator of the expert advisor or from the forum you downloaded the expert advisor from.
You can change the inputs of the expert advisor or you can leave the default values you see in the input window.
After setting the inputs of the expert advisor you have to click OK.
If you are a lucky person you will see the name of the expert advisor on the right upper corner of the chart with a fascinating smile beside it (Figure 9).
If you didn't find this smile icon that means the expert advisor is not enabled!
You have to tell MetaTrader to use expert advisor to automate your trade, you have to enable the expert advisor.
From the toolbar of the MetaTrader you will find Expert Advisors check button (Figure 10). Check button means when you click it enables the expert advisors and goes to pressed figure and when you click it again it disables the expert advisor and goes to un-pressed figure (Figure 11).
Note: When you disable the expert advisor the smile icon goes to "x" icon (Figure 12).
Hi folks,
Today we are going to study how to use Indicators in MetaTrader platform.
The indicator is a program wrote in MQL4 which mathematically manipulates the prices and can draws lines on the chart.
The Indicators differ than the Expert Advisor in these:
Note: The lines meant by Indicators can draw lines are the buffers lines. But the Study Lines (ex: vertical lines, horizontal lines, Arrows and Shapes etc) could be drawn from the Indicator and from the Expert Advisors.
There are two kinds of MetaTrader indicators:
This is a set of indicators shipped with MetaTrader and considered the standard indicators. This kind of indicators are for use only and you can not open them to see/modify their source code. You can access these indicators from the Navigator window - Indicators list (Figure 1).
Figure 1 - 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 indicators in MetaEditor to see/modify their source code. You can access these indicators from the Navigator window - Custom Indicators list (Figure 2).
Figure 2 - Navigator window -Custom Indicators list
To insert an indicator to the chart, you firstly have to active the chart by clicking it then go to the Navigator window to choose the indicator you want to insert and right click it. You'll get a sub-menu like the one showed in Figure 3.
From this menu you have to choose "Attach to a chart" command.
Figure 3 - Indicators sub-menu
You'll prompt with the Indicator Parameters window (Figure 4) to set the indicator parameters. Clicking OK button in the Indicator Parameters window will attach the indicator to the chart.
Figure 4 - Indicator Parameters window
Note: You can simply double click the indicator name in the Navigator window to open the Indicator Parameters window.
Note: In the Insert menu you will find Indicators sub-menu (Figure 5) where you can 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. Clicking the indicator name from this menu will open the Indicator Parameters window.
Figure 5 - Insert -> Indicators menu
Hi folks!
Today we are going to study how to use Scripts in MetaTrader. Let’s first know what do the Scripts mean?
The Script is a program wrote in MQL4. It’s very like the Expert Advisor in its ability to open/close/modify trades, however there are two differences between the Script and the Expert Advisor:
The Script is executed only once (when you attach it to the chart) while the Expert Advisor is executed when you attach it to the chart and after that it is executed at every new quotation arrival.
Well, there’s another difference: You have to enable the Experts (Review the previous article to know how) first to be able to use them while the Scripts don’t need that to be executed.
Hi folks!
MetaTrader have a very user friendly interface and I think this is one of the most important reasons of its success.
Moreover, to make the world easier for the user, MetaTrader gives you the ability to access its most used function by using hot keys!
A hot key is a combination of keyboard keys which you press them together to carry a specific task. You are using them everyday and every minute just remember that CTRL+C is a hot key of copying the selected text in the most of the programs that operate under MS Windows!
In MetaTrader you press a hot key to access a task that you can access it from the MetaTrader's menu or toolbar (i.e. F9 is the hot key to open new order window).
We are going to list all the available hot key of MetaTrader. But we have to discuss a very important feature of MetaTrader; Assigning hot key!
MetaTrader gives you the ability to assign a hot key to any of your programs (Indicators, Expert advisors and Scripts) for easy access.
Let us step by step assigning a hot key to one of the indictors:
1- The first step is going to the Navigator window (Figure 1) and choosing the indicator you to assign a hot key to it. Let's say we want to assign the hot key CTRL + G to the Alligator indicator.

Note: The CTRL + G hot key is already assigned by MetaTrader to hide/show grids and when we assign it to one of program it will be overwrote and when we press the CTRL + G the assigned program will work not the show/hide grids.
2- Right-Click on the Alligator indicator to bring the context menu (Figure 2) and choose Set hotkey command.
3- This will open the Navigator Hot Keys window (Figure 3), Select the Alligator indicator if not already selected.
4- Click Set button and you will find two fields to fill; one for the control key (ctrl or alt) and the other filed for the keyboard letter (Figure 4). set the fields to CTRL and G. and click Close button!
Note: There are another two buttons in he Navigator Hot Keys window: Reset button will reset your last entry and the Reset All button will reset all of your assigned hot keys.
Now you can click CTRL + G to add the Alligator indicator to your chart (Figure 5).
Here's the list of the hot keys available in MetaTrader:
| Hot key | Function |
| ← | chart scrolling to the left |
| → | chart scrolling to the right |
| ↑ | fast chart scrolling to the left or, if the scale is defined, chart scrolling up |
| ↓ | fast chart scrolling to the right or, if the scale is defined, chart scrolling down |
| Numpad 5 | restoring of automatic chart vertical scale after its being changed. If the scale was defined, this hot key will return the chart into the visible range |
| Page Up | fast chart scrolling to the left |
| Page Down | fast chart scrolling to the right |
| Home | move the chart to the start point |
| End | move the chart to the end point |
| - | chart zoom out |
| + | chart zoom in |
| Delete | delete all selected graphical objects |
| Backspace | delete the latest objects imposed into the chart window |
| Enter | open/close fast navigation window |
| Esc | close the dialog window |
| F1 | open this MetaTrader user guide |
| F2 | open the "History Center" window |
| F3 | open the "Global Variables" window |
| F4 | download MetaEditor |
| F5 | switch to the next profile |
| F6 | call the "Tester" window for testing the expert attached to the chart window |
| F7 | call the properties window of the expert attached to their chart window in order to change settings |
| F8 | call the chart setup window |
| F9 | call the "New Order" window |
| F10 | open the "Popup prices" window |
| F11 | enable/disable the full screen mode |
| F12 | move the chart by one bar to the left |
| Shift+F12 | move the chart by one bar to the right |
| Shift+F5 | switch to the previous profile |
| Alt+1 | display the chart as a sequence of bars (transform into bar chart) |
| Alt+2 | display the chart as a sequence of candlesticks (transform into candlesticks) |
| Alt+3 | display the chart as a broken line (transform into line chart) |
| Alt+A | copy all test/optimization results into the clipboard |
| Alt+W | call the chart managing window |
| Alt+F4 | close the client terminal |
| Alt+Backspace or Ctrl+Z | undo object deletion |
| Ctrl+A | arrange all indicator windows heights by default |
| Ctrl+B | call the "Objects List" window |
| Ctrl+C or Ctrl+Insert | copy to the clipboard |
| Ctrl+E | enable/disable expert advisor |
| Ctrl+F | enable "Crosshair" |
| Ctrl+G | show/hide grid |
| Ctrl+H | show/hide OHLC line |
| Ctrl+I | call the "Indicators List" window |
| Ctrl+L | show/hide volumes |
| Ctrl+P | print the chart |
| Ctrl+S | save the chart in a file having extensions: "CSV", "PRN", "HTM" |
| Ctrl+W or Ctrl+F4 | close the chart window |
| Ctrl+Y | show/hide period separators |
| Ctrl+Z or Alt+Backspace | undo the object deletion |
| Ctrl+D | open/close the "Data Window" |
| Ctrl+M | open/close the "Market Watch" window |
| Ctrl+N | open/close the "Navigator" window |
| Ctrl+O | open the "Setup" window |
| Ctrl+R | open/close the "Tester" window |
| Ctrl+T | open/close the "Terminal" window |
| Ctrl+F6 | activate the next chart window |
| Ctrl+F9 | open the "Terminal — Trade" window and switch the focus into it. After this, the trading activities can be managed with keyboard |
Guys,
I would like to create an alert which triggers if vertain levels are hit on an 'Accelerator' oscillator. Anyone know how you should go about doing this?
Cheers
I really like this Alert Sar Kalenzo created. But I need your help. Would you like to add up or down arrows (signals) or dot everytime the alert occurs and it only displayed once. The signal is not repeated like the normal SAR signal. The signal can be viewed within 1-3 months historical data.
Please help me...
I really like this Alert Sar Kalenzo created. But I need your help. Would you like to add up or down arrows (signals) or dot everytime the alert occurs and it only displayed once. The signal is not repeated like the normal SAR signal. The signal can be viewed within 1-3 months historical data.
Please help me...
Hi I have limited charts for metatrader. can u please tell me how to enable other charts like silver audnzd, nzdusd etc.
thnx
kev
Is it possible to use multiple MagicNumbers in a single EA to open orders under different conditions and close orders for different conditions?
Logic Example;
Open statements
If ( Condition A ) { Open order this way with this MagicNumber1 }
If ( Condition B ) ( Open order this other way with MagicNumber2 even if there is an existing open order }
Close statements
If ( Order opened under condition A && MagicNumber1 ) { Perform MagicNumber1 Close }
If ( Order opened under condition B && MagicNumber2 ) { Perform MagicNumber2 Close }
Is this possible or do I need to write a different EA per MagicNumber so they won't conflict with each other?
Hi folks,
When we talk about the trailling stop techniques, we are talking about the exit positions strategy indeed.
Any trade position you enter has to end with one of two results: you gain profit or you make loss.
Your have only two concerns: to gain the maximum profit you can, and to make the minimum loss you can.
One of your early days memories describes the confusion of exiting the position in the appropriate time.
The market is trending in your direction, you make profits and everything is perfect till now, suddenly, the market has turned his trend against you. Worried novice trader will puch the close button and breath the full-lung safety air.
Minutes and market turns his neck again and run at the old profitable closed direction.
Did you achieve the first dream? Make the maximum profit you can? No!
Tow days after the previous lesson you have opend your pocket and made a bid. The profits bursts out on your face, suddenly the marked turned his direction, you smiled and said "you can't cheat me anymore , I learnt the lesson" the market is still rununing against you and you still smiling.
It will turn his direction , I'm sure!
It will turn his direction , I hope!
It will turn his direction , I'm scared!
Finally you pushed your close button and pumped crying.
Did you achieve the second dream? Make the minimum loss you can? No!
The trailing stop is for these situations where early exit migh prevent the profits to run and late exit migh prevent cutting the loss early.
We are going to study how to set the trailing stop by hand in MetaTrader terminal and how write the code that imbed the trailing stop. Firstly let's give the trailing stop the dictionary definition.
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).
Note: The trailing stop modify the order in your client terminal and send the new stop loss level to the broker, So, you have a running terminal to trail your orders and when you shut down the terminal not more trailing stops will work.
To place a trailing stop you must have an opened position. You simply go to the position you want to set its trailing stop in the Terminal Window and right click it, that will bring the context menu showed in figure 1, choose from it Trailing Stop sub-menu and you'll get the levels of trailing stop you can choose one of them.
If you didn't find the trailing stop level you want in this menu you can click the last command in the menu "Custom" to bring an input window to set the trailing stop (Figure 2).
// YOUR CODE HERE!
extern double TrailingStop = 100;
int MagicNumber = 101090;
//+------------------------------------------------------------------+
int start()
{
int cnt,total;
total = OrdersTotal();
// YOUR CODE HERE!
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
{
TrailOrder(OrderType()); return(0); //<-- Trailling the order
}
if(OrderType()==OP_SELL) //<-- Go to short position
{
TrailOrder(OrderType()); return(0); //<-- Trailling the order
}
}
}
return(0);
}
//+------------------------------------------------------------------+
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);
}
}
}
}
}
}
In the code above we are trailing all the opened position using our function TrailOrder().
We go through all the opened positions using a loop that start from 0 to the count of order returned by OrdersTotal() function.
And to be sure that we are working with the order of current chart we check the Symbol of the against the selected OrderSymbol.
Then we call the TrailOrder() which take only one parameter; the type of order: OP_SELL or OP_BUY.
This is our function that handle the trailing stop for us. There are two cases of the orders:
Buy order:
In the case of Buy order we check that the profit ( current Bid price minus the open price) is greater than the TrailingStop value we have set (or the user set) and we modify the order to new StopLoss level which equal to the current Bid price minus the TrailingStop value.
Sell order:
In the case of Sell order we check that the profit ( the open price minus current Ask price) is greater than the TrailingStop value we have set (or the user set) and we modify the order to new StopLoss level which equal to the current Ask price plus the TrailingStop value.
Please refer to my MQL4 lessons form more details! Any question is welcomed!
Hi folks!
Today we are going to explore the customized options of the MetaTrader client. You can access these options by clicking Tools menu then choose Options (Or you can hit the hotkey CTRL+O) to get the Options window showed in figure 1.
Figure 1 - Options window
As you can notice in figure 1 the Options windows divided to tabs, each tab has a set of options belongs to one of MetaTrader aspects.
We will study today each tab in details.
In this tab you set the broker server related settings (Figure 1):
Server field: Type here the broker IP address and the connection port separated by ":" sign. Or you can type the domain name of the broker server.
For example:
InterbankFX-Demo - Interbank FX, LLC (Domain name)
217.74.32.254:1950 (IP:Port)
Login field: Type here your login number (The number you have got the first time you opened a demo account).
Password field: Type here your password.
Change button: Click this button to change you passwords (Master or Investor passwords) Figure 2.
Figure 2 - Change your passwords
Data center auto configuration option: Check this option if you want MetaTrader to automatically set the IP Address of Data Center (See later). When you enable this option the Data Center field and Test button will be disabled.
Data Center field: Type here the Data Center server and port you want you manually set. Data Center is the server where the MetaTrader gets the quotations, news and history data. And through the Data Center the MetaTrader sends your orders and receives the response. If you put a wrong Data Center the MetaTrader will not operate at all. (We will dedicate the Data Center installation and operating several articles in this site).
Test button: Click this button to test your Data Center server.
Enable proxy server option: Click this option if you want to connect to the MetaTrader server through a proxy server. Enabling this option will enable the Proxy… button.
Note: Proxy server is a protected connection to the internet (Firewalls) installed in your machine and you have to set MetaTrader to use your proxy settings in order to be able to connect to the internet.
Proxy… button: Clicking this button will open the proxy settings window (Figure 3) where you can set MetaTrader to use your proxy settings.
Note: In the Proxy settings window you need to set all of the followings:
Server and port.
Proxy type (Socks, Socks5 and HTTP proxy).
User name and Password.
Figure 3 - Proxy settings
Keep personal settings and data at startup option: Enable this option and MetaTrader will not prompt you every time it runs asking you for your login data.
Enable DDE server option: Click this option if you want to enable the MetaTrader DDE server which enables you to get real time quotations from MetaTrader.
Note: DDE stands for Dynamic Data Exchange. DDE enables two running applications to share the same data.
The program who we capture the data from called "DDE server”. And the program who captures the data from server called "DDE client".
Enable news option: Click this option if you want MetaTrader to query the Data Center to obtain server news.
In this tab you set the parameters and setting of the MetaTrader chart which will be shared by all the charts (Figure 4):
Figure 4 - Charts tab
Show Trade Levels option: Check this option if you want MetaTrader to draw the trade positions lines (Figure 5). Those lines include the Opened order, Pending orders, StopLoss and TakeProfit levels.
Figure 5 - Positions lines
Show OHLC option: Enable this option if you want MetaTrader to show OHLC (Open, High, Low and Close values) line of the current bar. It will draw them in the upper left corner of the chart (Figure 5) beside the currency pair name and the period of the chart.
Example: EURUSD,H4 1.2099 1.2106 1.2099 1.2106
Show ask line option: Enable this option if you want MetaTrader to draw the ask (price) line (The red line in figure 6).
Figure 6 - Ask line
Show Period Separator option: Enable this option if you want MetaTrader to show the period separator (Horizontal dots line showed in Figure 7).
Figure 7 - Period Separator
Color Print option: click this option if you want to enable color printing of the chart (To print the chart, go to File menu and choose Print or click CTRL+P).
Figure 8 shows the chart in Black-White mode and Figure 9 shows the chart in Colored mode.
Figure 8 and 9 - Chart colors printing modes
Save deleted Chart for reopen option: Enable this option if you want MetaTrader to save Deleted chart template and restore them in startup. Deleted chart template can be opened by going to File menu and choose Open Deleted.
Max bars in history field: Type (or choose from the drop down list) here the maximum number of bars you want MetaTrader to store in the history database. This data used in Strategy tester and the larger number of bars the good result you get.
Max bars in chart filed: Type (or choose from the drop down list) here the number maximum number of bars you want MetaTrader to draw in the chart. These bars are important for your indicators to work properly.
In this tab you set the parameters and setting of the MetaTrader graphical objects which will be shared by all the charts (Figure 10):
Figure 10 - Objects tab
Show properties after creation option: Enabling this option tells MetaTrader to prompt the objects Properties window (Figure 11) every time after you create an object.
Figure 11 - Objects Properties window
Select object after creation option: Enabling this option tells MetaTrader to select the object after its creation.
Select object by single mouse click option: Enable this option to use single mouse click (Instead of double click) to select an object on the chart.
Magnet sensitivity (in) pixels field: Set here the number of pixels of the objects magnet (warp) towards the nearest bar price.
In this tab you set the Trade mostly used default values (Symbol, Lots and Deviation) (Figure 12):
Figure 13 - Trade tab
Symbol by default options: Set here the default value of used Symbol (Currency pair), you can choose one of three options:
1- Automatic: MetaTrader will automate choosing the symbol.
2- Last used: MetaTrader will use the last symbol you used.
3- Default: Clicking this option will enable a drop down list where you can set a default value for the used symbol.
Lots by default options: Set here the default value of used Lots, you can choose one of two options:
1- Last used: MetaTrader will use the last Lots value you used.
2- Default: Clicking this option will enable a drop down list where you can set a default value for the used Lots.
Deviation by default options: Set here the default value (in Pips) of used Deviation, you can choose one of two options:
1- Last used: MetaTrader will use the last deviation value you used.
2- Default: Clicking this option will enable a drop down list where you can set a default value for the used deviation.
In this tab you set the options related to Expert advisors you (Figure 14):
Enable Expert Advisors option: Check this option to enable Expert advisors automating your trades. You can access the same option by click the Expert advisor button in the toolbar (Figure 15). Enabling this option will make the next two options selectable.
Disable Expert Advisors when the account has been changed option: Check this option if you want MetaTrader to disable Expert advisors automatically in the case of changing the account. This option is useful when you have a demo and a real account and you constantly switching between them. You have to enable the Enable Expert Advisors to use this option.
Disable profiles when the account has been changed option: Check this option if you want MetaTrader to disable using the current profile automatically in the case of changing the account. The same the above option this option is useful when you have a demo and a real account and you constantly switching between them. You have to enable the Enable Expert Advisors to use this option.
Allow live trading option: Enable this option if you want live trading and using Expert advisors.
Ask manual confirmation option: Enable this option and MetaTrader will prompt you for a confirmation every time to open order, modify order, stop order etc. You have to enable the Allow live trading option to use this option.
Allow Dll imports option: Checking this option will enable Expert advisors to use external functions reside in DLLs libraries. For instance you have to enable this option if you want to use MessageBoxA function which resides in user32.dll. It's a good idea to disable this option if you are using unknown expert advisors because someone can write a harmful code by accessing the critical functions of the Windows system (Even a virus).
Confirm Dll function calls option: Enable this option and MetaTrader will prompt you for a confirmation before using any imported DLL functions (Figure 16). You have to enable the Allow Dll imports option to use this option.
Figure 16 - Confirm Dll function call
SMTP server field: Type here your SMTP server address.
SMTP login field: Type here your SMTP login name.
SMTP password field: Type here your SMTP password.
From field: Type here the name which will appear as email From when you receive the email alert.
To field: Type here the name which will appear as email To when you receive the email alert.
Test button: You can click this button to test your above configurations.
Account field: Type here the number of your active account.
Refresh every (in) minutes list: Choose in minutes from the drop down list the periodicity of reporting sending.
FTP server field: Type here your FTP server address.
FTP path field: Type here the path of the folder in your FTP you want to send (save) the alerts to.
FTP login field: Type here the login name to your FTP.
FTP login field: Type here the password of your FTP login.
Passive mode option: Check this option to switch from standard to passive mode of FTP.
Test button: You can click this button to test your above configurations.
Check enable button to enable the sounds alerts in events. And double click the Ring image to enable/disable an alert for an event. To change the sound you can choose from drop down menu of installed .wav files or you can browse your computer to choose new .wav file for the event you want.