Here it is. To avoid any doubts that I did not pirate or copy the code but rather discovered the logic of the indicator, let me walk you through my process: From https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/O-Q/PMC:
"The Persons Market Catcher (PMC) is a variation on Relative Strength Comparative Analysis of one market versus the S&P 500 on a percentage change basis. The study uses a moving average component to help identify if there is a trend developing in performance over time."
The phrases "percentage change basis" and "moving average component" were the keys.
I started by examining the built-in PercentChg indicator on TOS. It has built within a lookback. I decided to see if the lookback feature has anything to do with the "moving average component". So I took the number 20 (a standard number in the industry) and applied to the lookback. I then just plotted a difference in calculations between the 20-period percentage change of the symbol and the 20-period percentage change of the SPY.
It turned out to match the numbers EXACTLY. I then decided to take a gander at what the moving average on the pmc indicated. I knew it was critical to understanding the color logic, so I took an educated guess that a type of 7period average (like slow average of the PPS indicator) might be a good place to start. A 7ema of the pmc turned out to be the correct answer. I coded the coloring of the pmc accordingly, added a symbol input (for the comparison) and an aggregation input for kicks, and voila:
"The Persons Market Catcher (PMC) is a variation on Relative Strength Comparative Analysis of one market versus the S&P 500 on a percentage change basis. The study uses a moving average component to help identify if there is a trend developing in performance over time."
The phrases "percentage change basis" and "moving average component" were the keys.
I started by examining the built-in PercentChg indicator on TOS. It has built within a lookback. I decided to see if the lookback feature has anything to do with the "moving average component". So I took the number 20 (a standard number in the industry) and applied to the lookback. I then just plotted a difference in calculations between the 20-period percentage change of the symbol and the 20-period percentage change of the SPY.
It turned out to match the numbers EXACTLY. I then decided to take a gander at what the moving average on the pmc indicated. I knew it was critical to understanding the color logic, so I took an educated guess that a type of 7period average (like slow average of the PPS indicator) might be a good place to start. A 7ema of the pmc turned out to be the correct answer. I coded the coloring of the pmc accordingly, added a symbol input (for the comparison) and an aggregation input for kicks, and voila:
Code:
### Person's Market Catcher Replica
### by Jtru1594
#
# Version 1.0 3/11/2022
#
# Version 2.0 3/13/2022 Added Optional Aggregation Input
#
###
input CorrelationWithSecurity = "SPY";
input alternateTimeFrame = no;
input agg = AggregationPeriod.HOUR;
def AP = GetAggregationPeriod();
def timeframe = if !alternateTimeFrame then AP else agg;
def close2 = close(CorrelationWithSecurity,period = timeframe);
declare lower;
def pctchg = 100 * (close(period = timeframe) / close(period = timeframe)[20] - 1);
def pctchgspy = 100 * (close2 / close2[20] - 1);
plot pmc = pctchg - pctchgspy;
pmc.setPaintingStrategy(paintingStrategy.HISTOGRAM);
plot pmcma = expaverage(pmc, 7);
pmc.assignValueColor(if pmc>=0 and pmc>=pmcma then color.cyan else if pmc>=0 and pmc<=pmcma then color.blue else if pmc<=0 and pmc<=pmcma then color.red else color.magenta);
pmcma.assignValueColor(if pmcma[0]>pmcma[1] then color.yellow else color.blue);
pmcma.setlineweight(2);