{"id":3968,"date":"2023-06-30T13:15:10","date_gmt":"2023-06-30T11:15:10","guid":{"rendered":"https:\/\/cplugin.com\/?post_type=docs&#038;p=3968"},"modified":"2026-04-01T12:49:53","modified_gmt":"2026-04-01T10:49:53","password":"","slug":"compress-mt4-database","status":"publish","type":"docs","link":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/","title":{"rendered":"Compress MT4 database"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Brief<\/h2>\n\n\n\n<p>This is a tool to compress overgrown&nbsp;<em>orders.dat<\/em>&nbsp;file in place.<\/p>\n\n\n\n<p>It has few modes:<br>- remove orphaned orders (where login equals to zero);<br>- remove expired pending orders;<br>- aggregate closed orders profit;<br>- aggregate balance orders profit;<br>- aggregate expired (on current date) credit operations profit.<\/p>\n\n\n\n<p>It reads the file directly from disk and writes a compressed database back to disk. By default, it will make a backup of the original database. The tool uses&nbsp;<em>users.dat<\/em>&nbsp;database to perform double check its algorithms with relevant users' balances twice: on start and at the end.<\/p>\n\n\n\n<p>It needs MT4 server to be stopped, to unlock database files to let the app read and write them.<\/p>\n\n\n\n<p>Be aware, orders will be physically deleted from the database to reduce its size. Never delete backups until you are 100% sure you don't need them. Or else, you will not be able to rewind one step back and will need to take standard MT4 daily backups.<\/p>\n\n\n\n<p>There is an option to specify user groups by using&nbsp;<em><code>-groups<\/code><\/em> parameter with corresponding regular expression. Same option (<code>-logins<\/code>) available for logins.<\/p>\n\n\n\n<p>Files can be downloaded from our website: <a href=\"http:\/\/nuget.cplugin.com\/feeds\/apps\/CPlugin.Tools.CompressMT4DB\/versions\">http:\/\/nuget.cplugin.com\/feeds\/apps\/CPlugin.Tools.CompressMT4DB\/versions<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"CompressMT4ordersdatabase-Licensing\">Licensing<\/h2>\n\n\n\n<p>The license grants usage of the tool on a single computer.<\/p>\n\n\n\n<p>But, even <strong>without a license, the program will run in read-only mode to calculate and demonstrate a possible result<\/strong>. You are welcome to try without worrying about your files consistency and to<strong> estimate outcomes in your environment before purchase<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"CompressMT4ordersdatabase-Quickstart\">Quick start<\/h2>\n\n\n\n<p>To try out, how lesser your database might become after tool you can run it in read-only mode and do not specify&nbsp;<em>starting<\/em>&nbsp;and\/or&nbsp;<em>ending<\/em>&nbsp;date. But you have to specify explicitly each mode you are going to use.<\/p>\n\n\n\n<p>CPlugin.CompressMT4DB.exe -orders=c:\\metatrader4\\bases\\orders.dat -users=c:\\metatrader4\\bases\\users.dat -balance -closed -credit -orphaned -pending<\/p>\n\n\n\n<p>Whenever you satisfied with results you can run in read\/write mode by specifying&nbsp;<em>-go<\/em>&nbsp;flag.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"CompressMT4ordersdatabase-Usage:\">Usage:<\/h2>\n\n\n\n<p><strong>example of included help by running app with '-?' parameter<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Utility to compress orders.dat                                                      \n -?                : This help                                                      \n -go               : permit tool make its job, otherwise read-only mode will be used\n -orders=&lt;value&gt;   : full path to 'orders.dat' file                                 \n                     Type:System.String, Default value:'orders.dat'                  \n -users=&lt;value&gt;    : full path to 'users.dat' file                                  \n                     Type:System.String, Default value:'users.dat'                   \n -nobackup         : do NOT backup current file                                     \n -balance          : compress balance trades                                        \n -closed           : compress closed trades                                         \n -credit           : compress credit trades                                         \n -orphaned         : delete orphaned trades                                         \n -pending          : delete expired pending orders                                  \n -groups=&lt;value&gt;   : user groups to proceed (MQ mask)                                           \n                     Type:System.String, Default value:'*'                                      \n -logins=&lt;value&gt;   : user logins to proceed (MQ mask)                                           \n                     Type:System.String, Default value:'*'\n -starting=&lt;value&gt; : starting date                                                  \n                     Type:System.String, Default value:'01.01.0001'                  \n -ending=&lt;value&gt;   : ending date                                                    \n                     Type:System.String, Default value:'31.12.9999'<\/code><\/pre>\n\n\n\n<p>It uses formula of&nbsp;<code>[starting, ending)<\/code>&nbsp;way for looking a time being within range or not.<\/p>\n\n\n\n<p>Also, spaces not allowed in parameters. So `starting` and `ending` field could only contain a date.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Brief This is a tool to compress overgrown&nbsp;orders.dat&nbsp;file in place. It has few modes:- remove orphaned orders (where login equals to zero);- remove expired pending orders;- aggregate closed orders profit;- aggregate balance orders profit;- aggregate expired (on current date) credit operations profit. It reads the file directly from disk and writes a compressed database back [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"doc_category":[87],"doc_tag":[],"class_list":["post-3968","docs","type-docs","status-publish","hentry","doc_category-apps"],"year_month":"2026-06","word_count":532,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Vladislav Sorokin","author_nicename":"cplugin","author_url":"https:\/\/cplugin.com\/blog\/author\/cplugin\/"},"doc_category_info":[{"term_name":"Standalone Apps","term_url":"https:\/\/cplugin.com\/docs-category\/apps\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Compress MT4 Database \u2013 Optimize Performance &amp; Storage<\/title>\n<meta name=\"description\" content=\"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Compress MT4 Database \u2013 Optimize Performance &amp; Storage\" \/>\n<meta property=\"og:description\" content=\"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/\" \/>\n<meta property=\"og:site_name\" content=\"CPlugin\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cplugin\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-01T10:49:53+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@CPlugin_com\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/\",\"url\":\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/\",\"name\":\"Compress MT4 Database \u2013 Optimize Performance & Storage\",\"isPartOf\":{\"@id\":\"https:\/\/cplugin.com\/#website\"},\"datePublished\":\"2023-06-30T11:15:10+00:00\",\"dateModified\":\"2026-04-01T10:49:53+00:00\",\"description\":\"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.\",\"breadcrumb\":{\"@id\":\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cplugin.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Docs\",\"item\":\"https:\/\/cplugin.com\/wiki\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Compress MT4 database\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cplugin.com\/#website\",\"url\":\"https:\/\/cplugin.com\/\",\"name\":\"CPlugin\",\"description\":\"CPlugin offers software and services to Forex brokers who use MetaQuotes MetaTrader 4 and 5 which are most advanced and reliable trading platforms.\",\"publisher\":{\"@id\":\"https:\/\/cplugin.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cplugin.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/cplugin.com\/#organization\",\"name\":\"CPlugin Ltd.\",\"url\":\"https:\/\/cplugin.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cplugin.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.cplugin.com\/wp-content\/uploads\/2021\/07\/CPlugin-logo-1.png\",\"contentUrl\":\"https:\/\/www.cplugin.com\/wp-content\/uploads\/2021\/07\/CPlugin-logo-1.png\",\"width\":1823,\"height\":677,\"caption\":\"CPlugin Ltd.\"},\"image\":{\"@id\":\"https:\/\/cplugin.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/cplugin\",\"https:\/\/x.com\/CPlugin_com\",\"https:\/\/www.linkedin.com\/company\/cplugin\",\"https:\/\/www.youtube.com\/c\/CPlugin_com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Compress MT4 Database \u2013 Optimize Performance & Storage","description":"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/","og_locale":"en_US","og_type":"article","og_title":"Compress MT4 Database \u2013 Optimize Performance & Storage","og_description":"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.","og_url":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/","og_site_name":"CPlugin","article_publisher":"https:\/\/www.facebook.com\/cplugin","article_modified_time":"2026-04-01T10:49:53+00:00","twitter_card":"summary_large_image","twitter_site":"@CPlugin_com","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/","url":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/","name":"Compress MT4 Database \u2013 Optimize Performance & Storage","isPartOf":{"@id":"https:\/\/cplugin.com\/#website"},"datePublished":"2023-06-30T11:15:10+00:00","dateModified":"2026-04-01T10:49:53+00:00","description":"Learn how to compress your MT4 database to save storage, improve platform speed, and ensure smooth trading operations for better efficiency and reliability.","breadcrumb":{"@id":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cplugin.com\/docs\/apps\/compress-mt4-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cplugin.com\/"},{"@type":"ListItem","position":2,"name":"Docs","item":"https:\/\/cplugin.com\/wiki\/"},{"@type":"ListItem","position":3,"name":"Compress MT4 database"}]},{"@type":"WebSite","@id":"https:\/\/cplugin.com\/#website","url":"https:\/\/cplugin.com\/","name":"CPlugin","description":"CPlugin offers software and services to Forex brokers who use MetaQuotes MetaTrader 4 and 5 which are most advanced and reliable trading platforms.","publisher":{"@id":"https:\/\/cplugin.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cplugin.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/cplugin.com\/#organization","name":"CPlugin Ltd.","url":"https:\/\/cplugin.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cplugin.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.cplugin.com\/wp-content\/uploads\/2021\/07\/CPlugin-logo-1.png","contentUrl":"https:\/\/www.cplugin.com\/wp-content\/uploads\/2021\/07\/CPlugin-logo-1.png","width":1823,"height":677,"caption":"CPlugin Ltd."},"image":{"@id":"https:\/\/cplugin.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/cplugin","https:\/\/x.com\/CPlugin_com","https:\/\/www.linkedin.com\/company\/cplugin","https:\/\/www.youtube.com\/c\/CPlugin_com"]}]}},"_links":{"self":[{"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/docs\/3968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/comments?post=3968"}],"version-history":[{"count":5,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/docs\/3968\/revisions"}],"predecessor-version":[{"id":4313,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/docs\/3968\/revisions\/4313"}],"wp:attachment":[{"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/media?parent=3968"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/doc_category?post=3968"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/cplugin.com\/wp-json\/wp\/v2\/doc_tag?post=3968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}