How to Buy at exact price through automated alert system

i want to buy at exact price before closing the candle through sending a alert in automated bridge . but want to sell only at closing price of respected time frame. i used

Buyprice = vlauewhen(Buy , cond);
sellprice = close;
shortprice = valuewhen(short , cond);
cover = close;
this is working well in back testing. But not sending alert at exact price rather send at closing . i am using Sharekhan automated bridge. Please suggest solution.
Thanking you in anticipation.