Custom Series Cumulative $NYAD

Wondering if anyone has / knows of a successful way to create the NYAD cumulative?

I’m not sure P123 has the power to do that, but figured I might as well check…

The issue I’m running into is getting today’s A/D to add to prev day A/D without actually coding a line for every single day prior…

Here’s what I have (very simple)

SetVar(@adv0,UnivCnt(“Close(0)>close(1)”))
SetVar(@dec0,UnivCnt(“Close(0)<close(1)”))
SetVar(@AD, @adv0 - @dec0)
@AD

I have toyed with the various math factors but cannot seem to find one that works for this (or the issue may be that I’m understanding it wrong)

Would love to hear what your guys thoughts are…

In screener/simulation:

  • you should be able to use SMA, EMA using your NYAD : setvar(@x,SMA(200,0,GetSeries(“NYAD”)))
  • If you want to use Loop function the only way I could use custom series is first creating a custom formula ($My_Formula: GetSeries(“NYAD”))…and then calling it setvar(@y,LoopAvg(“Close(CTR, $My_Formula)”, 100)). Maybe there is a better way

Go to the Rules section of Custom Series and do the following:

  1. Pick “NY Stock Exchange” under the Universe tab
  2. Type the following under the Add Rule tab: UnivCnt(“Close(0)>Close(1)”) - UnivCnt(“Close(0)<Close(1)”)
  3. Click the Chart tab
  4. Pick “Daily” under the Frequency tab
  5. Pick “Cumulative Sum” under the Transform tab
  6. Set your date range
  7. Click Update
  8. Click Save

Thank you guys!