i am a medium level programmer but a very good experience trader in charting and price action analysis. Last few months i have been trying to use mql4 to automate my process. i was successful in creating a marker that show me when my edge is present.

right now i want take that to next level in  quantconnect.

My problem here is how to tell the built in c++ what  a candle bar is,  like i did in my mql4 program.

body = Open - Close;
bull = Open > Close;
bear = Open < Close;

how can i access these arrays and use them interchangeably to build my strategy.

how can i know the total bars that backtesting would cover in the quantconnect

Below is an  example of what i would build here.

int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
{

int limit = MathMax (rates_total - prev_calculated, 2);
for (int i=0; i<limit; i++)

if (Close[i+14]-Open[i+14]<0 //bear
&& Close[i+13]-Open[i+13]>0 //bull
&& Close[i+12]-Open[i+12]>0 //bull
&& Close[i+11]-Open[i+11]>0 //bull
&& Close[i+10]-Open[i+10]>0 //bull
&& Close[i+9]-Open[i+9]>0 //bull
&& Close[i+8]-Open[i+8]<0                          //bear  1st push
&& Close[i+7]-Open[i+7]>0 //bull  2nd push
&& Close[i+6]-Open[i+6]>0 //bull  2nd push
&& Close[i+5]-Open[i+5]>0 //bull  2nd push
&& Close[i+4]-Open[i+4]>0 //bull  2nd push
&& Close[i+3]-Open[i+3]<0                  //bear  2nd push
&& Close[i+2]-Open[i+2]>0 //bull  3rd push
&& Close[i+1]-Open[i+1]<0                         //bear   3rd push
&& Close[i]-Open[i]<0                         //bear   3rd push
&& Close[i+1]<Close[i+9] // we shouln't get a signal beyond the 3+(above the  last bar of the 3+)
//&& Close[i]<Open[i+3]
//&& Close[i+1]<Close[i+9]
&& Close[i]>Open[i+1]
)

{
up[i]= Low[i];
}

else  if (Close[i+15]-Open[i+15]<0 //bear
&& Close[i+14]-Open[i+14]>0 //bull
&& Close[i+13]-Open[i+13]>0 //bull
&& Close[i+12]-Open[i+12]>0 //bull
&& Close[i+11]-Open[i+11]>0 //bull
&& Close[i+10]-Open[i+10]>0 //bull
&& Close[i+9]-Open[i+9]<0                          //bear  1st push
&& Close[i+8]-Open[i+8]>0 //bull  2nd push
&& Close[i+7]-Open[i+7]>0 //bull  2nd push
&& Close[i+6]-Open[i+6]>0 //bull  2nd push
&& Close[i+5]-Open[i+5]>0 //bull  2nd push
&& Close[i+4]-Open[i+4]<0                  //bear  2nd push
&& Close[i+3]-Open[i+3]>0 //bull  3rd push
&& Close[i+2]-Open[i+2]<0                         //bear   3rd push
&& Close[i+1]-Open[i+1]>0 //bull  3rd push
&& Close[i]-Open[i]>0 //bull  3rd push
&& Close[i+1]<Close[i+10] // we must get the signal inside 3+(not beyond the last bar)
&& Close[i+1]>Open[i+2]
)

{
up[i]= Low[i];
}

else if (Close[i+14]-Open[i+14]>0 //bull
&& Close[i+13]-Open[i+13]<0 //bear
&& Close[i+12]-Open[i+12]<0 //bear
&& Close[i+11]-Open[i+11]<0 //bear                           THE BEAR 3+
&& Close[i+10]-Open[i+10]<0 //bear
&& Close[i+9]-Open[i+9]<0 //bear
&& Close[i+8]-Open[i+8]>0 //bull            1ST PUSH
&& Close[i+7]-Open[i+7]<0                                           //bear
&& Close[i+6]-Open[i+6]<0                    //bear               2nd Bear breakout
&& Close[i+5]-Open[i+5]<0                                       //bear
&& Close[i+4]-Open[i+4]<0                                       //bear
&& Close[i+3]-Open[i+3]>0 //bull                     2nd push
&& Close[i+2]-Open[i+2]<0 //bear                         Single bar as the 3rd push
&& Close[i+1]-Open[i+1]>0 //bull                            3rd push
&& Close[i]-Open[i]>0 //bull
//&& Close[i+1]>Open[1+3]
//&& Close[i+1]>Close[i+9]
&& Close[i+1]>Close[i+9] // we shouln't get a signal beyond the 3+(above the  last bar of the 3+)
&& Close[i]<Open[i+1]
)

{
down[i]= High[i];
}

else if (Close[i+15]-Open[i+15]>0 //bull
&& Close[i+14]-Open[i+14]<0 //bear
&& Close[i+13]-Open[i+13]<0 //bear
&& Close[i+12]-Open[i+12]<0 //bear                           THE BEAR 3+
&& Close[i+11]-Open[i+11]<0 //bear
&& Close[i+10]-Open[i+10]<0 //bear
&& Close[i+9]-Open[i+9]>0 //bull            1ST PUSH
&& Close[i+8]-Open[i+8]<0                                           //bear
&& Close[i+7]-Open[i+7]<0                    //bear               2nd Bear breakout
&& Close[i+6]-Open[i+6]<0                                       //bear
&& Close[i+5]-Open[i+5]<0                                       //bear
&& Close[i+4]-Open[i+4]>0 //bull                     2nd push
&& Close[i+3]-Open[i+3]<0 //bear                         Single bar as the 3rd push
&& Close[i+2]-Open[i+2]>0 //bull                            3rd push
&& Close[i+1]-Open[i+1]<0 //bear  3rd push
&& Close[i]-Open[i]<0 //bear  3rd push
&& Close[i+1]>Close[i+10] // we must get the signal inside 3+(not beyond the last bar)
&& Close[i+1]<Open[i+2]
)

{