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

SharedVar is designed to be middleware between different platforms or charts. SV can be used as Key/Value Storage for different type of variables. You can read & write from any platform from central location. You can exchange data between platforms and charts.Data is persistent while SharedVar Server application is running.

Description

Read & Write from any platform to a centralized database like key/value storage. This software is specially designed for Trader and Quants´ needs. You can sort your data in different Realms to keep things tidy.

Features

  • Compatible with TradeStation, MetaTrader4, MetaTrader5, NinjaTrader, MathLab, MultiCharts, MultiCharts.NET, C# and many other clients
  • Support for string,integer,boolean,double variable types
  • Fast and lightweight
  • Optimised for speed & Financial Market
  • Multithread safe
  • Ongoing maintenance from skilled team
  • Unlimited number of Variables & Realms
  • Variable watch with SharedVar Server Application
  • Debugging with Microsoft DbgView
  • Demonstration & Study Videos to get started

Compatibility

  • MetaTrader4 all builds (including new releases)
  • MetaTrader5 all builds (including new releases)
  • Tested with TradeStation 8.x/9.x, and will be compatible with all upcoming versions
  • NinjaTrader
  • MultiCharts 32/64bit
  • MultiCharts.NET 32/64bit
  • Tested with C# and C++
  • In fact SharedVar is compatible with every client application which can communicate with DLL files

Screenshoots

Video Demonstration

Metatrader related Videos

Tradestation related Videos

Generic Demonstration

SharedVar Server App

SharedVar has a server application as middleware. This application is designed to be a debugging instance at same time. You can view all variables real-time, edit & remove them manually. Keep this application running in order to work with SharedVar DLL files. Stored Key/Value pairs are persistent until SharedVar Server App has been stopped.

Hint: You can call svServerRunning to determine whether Server Application is already running from any client. If it is not running use svServerStart to start it.

Choosing DLL

Its essential that you choose right DLL to use. We have prepared 4 different DLL versions with same functionality. Main difference is a) Platform (32bit or 64bit) and b) String Handling (Unicode or Ansi). You will need to know which DLL is required in order to work with your software. Here is an overview about delivered DLL files and their Usage:

FilenamePlatformStringUsage
SharedVar-a32.dll 32 bit Ansi Metatrader4 Build < 600, Tradestation 8.x, NinjaTrader 32bit, Tradestation 9.x, other 32bit Ansi clients
SharedVar-a64.dll 64 bit Ansi Multicharts 64bit, Multichars.NET 64bit, NinjaTrader 64bit, other 64bit Ansi clients
SharedVar-w32.dll 32 bit Unicode Metatrader4 Build 600+, other clients with 32bit and Unicode string handling
SharedVar-w64.dll 64 bit Unicode Other clients with 64bit Unicode

License

SharedVar is FREEWARE. You can use it with unlimited number of computers or/and deploy it with other applications.

Installation

Download SharedVar-setup.exe and install it. You will have to run SharedVar Server and keep it running. Then you can use included .DLL files to have access from different clients. Inside your installation folder, you will find Resources\ folder, you will find examples, documentation and dll files. We have automatically deployed .dll files into %windir% and Resources\ folder for your convenience

Understand Realms

In order to seperate key/value pairs into different sections you can send any variable to seperate realms. Realms are kind of table-name inside a big database. As example: you can store EURUSD Data into "EURUSD" Realm and USDJPY into "USDJPY" Realm. Realms is designed to sort your data in logical sections.

Understand Types

ShareVar stores everything in strings in backend. For example you can store "name"=>"john" and try to read it with svGetInt("name") this will return 0 because "john" cannot be converted to integer. Lets say you use svSetString(Link,"x","923"), this can be read with svGetInteger(Link,"x") as integer or svGetDouble(Link,"x") as double. Internally there is no automatic type tracking. Everything is stored as string but converted back to requested type. This information might be important to know.

Parameters

We have designed SharedVar with different parameters. Use /hide to start Server hidden. Server will still start but in background. Use /systray will automatically minimize Server to systray. You cannot start server parameterized from svServerStart command. These parameters are useful by deploying or installing on client computers.

Core Functions

int svInit(string Realm)

Call this function once per Realm in init section of your trading platform. svInit will return you a Handle, this Handle will be used from other functions. A valid handle is >=0, please make sure that you check return code of this function. Handles >=0 are valid. You can open different Handles from same code, you just need to use corresponding Handles with following functions.

string svVersion()

Returns version of running SharedVar Server. Use this function to make sure that a specific version is required in your code.

int GMTUnixTime()
int LocalUnixTime()

Returns GMT/Local Time in UnixTime format (integer) related to current computers clock. Important: If current computers clock is off, then return value will also be off. These functions are put for compatibility reasons, some platforms does not have proper unixtime date support.

string svMD5(string Value)
int svCRC32(string Value)

Hashing functions, they can be sometimes useful.

Server Management

You need to run SharedVar Server in background as database. SharedVar DLL has also functions to manage the server and start it on-demand

bool svServerRunning()

