Help with code to Reference Previous bars

 
Help with an exit.
What is the code to reference data on a previous bar, for example
A buy is placed at the 11:00 oclock bar.
How do you right the code for an if statement to say
If the close price < low of the 11:00 bar
Thanks
Doc
 

Try this:

assuming you want to exit buy order if current bar low is higher than previous bar close.

bool ExitBuy = false;
if(Close[1] < Low[0]) {ExitBuy=true;}
 

Thanks for the info But I would like to say close is < the low of the 11:oo Bar

Regards

Doc

 

int i;

double elevenOclockLow;

// find most recent 11:00 low on hourly chart

for( i = 0; i < 23; i++){

if(TimeHour(Time[i]) == 11) {

elevenOclockLow = Low[i];

}

}

if(Close[0] < elevenOclockLow){

do stuff...

}

 
thank you