Stochastic MACD Oscillator

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #110436 quote
    Loop
    Participant
    Senior

    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

    #110443 quote
    robertogozzi
    Moderator
    Master

    There you go:

    LookBack = 20
    LL       = 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) * 100
    SigLine  = 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.

    x-11.jpg x-11.jpg
    #110508 quote
    Loop
    Participant
    Senior

    Thanks a lot for your extremly quick reply!

     

    ML

    #132783 quote
    Loop
    Participant
    Senior

    Sorry… one more question… being a stochastic oscillator, shouldn’t have 100 as maximun value?

    ML

    #132937 quote
    robertogozzi
    Moderator
    Master

    It’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.

    #132940 quote
    GraHal
    Participant
    Master

    Roberto code added as Log 216 here …

    Snippet Link Library

    robertogozzi thanked this post
    #132948 quote
    Vonasi
    Moderator
    Master

    Here 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.

    LookBack = 20
    
    if barindex >= 26 then
    LL       = 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) * 100
    SigLine  = Average[9,1](StMACD)
    
    hhmacd = max(sigline,max(hhmacd,stmacd))
    llmacd = min(sigline,min(llmacd,stmacd))
    
    macdperc = ((stmacd-llmacd)/(hhmacd-llmacd))*100
    sigperc = ((sigline-llmacd)/(hhmacd-llmacd))*100
    endif
    
    RETURN macdperc as "StMACD" ,Sigperc AS "Signal",0 as "0",100 as "100"
    #151467 quote
    sfjeelani
    Participant
    New

    Dear All

    Useful posts and indicator, Do we have a screener available to use with this indicator?

    Thanks

    #151471 quote
    robertogozzi
    Moderator
    Master
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Stochastic MACD Oscillator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Loop @loop Participant
Summary

This topic contains 8 replies,
has 5 voices, and was last updated by robertogozzi
5 years, 2 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/17/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...