×

Sign up and get MultiCharts free

Use its powerful simulation mode with data included out of the box. Just fill out the form and start honing your trading skills with a few clicks.

Changes - MultiCharts

Changes

Jump to navigation Jump to search

Global Variables

98 bytes added, 13:22, 3 May 2023
Global Variables is an external .dll file that can be used to pass values between strategies on separate charts and third party applications.
The information is stored in a shared memory space. External processes can access the data in the memory for further operations.<br>When a customer uses Global Variables it is important to determine the read-write action time because the actions are performed in the script calculation.<br>
<br>
Global Variables work between different MultiCharts processes of the same bitness if they use the same GlobalVariable.dll (that is stored in the same place).
<br>MultiCharts .NET 32bit and MultiCharts 32bit
<br>MultiCharts .NET 64bit and MultiCharts 64bit
 
== Example ==
From MultiCharts, the Global Variables functionality is accessed by PowerLanguage functions:
AccuracySetNamedInt</syntaxhighlight>
All global variables use the same principle – it is required to specify the name that is attached to a value to get this value.<br>
The second parameter defines the error code that the function will return.<br><syntaxhighlight>value1 = AccuracyGetNamedDouble("Double_VariableName", -1);value2 = AccuracyGetNamedInt("Int_VariableName", -1);</syntaxhighlight>
In order to remember a value, one needs to assign a name and associate the value with this name:<br>
<syntaxhighlight>AccuracySetNamedDouble("Double_VariableName", 0.05);
AccuracySetNamedInt("Int_VariableName", 50);</syntaxhighlight>  
== Additional info ==
* our discussion forum:
Global variables can be used in backtesting only in Portfolio Trader, for more info check [[Spread_and_Pair_Trading#Pair_Trading_in_Backtesting|'''this page''']].
[[Category:FAQPowerLanguage]]

Navigation menu