The MetaQuotes Language 4 and 5 (MQL4 / MQL5) are an object-oriented high-level programming language intended for writing automated trading strategies, custom technical indicators for the analysis of various financial markets.
MQL5 use amount instead of lot size
21 Jan, 2024
In MQL5, when initiating a buy order, the platform typically uses lot size as a measure. However, there are instances where you might prefer to specify the amount in currency rather than lots. In...
Run Part of Your MQL5 Code Every Minute
30 Apr, 2023
If you prefer not to run your code on every tick, you can schedule it to run during the launch of a new bar or after any specific time period. This can be a useful feature for those who want more...
MQL5: Use timeframes selection as input
29 Mar, 2022
This snippet shows how to use timeframes as input field. For that you just have to use the ENUM_TIMEFRAMES. It contains all of the predefined timeframes. This way you can use multiple times in a...
MQL5: Get current spread
4 Oct, 2021
This snippet shows how to get current spread as points. If you want it in price then you have to multiply it with point size or get ask and bid difference.
MQL5: Get current bid/ask price
4 Oct, 2021
This snippet shows how to get current bid and ask price. Two prices are there for buy and sell pricing and the difference of those is your spread.
MQL5: Trailing stop
1 Oct, 2021
Implementing a trailing stop in MQL5 involves continuously monitoring the market during each tick by iterating through all open positions. This allows the program to check if the market price has...
MQL5: Close all trades at the end of the day
1 Oct, 2021
This snippet is of a code that will close all trades at the end of the day. The percise time can be modified to your preferations.
MQL5: random if else
1 Oct, 2021
To get a random result, you can take MathRand() and use the modulus operator, it gives the reminder of division.