Forex Traders are able to program their strategies into code and execute them on mt4 Trading Platform. This allows the trading computer to trade automatically. It is possible to use MQL, or Metaquotes language to compile and write executable ex-files called Expert Advisor to run on mt4 Trading Account.
Programming is very similar to C, with variable declarations, logic comparison and the execution of files.
MQL4 supports a wide range of data types including character, Boolean and integer. Create local variables using standard declarations such as int double string, etc. You must declare global variables before the int begin(). If you want your variables and values to remain after the end of your program, declare them as static by using static int or double.
There are many pre-defined constants in the program that you can choose from. Standard constants for timeframe are PERIOD_M1,,PERIOD_M5,,PERIOD_M15,PERIOD_M30,PERIOD_H1,,PERIOD_H4,,PERIOD_D1,,PERIOD_W1, and PERIOD_MN1. The currency chart can be used to trigger technical indicators. This function uses OP_BUY (buy limit), OP_SELL (sell limit), OP_BUYLIMIT (selllimit), OP_BUTSTOP, and OP_SELLSTOP to cover all 6 trade executions. Last but not least, the price-related standard constants PRICE_CLOSE, PRICE_OPEN, PRICE_HIGH, and PRICE_LOW are often used to create technical charting.
All the codes are commonly used: Ask, Bars Bid Close Digits (High, Low), Open Point Time. In order to compare currency prices, it is common for Ask, Bars, Close, Low, High, and Open to be used as operands. The term bars is used to count the number of bars within the currency chart. Point is the current value of the symbol in the quoted currency, while Digits represents the price after the decimal. These two numbers are used in order to calculate stop losss, take profit, as well as buy and sell prices.
It is the group of functions which provides important information on your trading accounts. These include margin, balance and trading lot calculations. AccountBalance and AccountFreeMargin are the functions that you will use most often. AccountLeverage is also a function. AccountMargin as well as AccountProfit. To avoid a margin call, you need to put in some margin requirements.