Update of Global Variable between one signal and Money Management signal need to be renamed to happened ?

Questions about MultiCharts and user contributed studies.
User avatar
strelow
Posts: 73
Joined: 20 Dec 2019
Location: Brazil-SP
Has thanked: 13 times
Been thanked: 3 times

Update of Global Variable between one signal and Money Management signal need to be renamed to happened ?

Postby strelow » 30 Dec 2019

Hello Guys Happy new Year for all.

I don’t know why for me refresh a correct value from a global variable declared in a signal as a “GVSetNamedDouble” to read the correct value inside Money Management signal as a “GVGetNamedDouble” I need to change the name of “Set” for another name to works.

My procedure to happen the update :

Signal “A” : Signal Buy :
GV_Status_Dinheiro[1,0]= GVSetNamedDouble( GetSymbolName+"PCR_Close", Close ) ;
GV_Status_Dinheiro[2,0]= GVSetNamedDouble( GetSymbolName+"PCR_Hilo_Trailing_Stops", Hilo_Trailing_Stops ) ;
Signal “B” Management Money : “Portifolio Controle Risco 3”:

Code: Select all

for idx = 0 to portfolioStrategies-1 begin GV_Status_Dinheiro[1,idx]=GVGetNamedDouble(Name_Bovespa_Array_Sorted[idx]+"PCR_Close",99); GV_Status_Dinheiro[2,idx]=GVGetNamedDouble(Name_Bovespa_Array_Sorted[idx]+"PCR_Hilo_Trailing_Stops",99); end;
1-compile both files and run inside Portfolio Trader a backtesting

Image


2-change GV names in Signal “A”
GetSymbolName+"PCR_Close to PCR_NEW_Close
And PCR_Hilo_Trailing_Stops to PCR_NEW_Hilo_Trailing_Stops.

3-compile signal“A” again and run inside Portfolio Trader a new backtesting
After that all GV values inside signal“A” are correct in signal ”B” Money Management
Do you how to make this works without this procedure ? It look like the value only go to other side after we turn off the connection names between signals
There is any limitation to use GV between signals in backtesting procedure?
Attachments
PortfofioSetting.PNG
(45 KiB) Not downloaded yet

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: Update of Global Variable between one signal and Money Management signal need to be renamed to happened ?

Postby Svetlana MultiCharts » 10 Jan 2020

Hello, strelow,

Let me start with general information about Global Variables.
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.
From MultiCharts, the Global Variables functionality is accessed by PowerLanguage functions.
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.
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).

If you already created GVSetNamedDouble for a variable, then its value stays in the memory till GlobalVariable.dll is no longer used (the dll shall unload from all processes which use it).

Also there is an option to reset all values by calling GVResetAllNmdDbls function.

Zheka
Posts: 223
Joined: 13 Jan 2016
Has thanked: 8 times
Been thanked: 53 times

Re: Update of Global Variable between one signal and Money Management signal need to be renamed to happened ?

Postby Zheka » 13 Jan 2020

Why not use:
- pmm_set_global_named..
- pmm_set_my_named_
- pmm_set_strategy_named_

...and avoid using GVs altogether?


Return to “MultiCharts”