Thanks for this! I just tried it out and liked how it worked. The only problem is that when I tested it I got different results:
EDIT: The dates that I'm looking at are Oct 22-Oct26 on the 4 hr chart with the step pdfma set to a period of 11.
Any ideas why? Is this indicator repainting?