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.

snippet - 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...
snippet - MQL5: Action at new candle
5 Oct, 2021
Do work only at the time of the birth of a new candle.
snippet - 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.
snippet - 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.
snippet - MQL5: Trailing stop
1 Oct, 2021
How to implement trailing stop to MQL5. Basically during every tick you iterate through all positions, when trailing stop can be moved higher/lower it will do just that.
snippet - 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.
snippet - 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.