Forex Traders may use programming to convert winning trading strategies into computer code that can be run by MT4's platform. The program will then trade for them automatically. This can be done by using MQL (metaquotes) languages and metaeditor, which compile the code into executable ex file called expert advisor for mt4 forex trading accounts.
Similar to C in terms of declaring variables, logic comparisons and executing files and functions.
MQL4 includes a range of datatypes, such as character, Boolean integer, date, time and color. Standard declarations for local variables like int. double. string. etc. can be used. In order to create global variables you must declare them before calling int start(). Static variable declaration using static double or int will allow you to have the variable value and availability after your program ends.
This program has many built-in constants. This is the timeframe constant that has many different options. These include PERIOD_M1, Period_M5, Period_M15 and PERIOD_M30. Other standard values are: PERIOD_H1, Period_H4, PERIOD_D1, period_W1 as well as PERIOD_MN1. Useful for selecting the currency charts to be used as triggers. In the next function, OrderSend(), the constants for trade operations OP_BUY,OP_SELL,OP_BUYLIMIT,OP_SELLLIMT,OP_BUTSTOP,OP_SELLSTOP are used. These 6 variables cover the different types of trade execution. It is important to note that the last set of standard constants is price-related. They are PRICE_CLOSE (closed), PRICE_OPEN (open), PRICE_HIGH or PRICE_LOW.
In all programming codes, the following are frequently used: Bars Ask, Button, Clock, Time, Numbers, High Low, Digits. When comparing the price of a currency, you will often use Ask, BID, CLOSED, OPEN, HIGH and LOW for your operand. Counting the bars of a selected currency chart is done using the word Bars. Digits refers to the number following the decimal place for the current symbol. The two are combined to determine the stop-loss and profit-taken prices, as well buy and sale price.
There are several functions in this group that can be used. This includes the calculation of balance, margins and other important data about your account. AccountBalance AccountFreeMargin AccountLeverage AccountMargin AccountProfit and AccountProfit. These are frequently used functions. The margin you require is the minimum required. I typically use a 200% margin on max open lot using account leverage in order to achieve maximum drawdown.