Using an array with 2 data series

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

Using an array with 2 data series

Postby champski » 09 Sep 2011

Hi,

I am trying to create a system that uses 2 data series and uses IOG.
i.e 10 minute (data1) and 5 minute (data2).
My signal will calculate values, based on a formula, at every tick on the 10 minute bar.

What I would like to do is be able to store the value at every TICK for the entire duration of the 10 minute bar and also be able to access the data mainly for this purpose - to see what the last TICK's value was on the close of the last 5 minute bar.

I think I would only need a rolling 2 bar history. Therefore, data that is older than 2 bars would be reset (expire).

I think what I'm looking for is an array with a loop.

Cheers
Champski

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Using an array with 2 data series

Postby furytrader » 09 Sep 2011

Without getting into too much detail here, I always thought it was preferred, from a programming perspective, that you have data1 be the shorter time period (5 min) and data2 be the longer time period (10 min). You can also always recreate the data from a 10 minute period bar using 5 minute period bar data, so you may not even need to have two data streams.

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

Re: Using an array with 2 data series

Postby TJ » 09 Sep 2011

Hi,

I am trying to create a system that uses 2 data series and uses IOG.
i.e 10 minute (data1) and 5 minute (data2).
My signal will calculate values, based on a formula, at every tick on the 10 minute bar.

What I would like to do is be able to store the value at every TICK for the entire duration of the 10 minute bar and also be able to access the data mainly for this purpose - to see what the last TICK's value was on the close of the last 5 minute bar.

I think I would only need a rolling 2 bar history. Therefore, data that is older than 2 bars would be reset (expire).

I think what I'm looking for is an array with a loop.

Cheers
Champski
how many cells do you think you would need for this array?

champski
Posts: 71
Joined: 28 Jun 2011
Has thanked: 20 times
Been thanked: 1 time

Re: Using an array with 2 data series

Postby champski » 10 Sep 2011

Hi TJ,

I'm not really sure what you mean by "how many cells do you think you would need for this array?". I would like to store info at every tick then reference it later.

Cheers
Champski

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

Re: Using an array with 2 data series

Postby TJ » 10 Sep 2011

Hi TJ,

I'm not really sure what you mean by "how many cells do you think you would need for this array?". I would like to store info at every tick then reference it later.

Cheers
Champski
this image might help:

Image

champski
Posts: 71
Joined: 28 Jun 2011
Has thanked: 20 times
Been thanked: 1 time

Re: Using an array with 2 data series

Postby champski » 10 Sep 2011

TJ,

I'm assuming the exact number of cells can not be predetermined as the number of ticks per bar will vary from one bar to another. (I think this means it needs to be a dynamic array???)
At every TICK (of the lower timeframe bar) I would like to be able to reference 1. the current close and 2. the current value of 'myvariable'. Therefore, I'm assuming the array would need 2 columns and an infinite number of rows per bar.
(NB. The value of 'Myvariable' changes every tick.)

I would then like to look back to a previous bar on a lower time frame and extract info such as;
1. tell me the value of 'myvariable' x number of ticks before the close of that bar.
2. tell me the average of 'myvariable' for the last x number of ticks before the close of that bar.

The idea behind the array is that it will give info with greater depth than just referencing the value of the last bar's close like this ;

Code: Select all


intrabarordergeneration = true
var: intrabarpersist myvariable(0)

myvariable = (close data2 - close[1] data2) * .5
Hi furytrader, thanks for your reply. I agree with what you are saying but I am having troubles creating my strategy by using the lower timeframe as the primary and am trying to create a workaround.

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

Re: Using an array with 2 data series

Postby TJ » 10 Sep 2011

TJ,

I'm assuming the exact number of cells can not be predetermined as the number of ticks per bar will vary from one bar to another. (I think this means it needs to be a dynamic array???)
At every TICK (of the lower timeframe bar) I would like to be able to reference 1. the current close and 2. the current value of 'myvariable'. Therefore, I'm assuming the array would need 2 columns and an infinite number of rows per bar.
(NB. The value of 'Myvariable' changes every tick.)

I would then like to look back to a previous bar on a lower time frame and extract info such as;
1. tell me the value of 'myvariable' x number of ticks before the close of that bar.
2. tell me the average of 'myvariable' for the last x number of ticks before the close of that bar.

The idea behind the array is that it will give info with greater depth than just referencing the value of the last bar's close like this ;

Code: Select all


intrabarordergeneration = true
var: intrabarpersist myvariable(0)

myvariable = (close data2 - close[1] data2) * .5
Hi furytrader, thanks for your reply. I agree with what you are saying but I am having troubles creating my strategy by using the lower timeframe as the primary and am trying to create a workaround.
dynamic array can only have ONE column.

champski
Posts: 71
Joined: 28 Jun 2011
Has thanked: 20 times
Been thanked: 1 time

Re: Using an array with 2 data series

Postby champski » 10 Sep 2011

If I'm limited to one column I would like that column to include the values for 'myvariable' at every tick.

How can I do it?

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

Re: Using an array with 2 data series

Postby TJ » 11 Sep 2011

If I'm limited to one column I would like that column to include the values for 'myvariable' at every tick.

How can I do it?
EasyLanguage Essentials Programmers Guide
Dynamic Arrays.... pg 42

EasyLanguage Reference Guide
CHAPTER 2 - The Basic EasyLanguage Elements
Understanding Arrays.... pg 41

https://www.multicharts.com/multicharts ... mentation/


Return to “MultiCharts”