| 
 PureBytes Links 
Trading Reference Links 
 | 
 Hi,  
  
I am trying to understand how this function works, 
I may be able to adopt this approach.  
  
The help does not make it clear, does DateTime()return  the time stamp of the bars or just system 
date/time? 
  
would 
this function work for tick and volume bars too? 
 thanks, Joseph 
Biran ____________________________________________ 
        
   
Thanks Herman
  I was trying to eliminate use of 
LastValue(), but the structure you provided should allow me to do 
that. Putting it in a function is an extra bonus.
  I beleive this 
modification should work.
  > function NewBar() > 
{ LastDateTimeValue = DateTime();
  > PrevDateTimeNum   = 
StaticVarGet("DateTimeNum"); > LastDateTimeNum   = 
LastDateTimeValue[BarCount-1]; > 
StaticVarSet("DateTimeNum",LastDateTimeNum ); > return PrevDateTimeNum != 
LastDateTimeNum; > }
  ----- Original Message -----  From: "Herman 
van den Bergen" <psytek@xxxxxxxx> To: 
<amibroker@xxxxxxxxxxxxxxx> Sent: Saturday, April 01, 2006 2:13 
AM Subject: RE: [amibroker] Detecting New Bar
 
  > function 
NewBar() > { > PrevDateTimeNum = 
StaticVarGet("DateTimeNum"); > LastDateTimeNum = 
LastValue(DateTime()); > StaticVarSet("DateTimeNum",LastDateTimeNum 
); > return PrevDateTimeNum != LastDateTimeNum; > } > > 
-----Original Message----- > From: amibroker@xxxxxxxxxxxxxxx 
[mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf > Of Ara Kaloustian > 
Sent: Friday, March 31, 2006 11:45 PM > To: AB-Main > Subject: 
[amibroker] Detecting New Bar > > > I use the code below to 
detect when a new bar is started, so that I process > some indicators 
only once per bar in order to decrease CPU load. > > The code below 
uses LastValue() function (which is slow). I would like to > replace it 
with Close[BarCount-1] ..., but can not quite figure out 
how ... > > My concern is that Quick AFL keeps changing the 
number of bars loaded as > time goes on, so I am not sure what the impact 
is. > > Anyone see a way out? > > Thanks > > 
Ara > > //Detect New Bar > //Variables: NewBar > 
// > > if (IsNull(StaticVarGet("Lastbar"))) > { > 
StaticVarSet("Lastbar",0); > } > > //Detect New bar > 
//Use to start routines at start of new bar > // > NewBar = 
False; > if (StaticVarGet("Lastbar")!=LastValue(BarIndex())) > 
{ > NewBar = True; > 
StaticVarSet("Lastbar",LastValue(BarIndex())); > } 
  
Please note that this group is for discussion between users only. 
 
To get support from AmiBroker please send an e-mail directly to  
SUPPORT {at} amibroker.com 
 
For other support material please check also: 
http://www.amibroker.com/support.html 
 
  
    
  
  
  
    SPONSORED LINKS
   
       
  
 
  
    
  YAHOO! GROUPS LINKS
 
 
    
 |