how to configure the buy price in back test?

 

i tried to do a very simple test in onTick() function

just very simple like buy the symbol when 8 days ma cross 20 day ma and close price higher than 20 days ma on 1H graph. for both ma, i use bar close. and check if


ma1.Main(0)>ma2.Main(0) && close>ma2.Main(0)


as far as i know, this statement will check after a bar close

however, i found that in a bar that satisfying this condition, the system will use the best ask price in bar OPEN to buy the symbol. but however, it is really not expected. it should use the price at bar CLOSE. can anyone tell how can i configure this inside the onTick() function?