New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.

How to calculate a Ratio Difference to a SMA in a Chart (e.g. Todays Close / SimpMovAv of 125)

Dear Stockcharts fellowers,
may someone has an idea how to use the proper indicator and setting on Stockcharts:

I want to get the ratio lates Price divided by the 125 day simple moving average below in the indicator section:

My objective is to get a measurable divided difference (with % or ratio ... <1, >1) and not a minus differenc (A minus B) in order to compare this.

May this example explains it:

Thanks an best regards,


  • markdmarkd ✭✭✭
    edited September 2016
    You could try PPO(1,125,1).

    PPO expresses the difference between Price (expressed as ema(1,close)) and the EMA(125,close) as a per cent (ratio) of the of the ema(125,close).

    NOTE: PPO uses ONLY emas, not smas. Unfortunately, you can't modify that.

    ( ema(1,close)-ema(125,close) )/ ema(125,close)

    So PPO is a ratio, but it expresses the ratio differently, compared to the Price ratio indicator. Instead of using decimals when the result is less than one (ema 1 is below ema125), as Price does, PPO uses negative numbers, namely the difference between 1 and the ratio. Because it uses negative numbers, it has to use 0 as the base line. The ratio indicator uses 1 as the base line.

    So, the PPO scale has positive and negative numbers, but if you think of the zero line in PPO as being the same as the 1.00 in the ratio indicators (which it is), then the negative numbers in PPO (say -10) are the same as 1.00 minus the (absolute value) of the negative number, so -10 could be expressed as .90, which would be comparable to the ratio numbers in the other indicators that are decimals smaller than 1.00, like .87, etc.

    If the PPO number is positive, then you would put "add" 1.00" in front of it - so if PPO is 4.3, it would be 1.043 (you need the zero because 4.3 is really .043). If it is,say 12.2, it would 1.122, etc.

    P.S. the third parameter, 1, has to be there, but we are not using it for your purpose. Normally, PPO is used with a Signal line (the third parameter), but for your purpose, we want it to be 1.
  • thank you for the PPO idea. It looks like I can use it only once one a chart for ony symbol or ratio.

    As you can see in my link
    My idea was to compare the five Index/Sector/Industry ratios below the chart in the indicator section with "Overlay" and "Parameters" in order to get more usable % Difference information for better comparision than a visual chart.

    I tried to use the KST parameters, Standard deviation or ROC to get a similar result. I am not really good in that.
    May be there are special parameters or formulas possible to get such a result.

    Thanks for ideas and best regards,
  • markdmarkd ✭✭✭
    edited September 2016
    Hi @Matt , I'm not exactly sure what your approach is to using these ratios, so I'm not sure what to recommend as another alternative. But, for what it's worth, it's not the absolute number that matters when comparing ratios, if that's what you are looking to compare, its the direction, or the steepness of the trend of the ratio line that shows which ratio is stronger. An MA is a good way to see that, but maybe a shorter MA, or EMA, that hugs the ratio line a little closer would be more clear. MA 21 (a month) works pretty well to my eye, but it might be a little too short, since it looks like you want a longer term view. Maybe MA63 would work better for your eye.

    If you wanted to put some work into it, you could do two MAs of different colors for each ratio. You would enter each ratio twice, using "behind indicator" for the second instance, then for the MA overlay, maybe 21:red and 63:green (or whatever). I haven't tried it, but the order in which the crossovers occur, and the distance between the MAs might give a clearer view of which ratio is leading. P.S. if you do that, it might be easier to see the MAs with "line" or "dashed" style than "area" - but that's an individual thing.
  • Thanks Mark for your MA idea, but this is not practical enough for comparing symbols in one Chart. I did some excel research and got the conformation that measuring the difference to a Moving average, which equals to the rank of a scan: Rank by [Close / SMA(125)] is a very good simple approach to compare assets. It can be used also weighted 1Month=21days, 3M=65days, 6M=125days. Its less volatile than SCTR ranking and gives an absolute rank to put money in.
    Some other professionals chartists use this:

    My reccomendation is to implement this simple indicator in the "Overlay" function below a chart like ROC and KST are already there.

    The problem with KST is the ROCs only for short (ST)and intermediate term(IT). The best would be a KST setting with more part ROCs for ST and IT which could equal the [Close / SMA(125)] and has the opportunity to take adjust Martins fix weighted factors x1 x2 x3 x4
    A kind of special K with the opportunity to adjust the ROCs and factors would also great win win. May thats a easy adjustment for stockcharts.

    Thanks for thinking about it. Other chart softwar plattforms improve the technology, they allow to program indicators easy or simple add the existing module below the chart without limitation (max 6 symbols below chart).

    Best regards, Matt
  • markdmarkd ✭✭✭
    edited December 2016
    "My reccomendation is to implement this simple indicator in the "Overlay" function below a chart like ROC and KST are already there."

    If you want Stockcharts to add something to their site, you should contact them through the Support option on their menu.

    I have no connection to Stockcharts except as a subscriber. This is a user site for mutual assistance and exchange of ideas. It is not read by Stockcharts staff.
  • Already done, thanks
Sign In or Register to comment.