Determines if Server is already running, it will return false if not.

string svServerPath()

Returns Path to last known SharedVar Server. Warning : This path will return empty if Server was never started on this computer. You need to start Server at least once manually, so svServerPath returns valid Path.

bool svServerStart()

Will try to start Server from Client. Please read warning inside svServerPath description, this warning is also valid for this function.

Variable Get & Set

bool svExists(int Handle,string Name)

Returns if a variable with given Name exists in Realm

bool svSetString(int Handle,string Name,string Value)
bool svSetValue(int Handle,string Name,double Value)
bool svSetBool(int Handle,string Name,bool Value)

Functions are used to set different type of variables in database. Integer/Double types are using svSetValue together.

Under certain conditions this function might return false. It indicates an error. We recommend to check return values and re-send it. For example: SharedVar Server might be stopped from user while you try to read or write.

bool svIncValue(int Handle,string Name,double IncBy)

Use this function to incremement/decrement existing value by IncBy value. This function is much faster than Reading, Evaluating then Writing. This is single command to make an increment/decrement operation on Server. If content of variable isnt a double/integer, it will be set to 0.00 and +-IncBy value. Upon execution every variable gets numerical content.

bool svGetBool(int Handle,string Name)
double svGetDouble (int Handle,string Name)
int svGetInt (int Handle,string Name)
string svGetString (int Handle,string Name)

Functions are used to read from given Handle and Variable Name

Under certain conditions this function might return false. It indicates an error. We recommend to check return values and re-send it. For example: SharedVar Server might be stopped from user while you try to read or write.

int svUpdated(int Handle,string Name)
int svCreated(int Handle,string Name)

Every variable has Create and Update TimeStamp. These functions return TimeStamp in UnixTime format.

bool svRemoveAll(int Handle)
bool svRemovePrefix(int Handle,string Prefix)

These functions are responsible to Delete either All or Variables with given Prefix.svRemoveAll will remove all variables and svRemovePrefix will only delete variables from Realm with specific Prefix string.

Enumeration Realm & Variables

Sometimes you want to enumerate realms and variables in given realm and read values programmatically. Use these functions for that purphose.

int svRealmCount()
string svRealmName(int Index)

Returns number of currently available Realms. svRealmName is responsible to read the name from given Index.

int svVarCount(int Handle)
string svVarName(int Handle,int Index)

Returns number of currently available Variables in given Realm (through Handle). svVarName is responsible to read the name from given Index.

Demo Application

We have prepared a demo application to test common functions of SharedVar. You can find this Application inside Resources\ folder.

Video of demo application:

Debugging

This is a topic for advanced developers: SharedVar-*.dll sends so called Trace debug output to Windows debugging system. You can use DebugView tool from Microsoft to capture messages sent from SharedVar-*.dll. You will probably see other messages from other applications too, you can then filter messages inside that tool to capture only from one specific application.

Importing functions from DLL

You have to import functions from .dll file into your client. We include a Cheatsheet into Resources/ folder. You can use this PDF file to understand functions better

Metatrader4

SharedVar.mqh is inside Resources/Metatrader4 folder, you have to put it into [datafolder]\MQL4\Include\ in order to install.

Tradestation

We include External: definitions inside Resources/Tradestation/Imports.txt file. You can open this file with editor and paste required functions into your EasyLanguage code

Multicharts

We include External: definitions inside Resources/Multicharts/Imports32.txt and Imports64.txt file depending on your Multicharts edition. You can open this file with editor and paste required functions into your Multichart code

Ninjatrader

Ninjatrader is using c# style DllImport to define DLL functions into NinjaScript. Open Resources/Ninjatrader/Import32.txt to find 32bit imports, accordingly Resources/Ninjatrader/Import64.txt is for 64bit version of Ninjatrader. You can then copy & paste required code into your NinjaScript

Other Applications

Importing DLL function is language specific. SharedVar is able to work with any other application same way. Consult support of your software to find out how you can import DLL functions. If you have imports from any other application, please send them to us, so we can publish.

Installing DLL

Normally every client (application) has own DLL requirements. For example Metatrader requires DLL inside [datafolder]\MQL4\Libraries, Tradestation inside [installfolder]\Program, [ProgramFiles]\TS Support\MultiChartsXX, you could put DLL files into these folders but easier: put dll files inside your main Windows folder such as c:\Windows, all clients will be able to access to SharedVar dll files. Our setup software automatically publishes 4 versions of dll into your Windows folder automatically. Theoretically you don´t need to install anything manually, but depending on client application, DLL folder might be required on different location, in such cases its good that you know about this info.

Deploy DLL

SharedVar is ready to be installed on multiple computers automatically. You can check parameters for further information. All you need to do is to embed DLL and SharedVar.exe file with your products, It is not required to be installed through native installer, all files are concepted to be slim and easy to transport.

Downloads

Version Description Download
1.2.3
  • Fixed: MemoryLeak in svGetString function
Download Version 1.2.3
1.2.0
  • Release Version
Download Version 1.2.0