| Registered User Joined: 6/2/2005
 Posts: 11
 
 | 
	I want to compare Price to a Moving average intraday, but have found the Moving Average only recognizes its Value 6 bars back.  I was trying to look at its Value thirteen bars back.  The problem is in a Realcode formula If MA,Value(13) > Price.Close,value(13) and MA.Value < Price.Close then pass.  It will only return positives up to MA,Value(6).  Any ideas why I can not go back 13 Bars? | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	The syntax does not look valid. There should be a period where the first comma is currently and it should be Price.Close(13) and not Price.Close,value(13). 
If MA.Value(13) > Price.Close(13) AndAlso MA.Value < Price.Close Then Pass 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	
	| Registered User Joined: 6/2/2005
 Posts: 11
 
 | 
	Bruce, 
	Sorry for the typos.  Of course I would get an error message if had those commas where periods should be, so there are no commas in the code.  Saying that if can not get a positive return If the MA.Value look back period is greater than (6) 
	MA.Value(6) > Price.Close(13) And MA.Value < Price.Close Then Pass 
	That works 
	MA.Value(7) > Price.Close(13) And MA.Value < Price.Close Then Pass 
	Does not return any positives.   
	Footnote: '# MA = chart.MovingAverage 
	  | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	You haven't indicated the period of the moving average used, but if I use a 30-Period Simple Moving Average with a Daily Time Frame, the following RealCode Condition returns true for 5 symbols in the Standard and Poors 100 Component Stocks Watchilst. 
	DOW, UTX, UNH, MRK & UNP 
If MA.Value(7) > Price.Close(13) AndAlso MA.Value < Price.Close Then Pass 
	But if I actually adjust the bars ago parameters to match at 7 instead of using 7 and 13, I get 13 symbols. 
	AMGN, MET, BRKB, DOW, COF, BAX, JPM, UNH, C, MON, IBM, BAC & MRK 
If MA.Value(7) > Price.Close(7) AndAlso MA.Value < Price.Close Then Pass 
	I have absolutely no idea why you would not get any symbols returning true. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	
	| Registered User Joined: 4/19/2012
 Posts: 7
 
 | 
	I HAVE BEEN SCANNING USING MOV AVG CROSS OVERS. 
	WHEN I GET THE SCANS, THEY ARE ABOUT 8 TO 10 BARS PAST TH CROSS OVER. 
	IS THERE A PCF THAT WILL SHOW THE CROSS OVER IN ONE OR TWO BARS? 
	THANKS | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	If you are using the built in crossing conditions, it should only return true on the exact bar of the cross. Please contact technical support. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 |