BarInterval and data2  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
BS135
Posts: 11
Joined: 05 Aug 2012
Has thanked: 2 times

BarInterval and data2

Postby BS135 » 05 Aug 2012

I am trying to port my EL codes to MC.NET but I got some problems.

1. How to get the BarInterval in MC.NET?
2. How to access data of the second instrument? In EL we can use the keyword data2 e.g. value1 = Average(Highest(high,20),15) of data2

User avatar
JoshM
Posts: 2080
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1525 times
Been thanked: 1483 times
Contact:

Re: BarInterval and data2

Postby JoshM » 05 Aug 2012

BS135 wrote:1. How to get the BarInterval in MC.NET?

With

Code: Select all

Bars.Info.Resolution.Size


Accessing the second data series can be done with BarsOfData(). For example:

Code: Select all

            Output.WriteLine(string.Format("Close data1: {0}, close data2: {1}",
                Bars.Close.Value,
                BarsOfData(2).Close.Value));


Gives

Code: Select all

Close data1: 1,23794, close data2: 0,79157
Close data1: 1,23798, close data2: 0,79166
Close data1: 1,23784, close data2: 0,79154
Close data1: 1,23823, close data2: 0,79187
Close data1: 1,2386, close data2: 0,79195
Close data1: 1,23869, close data2: 0,79194
These users thanked the author JoshM for the post (total 2):
BS135Stan Bokov

User avatar
Henry MultiСharts
Posts: 8447
Joined: 25 Aug 2011
Has thanked: 1207 times
Been thanked: 2704 times

Re: BarInterval and data2  [SOLVED]

Postby Henry MultiСharts » 06 Aug 2012

BS135 wrote:I am trying to port my EL codes to MC.NET but I got some problems.

1. How to get the BarInterval in MC.NET?
2. How to access data of the second instrument? In EL we can use the keyword data2 e.g. value1 = Average(Highest(high,20),15) of data2


Hello BS135,
An equivalent to EL keyword "data2" in .Net is "(this, 2)".

Code: Select all

Average mAvg = new Average( this, 2 );
These users thanked the author Henry MultiСharts for the post (total 4):
TJBS135JoshMMidKnight


Return to “MultiCharts .NET”