i thinking ( from head )

Code

// 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();
  }
}


in manual:
Quote
In a TMF or tick function, priceClose() returns the last price quote, updated every tick when new price data becomes available. price() returns the price averaged over all received ticks of the current bar so far; therefore it is more 'jaggy' at the begin of the bar when few ticks were received yet, and more smooth towards the end of the bar period. priceHigh() and priceLow() return the highest and lowest price of the current bar so far, so their distance is small at the begin of the bar and wide towards the end.

Last edited by Grat; 10/12/20 06:36.