| Registered User Joined: 10/7/2004
 Posts: 12
 
 | I was told that I needed to include the 'Cumulative directive in my Real code so that the numbers reported in the Main watchlist would match the numbers computed and displayed in the chart.  My understanding of the Cumulative indicator is that it computes with respect to all of the bars provided in the data manager.  Because I have Real Code indicators that require 5000 bars of intraday data, I have intraday bars set to 5000. 
 However, the (other) calculation that requires the 'Cumulative directive only uses the bars since the beginning of the day.  Is there a way to limit the calculation to only those bars since the beginning of the trading day.
 
 The code I use to determine the begining of the day is:
 If price.datevalue.dayofyear <> price.datevalue(1).dayof year Then ....
 
 How do I modify this code so that Real code only processes data for the current trading day?
 | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | One possibility would be to not use the '# Cumulative line and just not start plotting Values until at least one full day of data has passed so the Watchlist Column knows how much data it needs to use. An example of one type of structure that would do this follows: 
 Static DayCount As Integer
 If isFirstBar Then
 DayCount = 0
 Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
 DayCount += 1
 End If
 If DayCount >= 2 Then
 'Your RealCode here
 Else
 Plot = Single.NaN
 End If
 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 |