How would I store the first bar of each session in an array for n previous days? I would think this should be possible without the sessions iterator. Here are some loops I've tried, some i haven't yet, but maybe you can give me an idea of what I'm doing wrong?
#region Relative Volume ================================================== ==============
if(Bars.IsFirstBarOfSessionByIndex(CurrentBar))
{counter++;} //---------------------------> Get total amount of days loaded on chart
Array.Resize(ref firstBarArr, counter);//-----------------------> Make room for new data
for(int i = 0; i < counter; i++)//-------------------------------------------------------------------------->This has been tested and returns the last index value of IsFirstBarOfSession
{
if(Bars.IsFirstBarOfSessionByIndex(CurrentBar))
{firstBarArr[i]=CurrentBar;}//--------------> Add each opening candle of day # to array
}
//Not Tested
//================================================== =========
foreach(int m in firstBarArr)
{
if(Bars.IsFirstBarOfSessionByIndex(CurrentBar))
{firstBarArr[m]=CurrentBar;}
}
//Not Tested
//================================================== =========
for(int e = 0; e < CurrentBar; e++){
for(int f = 0; f < counter; f++){
if(Bars.IsFirstBarOfSessionByIndex(e)){
firstBarArr[f]=e;}}}
//Not Tested
//================================================== =========
for(int e = 0; e < CurrentBar; e++){
foreach(int f in firstBarArr){
if(Bars.IsFirstBarOfSessionByIndex(e)){
firstBarArr[f]=e;}}}
//Not Tested
//================================================== =========
for(int e = 0; e < CurrentBar; e++){
if(Bars.IsFirstBarOfSessionByIndex(e)){
for(int f = 0; f < counter; f++){
firstBarArr[f]=e;}}}
Comment