Calculations across different times / data streams

Questions about MultiCharts and user contributed studies.
javamarket
Posts: 55
Joined: 10 Jul 2014
Has thanked: 10 times
Been thanked: 18 times

Calculations across different times / data streams

Postby javamarket » 20 Jul 2014

Calculations across different times / data streams

When I look at the calculations produced by any given function across a chart containing multiple data streams it seams inconsistent. This may be a known issue but I had difficulty finding any reference to it in the Bug Tracker or general forums. It may simply be a known condition and not a bug basis testing.

For example:

Chart 1: Data1 = ES 30min
Date Range of Data1 7/1/14 - 7/18/14

Chart 2: Data1 = ES 5min
Data2 = ES 30min (on subchart1 hidden)
MaxBarBack = 10
Date Range of Data1 7/1/14 - 7/18/14
Date Range of Data2 7/1/14 - 7/18/14
*****************
TestIndicatorOne:
-------------
value15 = Average(C, 9);
Print(NumToStr(value15,2));
-------------

Test One:
TestIndicatorOne on Chart 1 set MaxBarBack = 10
TestIndicatorOne on Chart 2 set MaxBarBack = 10, Base Study on Data2

The output across charts is identical as expected and the test considered passed.

****************
TestIndicatorTwo:
-------------
value15 = Average(C of Data2, 9);
Print(NumToStr(value15,2));
-------------

Test Two:
Remove TestIndicatorOne and replace with TestIndicatorTwo on Chart 2.
-
Test Two-A:
TestIndicatorTwo set MaxBarBack = 10, Base Study on Data2
Expectation:
When TestIndicatorTwo Base Study = Data2 the output should be identical to Test One / TestIndicatorOne output.
The output matches as expected and the test is considered passed.
-
Test Two-B:
TestIndicatorTwo set MaxBarBack = 10, Base Study on Data1
Expectation:
The indicator has a hard coded input of Data2 for calculation therefore the output should repeat in 6 count values because of the shorter 5min symbol on the chart the indicator is "Based On" this shorter period. Every 6th value in this example should be the same as Test One / TestIndicatorOne (30min / 5min = 6). I find this test fails and data points are missing when compared to the TestIndicatorOne data output.

To get every 6th element for comparison, I am using Excel and the following formula =INDEX($G$1:$G$3660,(ROW()-2)*6+6) where G is the column of output data and 3660 is the last entry line number. You many need to adjust the Row '-2' to the proper column depending on how you lay it out where it was effectively two columns to the left.

Once having each 6th element you can use any text comparison utility to quickly find the missing data.

******************
As a final step I recreated the above in TS.
When comparing MC to TS in this regard they were identical.

******************

This all stems from trying to create a strategy based identical to a fairly complex indicator. As the indicator can be set to Base Study on Data2 and a strategy cannot I've had to hard code the strategy to get input from Data2. Unfortunately because of the differences in the data some calculations are off by as much as 10% which has a fairly large impact. One way 'around' this with TS is the use of ADE however MC hasn't implemented int64 at this time making it unavailable for MC.

If anyone else has experienced this and has a work around I'd love to hear some approaches.

Many thanks ...

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Calculations across different times / data streams

Postby TJ » 20 Jul 2014



Return to “MultiCharts”