Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

nProfit and Loss Positions - library for MetaTrader 5

Views:
1266
Rating:
(4)
Published:
Updated:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance


Profit_and_Loss_Positions - Positions Profit/Loss Calculator

Purpose

Plug-in file for calculating the total profit or loss of trading positions with filtering by type and Magic Number.

Main function

Profit_Position(string p_l, string type_pl, long magicNumber)

Calculates the total profit or loss of positions.

Parameters:

  • p_l - calculation type: "Profit" ( profit) or "Loss" ( loss)

  • type_pl - type of positions: "All" , "Buy" , "Sell" , "Sell"

  • magicNumber - filter by magic number (0 = all)

Returns: total profit/loss in deposit currency

Examples of use

// Profit sum of all items
double profitAll = Profit_Position("Profit", "All", 0);

// The amount of loss of BUY positions of the Expert Advisor with magik 123
double lossBuy = Profit_Position("Loss", "Buy", 123);

// The amount of profit of SELL positions
double profitSell = Profit_Position("Profit", "Sell", 0);

Practical application

For traders:

  • Monitoring current results

  • Analyse the effectiveness of strategies

  • Riskcontrol

For developers:

  • Riskmanagement in experts

  • Creating trade reports

  • Implementing closing conditions

Features

  • Works only in MetaTrader 5

  • Supports Magic Number filtering

  • Returns amount in deposit currency

  • Efficient position override

How to connect

#include <Profit_and_Loss_Positions.mqh>

// Use in expert code
double currentProfit = Profit_Position("Profit", "All", 123456);

Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/68505

WPR Monitoring MTF Trend WPR Monitoring MTF Trend

monitoring varous trends of timeframes in one timeframes

MASTER-WINNERFX-Asim MASTER-WINNERFX-Asim

Trend based grid Expert Advisor for MetaTrader 5 using EMA and RSI indicators. Dynamic lot size is calculated from account balance with minimum and maximum lot protection. Initial trade opens when price confirms trend direction relative to EMA and RSI levels. Grid orders are added at fixed point distance using controlled multiplier. All trades are managed as a basket and closed at defined profit target or maximum loss level. Includes optional news hour pause and market close filter. No DLL or external services required.

nModify Orders nModify Orders

Function for modifying open positions and pending orders

Modern Time Panel - Candle Time Modern Time Panel - Candle Time

Modern Time Panel for MT5 The Modern Time Panel is a sleek, minimalist custom indicator for MetaTrader 5 that helps you track time with precision. Fixed neatly at the top-right corner of your chart, it displays the current Broker Time, Local Time, and a live countdown to the next candlestick (New Bar). Built with an independent 1-second timer, the countdown continuously runs even when the market is slow or there are no incoming ticks. Fully customizable and dark-mode friendly, it is the perfect non-intrusive tool to ensure you never miss a candle close.