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

Advanced Risk Manager: Auto Suffix Detection Multi Currency Lot Sizer - library for MetaTrader 5

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

Purpose of the File

This professional MQL5 include file (.mqh) is engineered as a reusable, self-contained component designed specifically for advanced risk management and precise position sizing across diverse trading assets.

The Underlying Strategy and Core Concept

Many commercial Expert Advisors fail unexpectedly when deployed on trading accounts with non-USD base currencies (such as EUR, GBP, or JPY) or when trading under brokers that append custom suffixes (e.g., .pro, .ecn) to asset symbols. This library solves these multi-broker infrastructure issues by introducing a dynamic exchange rate engine that ensures deterministic risk calculations under any market environment.

The core architecture utilizes a high-performance triangular currency conversion algorithm to map the profit currency of the target asset directly to the trader's account currency. By scanning direct, inverse, and USD cross-pairs in fractions of a millisecond, the module calculates the exact current tick value, completely eliminating the risk of over-leveraging due to currency mismatches.




Key Architecture Components and Methods

- CalculateLotSize: Dynamically computes the deterministic volume size based on a strict user-defined risk percentage of the account balance and the exact stop-loss distance.
- GetConversionRate: Automatically resolves exchange rate conversion paths, switching between direct asset evaluation and triangular cross-currency calculations.
- ExtractSuffix: Programmatically identifies and strips broker-specific naming extensions to prevent "Symbol Not Found" errors during server lookup processes.
- CheckDrawdownLimit: Provides enterprise-grade capital protection by evaluating real-time equity drawdown and preventing new executions if safety limits are breached.

How to Integrate

To deploy this module, simply place the file inside your MQL5\Include\ directory, include the header at the top of your Expert Advisor, and instantiate the class object. Initialize the framework in your OnInit() handler and invoke the lot sizing algorithm immediately prior to constructing your trade requests.
Channel Sun Signals Channel Sun Signals

Overview Channel Sun Signals plots an adaptive, triangular-weighted moving-average channel (a center line plus an upper and lower band) around price, and marks potential reversal points where price pierces a band and then closes back inside it. It is built on the same "band-break-then-reversal" logic used by classic TMA/CG-style channel indicators, but rewritten natively for MT5 — including its own multi-timeframe engine that does not rely on iCustom() or an external .ex5 file, so the indicator works standalone once compiled.

SimpleTradeStats SimpleTradeStats

Statistics on closed trades. The indicator shows trading results, filtered by magic number.

Mediana Trendline Mediana Trendline

Draws parallel trend channels (Median, High, Low) on the current chart based on the last two closed candles of up to 7 higher timeframes (MN1, W1, D1, H4, H1, M30, M15), with individually configurable colors and line styles for each timeframe.

Clock (Spread) Clock (Spread)

What this indicator does Clock (Spread).mq5 is a MetaTrader 5 chart indicator that displays a small text label in the corner of the chart showing: Countdown timer until the current candle closes (in HH:MM:SS or MM:SS format, depending on timeframe) Current spread (Ask − Bid, in points), shown in parentheses next to the timer