Exchange of data between Systems during Backtesting

Questions about MultiCharts and user contributed studies.
GuidoPa
Posts: 1
Joined: 28 Jan 2020

Exchange of data between Systems during Backtesting

Postby GuidoPa » 28 Jan 2020

Hello,

I have been trying to understand how to use ELCollections or Global Variables to exchange data from 2 different trading systems, but I haven't been able to figure it out yet..
A helping hand would be greatly appreciated.

I post here simplified version of what I'd need.

Let's say I have 2 Systems working on 2 different charts in the same workspace: TS1 and TS2 and I want to read a value in TS1 and pass it in TS2.

TS1:

Code: Select all

//TS1 var: MyVarSent(0); Buy next bar at market; setexitonclose; MyVarSent=netprofit;
TS2:

Code: Select all

//TS2 var: MyVarRecieved(0), MyShares(0); {"MyVarRecieved" should be the same value of "MyVarSent" in TS1 } MyShares = round(MyVarRecieved*0.01,0); Buy MyShares shares next bar at market; setexitonclose;
My questions are:
1- Is it possible to make it work something like this in backtesting mode and in live strategy mode?
2- If yes, could someone (more skilled than me :oops: ) please attach the missing part of the code or give me some step by step instructions on how to make it?
3- If no, would you have some alternative suggestion on how to reach my goal?

Many thanks for your help!

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

Re: Exchange of data between Systems during Backtesting

Postby Svetlana MultiCharts » 14 Feb 2020

Hello, GuidoPa,

To use Global Variables you need to place ElCollections.dll to the folder where MultiCharts is installed and import GV 2-2.ELD archive with studies in PowerLanguage Editor. Please refer to the article for more information:
https://www.multicharts.com/trading-sof ... _Variables

Then please create two signals:

Code: Select all

/TS1 Buy next bar at market;if (barnumber = 100) then begin sell next bar at market; end; GVSetNamedDouble("MyVarSent", netprofit);

Code: Select all

//TS2 var: MyVarRecieved(0); var: MyShares(0); MyVarRecieved = GVGetNamedDouble( "MyVarSent", 636); //error code 636 MyShares = round(MyVarRecieved, 0); Buy MyShares shares next bar at market; setexitonclose; Print(" TS2 = ", MyVarRecieved);
NetProfit from signal TS1 will be saved to the global variable "MyVarSent" with the help of the function GVSetNamedDouble("MyVarSent", netprofit);
TS2 signal can use this data with the help of the function MyVarRecieved = GVGetNamedDouble( "MyVarSent", 636);

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Exchange of data between Systems during Backtesting

Postby wilkinsw » 15 Feb 2020

Are you sure ELcollections.dll is needed for GVs?

Aren’t GVs already included and compiled on current versions of MC as standard?

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

Re: Exchange of data between Systems during Backtesting

Postby Svetlana MultiCharts » 21 Feb 2020

ELcollections.dll is a source external library that provides the required functions.

In MultiCharts, we added equivalents to those functions:
AccuracyGetNamedDouble
AccuracyGetNamedInt
AccuracySetNamedDouble
AccuracySetNamedInt

If you use the above prebuilt functions, then you do not need ELcollections.dll

wilkinsw
Posts: 662
Joined: 21 Apr 2013
Has thanked: 154 times
Been thanked: 104 times

Re: Exchange of data between Systems during Backtesting

Postby wilkinsw » 21 Feb 2020

I’ve been using GV variables (not the ones listed in your post) for years without the elcollections dll.

El collections are totally separate to GV variables

albevier
Posts: 24
Joined: 13 Nov 2005
Has thanked: 5 times
Been thanked: 3 times

Re: Exchange of data between Systems during Backtesting

Postby albevier » 30 Jul 2022

Are you sure ELcollections.dll is needed for GVs?

Aren’t GVs already included and compiled on current versions of MC as standard?
I'm picking up on an old post here but yes, I believe you are correct to say that GV does not have-to-have ELCollections added to MC for GV 2.2 to work -- I certainly don't see why it would. In any case, my latest desktop version of MC (downloaded a few days ago on 7/22/2022
does NOT have the GV 2.2 included.


Return to “MultiCharts”