Stochastic MACD Oscillator
Forums › ProRealTime English forum › ProBuilder support › Stochastic MACD Oscillator
- This topic has 8 replies, 5 voices, and was last updated 3 years ago by robertogozzi.
Tagged: Macd, Stochastic
-
-
10/17/2019 at 10:52 PM #110436
Dear All,
would it be possible to code on prorealtime the following stocastic / macd recently published on “Stock & Commodities”?
“Stochastic EMA12 = (12-day EMA – Lowest low) / (Highest high – Lowest low)
Stochastic EMA26 = (26-day EMA – Lowest low) / (Highest high – Lowest low)
STMACD = (Stochastic EMA12 – Stochastic EMA26) *100
Signal line: 9-day EMA of STMACD
where:
Lowest low = Lowest low for the lookback period
Highest high = Highest high for the lookback period
The STMACD is multiplied by 100 to move the decimal point two places
The default setting for the lookback period is 45″Thanks a lot in advance for your reply
ML
10/18/2019 at 12:01 AM #110443There you go:
12345678LookBack = 20LL = lowest[LookBack](low)HH = highest[LookBack](high)StEMA12 = (Average[12,1](close) - LL) / (HH - LL)StEMA26 = (Average[26,1](close) - LL) / (HH - LL)StMACD = (StEMA12 - StEMA26) * 100SigLine = Average[9,1](StMACD)RETURN StEMA12 AS "Ema12",StEMA26 AS "Ema26",StMACD AS "Macd",SigLine AS "Signal",0 AS "Zero"you can remove unwanted RETURN data or make it invisible with the indicator’s properties.
10/18/2019 at 2:48 PM #11050805/22/2020 at 10:28 AM #13278305/23/2020 at 12:15 PM #132937It’s a combination of Stochastic and Macd. Each indicator/oscillator has different characteristics. Stochastic ranges from 0 to 100, Macd doesn’t.
Neither does this one.
05/23/2020 at 12:49 PM #132940Roberto code added as Log 216 here …
1 user thanked author for this post.
05/23/2020 at 2:13 PM #132948Here is a version of Roberto’s code that normalizes the result between the highest ever result and the lowest ever result and returns it as a percentage of that range so it is between 0 and 100.
123456789101112131415161718LookBack = 20if barindex >= 26 thenLL = lowest[LookBack](low)HH = highest[LookBack](high)StEMA12 = (Average[12,1](close) - LL) / (HH - LL)StEMA26 = (Average[26,1](close) - LL) / (HH - LL)StMACD = (StEMA12 - StEMA26) * 100SigLine = Average[9,1](StMACD)hhmacd = max(sigline,max(hhmacd,stmacd))llmacd = min(sigline,min(llmacd,stmacd))macdperc = ((stmacd-llmacd)/(hhmacd-llmacd))*100sigperc = ((sigline-llmacd)/(hhmacd-llmacd))*100endifRETURN macdperc as "StMACD" ,Sigperc AS "Signal",0 as "0",100 as "100"11/25/2020 at 12:13 AM #15146711/25/2020 at 1:06 AM #151471 -
AuthorPosts
Find exclusive trading pro-tools on