Dual Instruments CountBars [SOLVED]
-
- Posts: 10
- Joined: 30 Jul 2012
- Has thanked: 7 times
Dual Instruments CountBars
Hi, I have plotted a 3 minute charts and below that a 500 contract chart. Obviously I get more bars plotting on data 2 on the contract chart. How would I count the number of bars that plot on data 2 between 3 minute bars on data1. I can get this data once the bar on the 3 minute has closed.
- Andrew MultiCharts
- Posts: 1587
- Joined: 11 Oct 2011
- Has thanked: 931 times
- Been thanked: 559 times
Re: Dual Instruments CountBars [SOLVED]
Hello tradebuster,
Here is a simple example:
Here is a simple example:
Code: Select all
Var: NumberOfBarsOfData2(0);
NumberOfBarsOfData2 = Symbol_CurrentBar of data2;
Difference = NumberOfBarsOfData2 - NumberOfBarsOfData2[1];
-
- Posts: 10
- Joined: 30 Jul 2012
- Has thanked: 7 times
Re: Dual Instruments CountBars
Thanks Andrew ... that was a lot easier than I thought! I spent hours going down this path:
If Barnumber Of Data2 > Barnumber of Data2[1] then Counter = 1 + Counter else
If BarNumber of Data1 = BarNumber of Data1[1] then Counter = 0;
I applied to data2 but it wouldn't reset my counter to 0 hoping it would read that from data1.
Thanks very much!
If Barnumber Of Data2 > Barnumber of Data2[1] then Counter = 1 + Counter else
If BarNumber of Data1 = BarNumber of Data1[1] then Counter = 0;
I applied to data2 but it wouldn't reset my counter to 0 hoping it would read that from data1.
Thanks very much!