1) The following code can be used
console.getOut().println("ask price at " + hour + ": " + askBar.getOpen());
console.getOut().println("bid price at " + hour + ": " + bidBar.getOpen() );
2) Yes, this code can be run using historical tester.
3) to use tick.getAsk() and tick.getBid() in strategy code you can define two global variables in the beginning of the strategy:
double askPrice;
double bidPrice;
Then the variables should be assigned, to do that insert the following code after println`s:
askPrice = tick.getAsk());
bidPrice = tick.getBid());
Values askPrice and bidPrice can now be used in the strategy.