| Registered User Joined: 11/19/2015
 Posts: 459
 
 | 
	Hello.
 How can I output a bars-ago count in minutes for this red-to-green indicator:
 
 
	XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5) > XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) AND XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) <= XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5) 
	
 I'd like to know "how many minutes (bars) ago" the above state change occured. I would end up using these in tables to sort these events by recency.
 
 Thank you very much for taking a look.
 | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	Maybe put the entire thing in a SinceTrue() function in a 1-minute indicator formula? 
	SinceTrue(XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5) > XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) AND XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) <= XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), 390) 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	
	| Registered User Joined: 11/19/2015
 Posts: 459
 
 | 
	To clarify, I use the formula above typically on Daily timeframes. However, I would like to calcuate in minutes (or some shorter timeframe) the bars elapsed since the signal. Thank you. | 
	
	| Registered User Joined: 11/19/2015
 Posts: 459
 
 | 
	Our posts crossed each other. I think the solution is what I need. Thanks so much, Bruce. Hope all's well. | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	That is going to be the formula calculated in a 1-minute time frame and the bars since it was true in a 1-minute time frame. 
	There really isn't a way to mix time frames to check for how many minutes ago the formula started being true or was most recently true in a daily time frame. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	
	| Registered User Joined: 11/19/2015
 Posts: 459
 
 | 
	Yes, understood. The solution works for what I need. Thank you. | 
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	You're welcome. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 |