Calculating percentage of days up

nsd
46
nsd  

Can anyone tell me an easy way of calculating the percentage of days up vs days down over a given period.  So 20 day look back, 16 days were up days = 80%.  Not exactly rockent science i know but  I don't want to do it in Excel.  Do I need a custom indicator?  Or can I put it directly into a EA?

William Roeder
25824
William Roeder  
  1. Loop 1 .. n days. Determine if it's an up day. if up increment a count. percentage is count/n*100
  2. not if you have an EA.
  3. yes