• phone +1.954.4163300
  • time-img Mon.-Fri. 10:00-18:00 EST
English Germany Turkish

PermVar can persistently store basic types of data in the registry, such as strings, integers, doubles, and booleans. Reading and writing is easy with its one-touch command. No need for complicated frameworks. All you need is one file to use PermVar. It’s compatible with any application that uses DLL.

If you need a key/value storage similar to Permvar, try SharedVar. SharedVar is much faster, PermVar is designed to be persistent and slower. SharedVar is designed to be non-persistent, in memory but much faster. Depending on your needs you can decide for one of the products.


PermVar (PV) is an add-on that stores variables and their content within the registry. The registry is a sharable database, and every operation is flushed to the registry so that you can start reading after you write.

It has a simple key=>value model , somewhat similar to hashes and arrays found in many programming languages. You can create realms, otherwise known as namespaces that separate variables into different scopes, or use the same key for different realms. Although they won’t get overwritten, keys inside the same realm will.

Unfortunately, strategy development platforms such as TradeStation and MetaTrader don’t support communication among studies. PermVar, on the other hand, does. It can quickly store and read the same variables from other studies even from other software! You can use this add-on to share data between different charts and development platforms.


You can store strings, integers, and double types from a single application as well as read them from another (or the same) application in real time; for example, storing data from TradeStation and reading it in MetaTrader. Highlights include the following:

  • Single commands for easy handling
  • Compatible with TradeStation, MetaTrader4, MetaTrader5, NinjaTrader, and many others
  • Faster than any other global variable approach
  • Persistent data remains until deleted
  • Written in C++
  • Uses native API from Microsoft Registry to ensure compatibility with all versions of Windows
  • Real-time reading and writing as well as immediate flushing of all operations
  • Open and read more than one PermVar connection
  • Use realm to create multiple storages for the same variable
  • Can be as fast as your registry and your hard drive (speed depends on your system’s available resources)
  • Supports strings, integers, and double values (Bools and Arrays as wrappers)
  • Multithread safe
  • Free of charge FOREVER
  • Normal and Unicode string version available (Unicode version required for MetaTrader platforms 0640 and above)
  • Single command option to wipe realm and its variables/li>


  • MetaTrader4 supports all builds (including new releases)
  • Tested with TradeStation 8.x/9.x, and will be compatible with all upcoming versions
  • Tested with NinjaTrader
  • Tested with MultiCharts
  • Tested with C# and C++
  • Old and new versions are compatible with any language (require the ability to install DLL files for your platform).


This screenshoot shows how PermVar stores Data in registry

permvar screenshoot


This video demonstrates the power of PermVar’s inter-compatibility. We show how you can copy market data between TradeStation and MetaTrader.


If you want to store and archive the same key (e.g., MonthlyProfit) from different Expert Advisors, you’ll need to store the same key in different scopes. The scope of a variable is called realm, and realms are simply definable strings. What you need to do is call “PVInit” using a realm name. If you start PV with "permtest,” every variable will be collected under this key. To access the same variables, open PV again and use the same realm name. The following screenshot shows what a realm looks like.


PermVar is freeware. Use and re-distribute it however you want. You simply can’t modify the software in any way.

Installation & Demofiles

Installation may vary by application. DLL files must be placed in an application’s DLL include path or the Windows’ DLL include path; for example, the 64-bit shared library include path is %windir%\SysWOW64. In MetaTrader4 (builds 0600 and below), the library path is %MetaTrader4%\experts\libraries. In TradeStation, the include path is %TSPATH%\Program\

You may need to enable DLL execution because it's sometimes disabled by default (for security reasons). This tool was released as a DLL, so you’ll need to enable DLL Execution.


int PVinit(string Realm)

Functions require an operating handle. This one opens the realm and returns a handle to the database. If a realm doesn't exist, an empty one will be created. Returns “0” (and above) if successful.

int PVString(int Handle,str Key, str Content)
int PVValue(int Handle,str Key, int Value)
int PVDouble(int Handle,str Key, double Value)

These functions store variables according to a specific handle. Handles must be created with PVIinit first before any of these functions can be used. Key is the name of variable. Variables will automatically be overwritten. Returns “0” if successful.

str PVGetString(int Handle, str Key)
int PVGetValue(int Handle, str Key)
double PVGetDouble(int Handle, str Key)

These functions allow you to read a variable’s value. Assuming that the function already has an operating handle as well as a variable name key, the key’s value will be returned.

int PVWipe(str Realm)

This function wipes the realm. Be careful, though. It’ll also erase previously deleted variables. To maintain a clean environment, you may want to use this function only at the beginning of your study. No handle is required for this function. Returns “0” if successful.

int PVDel(int handle,string Key)

This function deletes keys (and value keys) within the realm

int PVCount(int handle)

Returns key amounts inside the open handle; for example, if you have twenty-five keys in your realm, it’ll return twenty-five. This function enumerates the keys OR ensures that you’ve created/deleted the precise amount of keys.

int PVDelPref(int handle, string prefix)

This function deletes all keys (prefix value pairs). This routine is asynchronous, meaning that it doesn't block the code but gradually deletes keys in the background. Depending on a key’s size, the variant known as PVWipe may be much faster—that is, if your goal is to remove every key with the prefix "" (i.e., empty string).

string PVGetKey(int handle, int keypos)

Use this function to enumerate keys. This function will return the name of a key within any given position via the keypos parameter.

int PVError()

Use this function to read the most recent error status. Returns “0” if successful.

int PVRelease(int handle)

To make PV multithread safe, use this function only after calling PVGetString(). It will also use the out-calling function. However, repeated use of this function will deplete memory; thus requiring a restart of the software. Nowadays, everything has to be multithread safe. If you don't call PVGetString(), you won’t need to use this extra function to release memory. Guard your application with tools like procexp32 from sysinternals, if you see memory leak use this function to release allocated memory from DLL. This function should return "0" by success.

int PVVersion()

This function returns an internal version of the PermVar add-on. You may use this function to differentiate between versions.

int UnixTime()

Returns GMT time in Unix format. Useful in situations that need to store timestamps.


Tradestation Demo #1

Metatrader4 Demo #1

Tradestation Demo #2

This code sends quotes (OHLC) from the last thirty bars to PermVar’s database. They can be read from applications such as MetaTrader. See the video for a demonstration. The following video was made for this particular code.

Metatrader Demo #2

This video demonstration uses the code on MetaTrader.

Metatrader Demo #3

C# Demo

c# wrapper example

Important : Unicode Version

Please note that MetaTrader builds >0550 require DLLs Unicode strings suppport. Beginning with version 3.1.1 we include a unicode version dll as permvar2.dll, a non-unicode version as permvar.dll and a 64bit version as permvar_64.dll.Please note: If you store strings in Unicode, you won’t be able to read strings in non-Unicode versions of PermVar (and vice versa)!

Use permvar.dll for Tradestation, Metatrader < 0550, Metatrader5
Use permvar2.dll for Metatrader Build > 0550
Use permvar_x64.dll for MultiCharts


Version Description Download
  • Metatrader Build > 0570 supported with permvar2.dll
  • Metatrader Build < 0570 supported with permvar.dll
  • 64bit version is available with permvar_x64.dll
  • Code Signed DLL Files included for better security
  • Release Candidate
Download v3.1.1
  • Hotfixes
  • Serious bugs solved
  • Stable version
Download v3.0.6
  • Optimized for newer versions of Windows
  • New functions implemented (i.e., PVDel,PVCount,PVDelPref and PVGetKey)
  • Stable Release version