BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Coloured MACD
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Coloured MACD

 Post Reply Post Reply
Author
Message Reverse Sort Order / View First Unread Post
lmbull View Drop Down
Newbie
Newbie


Joined: 08 Dec 2006
Posts: 11
Post Options Post Options   Quote lmbull Quote  Post ReplyReply Direct Link To This Post Topic: Coloured MACD
    Posted: 06 Sep 2011 at 3:22am
Thanks Maximo
This will give me the model for what I want. The visual color change is easier for my eye to pickup.
Clap


Edited by lmbull - 06 Sep 2011 at 3:24am
Back to Top
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 05 Sep 2011 at 6:26pm
Yep Yep
 
 

{ MACD indicator with histogram }

[description="One of the simplest and most reliable indicators, MACD uses 2 moving averages.

compares two moving averages of prices, with 9 day Exponential Moving average as a signal."]

[target=Default; category=Moving Average; dp=4]

[horzline=0]

n1 := input("Short moving average",12,1);

n2 := input("Long moving average",26,1);

ns := input("Signal periods",9,1);

{Note: The true MACD is not quite a 12 & 26 exponential moving average }

r1 := 2/(n1+1);

r2 := 2/(n2+1);

ma12 := C*r1 + previous(C)*(1-r1);

ma26 := C*r2 + previous(C)*(1-r2);

res := wait(ma12 - ma26,25);

signal := ma(res,ns,E);

[Name=MACD; color=dodger blue]

res;

[name=Signal; linestyle=solid; color=red]

signal;

histogram:=res - signal;

[Name=Histogram Up; linestyle=Histogram; width=2; color=lime green]

if (histogram > hist(histogram,1),histogram,undefined);

[Name=Histogram Down; linestyle=Histogram; width=2; color=crimson]

if (histogram <=hist(histogram,1),histogram,undefined);

Back to Top
lmbull View Drop Down
Newbie
Newbie


Joined: 08 Dec 2006
Posts: 11
Post Options Post Options   Quote lmbull Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 2011 at 1:33pm
I was wondering if it was possible to have the MACD to change colour from bar to bar ?
For example in the following manner:

If ([bar that just closed] >= [previous bar]) then color[bar that just closed] = blue
If ([bar that just closed] < [previous bar]) then color[bar that just closed] = red

This would make it easier to see a change in momentum.

Eg of bars changing colour :-
Color MACD


Edited by lmbull - 29 Aug 2011 at 2:12pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz