| Hi,   I'd like to simulate an OnBarClose kind of event. 
For 1m bars, it works pretty easily. I use code similar to the 
following   RequestTimeRefresh(1);   function GetSecondNum(){
 Time 
  = Now(4);
 Seconds  = int(Time%100);
 Minutes 
 = int(Time/100%100);
 Hours  = 
int(Time/10000%100);
 SecondNum= 
int(Hours*60*60+Minutes*60+Seconds);
 return 
SecondNum;
 }
   if (frac(GetSecondNum()/60)==0) 
{_TRACE("End of minute bar");
 }![]()    You can replcae the _Trace() statement with 
whatever you'd like to do at the very end of the bar. The function 
GetSecondNum() came from the library and I believe the author is Herman (tyring 
to give credit where credit is due :)   However, this doesn't work for tick charts. I tried 
being clever by using a static var to hold LastValue(BarIndex()) and check it 
against the current BarIndex() -- alas, it seems that if my RT database holds 
20000 bars and I have 20000 bars loaded, the last value of Barindex() is always 
19,999 -- at least that is what I get in _Trace() bar after bar.   If anyone knows of a way to capture the close of a 
tick bar, that would be very useful information. Meanwhile, I hope the 
onbarclose-like event for minute bars (and longer) is useful to 
someone. Regards,
   Gordon __._,_.___
 
 **** IMPORTANT ****
 This group is for the discussion between users only.
 This is *NOT* technical support channel.
 
 *********************
 TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
 SUPPORT {at} amibroker.com
 *********************
 
 For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
 http://www.amibroker.com/devlog/
 
 For other support material please check also:
 http://www.amibroker.com/support.html
 
 *********************************
 
 
 
 ![]()  
 
 __,_._,___
 |