I am trying to add daily bars to my 1 minute strategy to calculate OHLC and rang of 5 days of the previous five days. Say for example CL 02-13. Also tried using 1440 as a minute bar.
Under Initialize();
//Add(PeriodType.Minute, 1440); Add(PeriodType.Day, 1);
PrintWithTimeStamp(Instrument.FullName+" Calculating OHLCR..."); Print(" OPEN 0 =" + Opens[1][0]+ " HIGH 0 =" + Highs[1][0]+ " LOW 0 =" + Lows[1][0] + " CLOSE 0 =" + Closes[1][0]+ " RANGE 0 =" + (Highs[1][0] - Lows[1][0])); Print(" OPEN 1 =" + Opens[1][1]+ " HIGH 1 =" + Highs[1][1]+ " LOW 1 =" + Lows[1][1] + " CLOSE 1 =" + Closes[1][1]+ " RANGE 1 =" + (Highs[1][1] - Lows[1][1])); Print(" OPEN 2 =" + Opens[1][2]+ " HIGH 2 =" + Highs[1][2]+ " LOW 2 =" + Lows[1][2] + " CLOSE 2 =" + Closes[1][2]+ " RANGE 2 =" + (Highs[1][2] - Lows[1][2])); Print(" OPEN 3 =" + Opens[1][3]+ " HIGH 3 =" + Highs[1][3]+ " LOW 3 =" + Lows[1][3] + " CLOSE 3 =" + Closes[1][3]+ " RANGE 3 =" + (Highs[1][3] - Lows[1][3])); Print(" OPEN 4 =" + Opens[1][4]+ " HIGH 4 =" + Highs[1][4]+ " LOW 4 =" + Lows[1][4] + " CLOSE 4 =" + Closes[1][4]+ " RANGE 4 =" + (Highs[1][4] - Lows[1][4])); Print(" OPEN 5 =" + Opens[1][5]+ " HIGH 5 =" + Highs[1][5]+ " LOW 5 =" + Lows[1][5] + " CLOSE 5 =" + Closes[1][5]+ " RANGE 5 =" + (Highs[1][5] - Lows[1][5]));
if (Historical) {//Print(Instrument.FullName+ " Running on Historical Data"); return;} if (CurrentBars[0] < BarsRequired) {Print(Instrument.FullName+" Getting Bars[0] Required"); return;} if (CurrentBars[1] < BarsRequired) {Print(Instrument.FullName+" Getting Bars[1] Required"); return;}
I have tried both IB and ZenFire data feeds but my script is stuck on getting required daily bars.
if (CurrentBars[1] < BarsRequired) {Print(Instrument.FullName+" Getting Bars[1] Required"); return;}
CL 02-13 Getting Bars[1] Required
CL 02-13 Getting Bars[1] Required
CL 02-13 Getting Bars[1] Required
Any help would be greatly appreciated!
thanks
Tariq
Comment