Coloured MACD |
Post Reply |
Author | |
lmbull
Newbie Joined: 08 Dec 2006 Posts: 11 |
Post Options
Quote Reply
Topic: Coloured MACD 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 :- Edited by lmbull - 29 Aug 2011 at 2:12pm |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply 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); |
|
lmbull
Newbie Joined: 08 Dec 2006 Posts: 11 |
Post Options Quote Reply 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. Edited by lmbull - 06 Sep 2011 at 3:24am |
|
Post Reply |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |