Thanx Andrew, but I am so clueless with this programming and dont understand it. I feel I am wasting your time. Thanx again
The code needed to solve this:
static datetime lastbartime=0; // static will remember its value on subsequent calls
datetime bartime=iTime(NULL,0,0); // get the start time of the actual bar
if(lastbartime!=bartime) BuyNow(); // buy only once a bar
Thanx all for your contributions. I have found a solution to the issue.