Account Type Detector
This header deliberately separates what MQL4 tells you FOR CERTAIN about an account from what can only ever be guessed. ACCOUNT_TRADE_MODE is a definitive, broker-reported fact - demo, contest, or real - and AccountTypeDetectTradeMode() reports it as exactly that, nothing more and nothing less. "Is this a prop-firm challenge account" has no dedicated MQL4 field anywhere. There is no ACCOUNT_IS_PROP_FIRM constant, and there never will be, because prop firms are ordinary brokers or white-label arrangements from the platform's point of view - the distinction is entirely a business-model fact the terminal has no way to know. This library infers it, if at all, from circumstantial signals that also occur on ordinary accounts: the server name or account company string containing a keyword from an editable list (ftmo, prop, funded, challenge, evaluation, and similar terms), and a starting balance that lands on an exact round thousand (1000, 10000, 25000, 100000 and so on) - common on firm-funded accounts and comparatively rare on organically deposited retail ones, but far from proof either way. Two independent matching signals are reported as PROP_FIRM_LIKELIHOOD_LIKELY, one as POSSIBLE, none as NONE - a graded, honest confidence level rather than a flat yes/no. Every function and struct field name in this library keeps the certain trade-mode result and the heuristic prop-firm guess visibly separate, specifically so calling code cannot mistake the guess for a fact by accident. Notes and limitations - The prop-firm result is a HEURISTIC GUESS, never a certainty. It can be wrong in both directions: a genuine prop-firm account with no matching server keyword and a non-round balance reports NONE, and an ordinary retail account that happens to be deposited at an exact round thousand with a coincidentally matching server name can report POSSIBLE or LIKELY. Do not gate anything safety-critical purely on this field. - The keyword list is a plain substring match, case-insensitive - a broker whose ordinary name happens to contain one of the listed keywords (e.g. a server literally named "...Challenge...") will match even though it is not a prop-firm account. - The round-balance signal only looks at the CURRENT balance at the moment AccountTypeDetect() runs - a balance that has since grown or shrunk away from a round number after the account was funded no longer matches, even on a genuine prop-firm account. - The demo/contest/real half (ACCOUNT_TRADE_MODE) is a real, certain, broker-reported fact with no heuristic component at all - it is included specifically so the two very different kinds of statement sit next to each other for comparison.
Script · MT4 · v1.0 · Free
About Account Type Detector
Account Type Detector is a script for MetaTrader 4. It has 1 setting, such as Extra keyword. MQL source code included.
Files in the download: AccountTypeDetector.mqh, AccountTypeDetector.txt, AccountTypeDetectorDemo.mq4.
Settings
| Setting | Default | What it does |
|---|---|---|
| Extra keyword | mycustomfirm | Extra prop-firm keyword to test alongside the built-in list |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: MT4 Script · MQL4 Source Code