// global var
int tmpCount=0;
int lastHour=0;
int dnTick = upTick = 0;
var lastPrice;
void tick(){
tmpCount++; // increment every ticks
if (lastPrice > priceClose())
dnTick++;
else
upTick++;
...
}
void run(){
BarPeriod=60;
if(is(INITRUN)){
tmpCount=0;
lastHour=0;
}
if(!is(LOOKBACK)){
// .... this code run every new H1 candle
// in the dnTick & upTick is tick info from last hour
....
....
// -- now reset for newcandle
lastHour=tmpCount;
tmpCount=0;
upTick=0;
dnTick=0;
lastPrice=priceClose();
}
}