Need of MACD with coloured bar

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #185823 quote
    Frankkeyo
    Participant
    Junior

    Hello all,

    I am looking for a MACD with colour on the bars.  So if one bar is lower than the previous, then it would be a different shade colour. If it raises above the previous bar, then the colour would go back to the original shade.  The same goes for the bars below the base line (0 line).  I have found one here, which I downloaded, but the data it displays does not match the MACD on the prorealtime platform.  Can anyone refer one to me?

    Thanks in advance.

    #185824 quote
    JC_Bywan
    Moderator
    Master
    #185825 quote
    Frankkeyo
    Participant
    Junior

    Thank you JC_Bywan.  That is the one I found earlier, but the data shows different to the default on the platform.  Is there a way to correct this?

    #185830 quote
    JC_Bywan
    Moderator
    Master

    I see, yes, that’s because it’s a histogram display of the “macdline”, you want the classic macd histogram. No problem, it can be easily adapted as follows to display the modified histogram instead:

    fast = 12
    slow = 26
    signalP = 9
    
    myMACDline=exponentialaverage[fast]-exponentialaverage[slow]
    signal=exponentialaverage[signalP](myMACDline)
    myMACD=myMACDline-signal
     
    if myMACD>0 then
    if myMACD>myMACD[1] then
    r=0
    g=100
    b=0
    else
    r=255
    g=69
    b=0
    endif
    else
    if myMACD>myMACD[1] then
    r=50
    g=205
    b=50
    else
    r=255
    g=0
    b=0
    endif
    endif
     
     
    RETURN myMACD coloured(r,g,b) style(histogram) as "MACD histogram", signal coloured(255,0,255) style(line,2) as "signal line", myMACDline coloured(0,255,255) style(line) as "MACD line"
    #185832 quote
    Frankkeyo
    Participant
    Junior
    Thank you
    
    
    
    #185833 quote
    JC_Bywan
    Moderator
    Master

    I corrected a typo in the last line of code of my previous message, more or less at the same time as you posted, so it might be worth refreshing the topic with ctrl+F5 to make sure you have used the edited correct version.

    #185834 quote
    Frankkeyo
    Participant
    Junior

    Thanks.  Much appreciated.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Need of MACD with coloured bar


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Frankkeyo @frankkeyo Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Frankkeyo
4 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/18/2022
Status: Active
Attachments: No files
Logo Logo
Loading...