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:
This screenshoot shows how PermVar stores Data in registry
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 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.
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.
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.
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.
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.
This function deletes keys (and value keys) within the realm
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.
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).
Use this function to enumerate keys. This function will return the name of a key within any given position via the keypos parameter.
Use this function to read the most recent error status. Returns “0” if successful.
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.
This function returns an internal version of the PermVar add-on. You may use this function to differentiate between versions.
Returns GMT time in Unix format. Useful in situations that need to store timestamps.
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.
This video demonstration uses the code on MetaTrader.
c# wrapper example
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 |
---|---|---|
3.1.1 |
|
Download v3.1.1 |
3.0.6 |
|
Download v3.0.6 |
3.0.5 |
|
- |
0.4.1 |
|
- |