Same named variables used in 2 signals on one workspace  [SOLVED]

Questions about MultiCharts and user contributed studies.
champski
Posts: 71
Joined: 28 Jun 2011
Has thanked: 20 times
Been thanked: 1 time

Same named variables used in 2 signals on one workspace

Postby champski » 27 Jun 2013

Hi,

I have a question which I hope I can get some help with.

- I have 2 signals running together on one workspace.
- They both use intrabarordergeneration=true
- they both use variables with the same names (most are declared with intrabarpersist).
- The 2 signals are mutually exclusive. i.e have no relationship with each other. One goes LONG on bullish signs and the other goes SHORT on bearish signs. They also share one account.

My questions is - Is there a potential issue with both signals using variables with the same name? i.e Will the first signal accidently use the value of a variable running in the 2nd signal?

Why don't I just separate them into their own individual workspaces? Because my broker (LMAX) has a restriction of how many accounts I can hold and I want to avoid opening another account.

Cheers
Champski

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Same named variables used in 2 signals on one workspace

Postby Andrew MultiCharts » 27 Jun 2013

Hello Champski,
Let me address my answers in the order:
- I have 2 signals running together on one workspace.
On 1 workspace, but on different charts or on 1 workspace and on 1 chart?
My questions is - Is there a potential issue with both signals using variables with the same name? i.e Will the first signal accidently use the value of a variable running in the 2nd signal?
The variables are available only within 1 script. Only global variables are available for multiple scripts at the same time.
Why don't I just separate them into their own individual workspaces? Because my broker (LMAX) has a restriction of how many accounts I can hold and I want to avoid opening another account.
The number of workspaces is in no connection to number of broker accounts.

andrei
Posts: 25
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: Same named variables used in 2 signals on one workspace

Postby andrei » 23 Aug 2013

Hi Henry,

I understand in MC.NET you don't have the notion of "Global Variables".
How can you exchange data between your charts or between your indicators (each referencing a different stream of data) in MC.NET?

Thx

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Same named variables used in 2 signals on one workspace

Postby Andrew MultiCharts » 11 Sep 2013

Hello Andrei,

Global Variables work the same way both in MC and in MC .NET.

Xyzzy
Posts: 162
Joined: 19 Mar 2011
Has thanked: 43 times
Been thanked: 79 times

Re: Same named variables used in 2 signals on one workspace  [SOLVED]

Postby Xyzzy » 11 Sep 2013

For clarification, the term "Global Variables" in MultiCharts refers to a particular method of sharing data between different signals/indicators. To do this, you need to use the Global Variables dll. More information here:

viewtopic.php?f=16&t=10094

Unless you are using Global Variables, all of the variables are local in scope to the particular signal or indicator in which they are declared, and won't be shared with other signals or indicators. E.g., a variable named XYZ in one signal won't conflict with another variable named XYZ in a different signal.

Also, the variables are private in scope, and aren't shared between different "copies" of the same signal or indicator. E.g., if you have two different charts that both use the same signal, they won't use the same variable -- instead, they will each have a private variable that is limited in scope to that particular chart/signal.


Return to “MultiCharts”