Price vs. MA Indicator - Need Some Help |
Post Reply |
Author | |
kennerhk
Newbie Joined: 29 Aug 2007 Location: Hong Kong Posts: 8 |
Post Options
Quote Reply
Topic: Price vs. MA Indicator - Need Some Help Posted: 12 Oct 2009 at 2:18am |
I would like to create an indicator that measures the percentage difference between the current price vs. a moving average, say the 50 DMA. It would be similar to the Price ROC indicator in the BC indicator list except that it would compare the current price to a MA instead of a price X days ago. If price = 50 DMA, the indicator would be at 0. If the price was above the 50 DMA by 19%, it would register +19 above the zero line. There would be 0-100 above and 0-100 below the 0 line. Should be pretty simple, but I know nothing about coding/programming/scripting but would like to know what statements I would have to use to convert the existing PROC indicator to do this. Any help would be greatly appreciated. |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 12 Oct 2009 at 11:45pm |
Hi ken,
Percentages are very useful in trading that's for sure.
[Description ="Deviation Percent, Max"]expr := expression("Expression");method := inputma("Method",S);period := input("Time period",20,1);average:= ma(expr,period,method);((expr - average) / average) * 100; [horzline =0] |
|
maximo
BullCharts Guru Joined: 02 Sep 2006 Location: Australia Posts: 232 |
Post Options Quote Reply Posted: 13 Oct 2009 at 5:29pm |
Another use of percent is identifying support and resistance areas and profit targets.
[Description ="Percentage Bands, Max"][Target =Price; lineStyle=Solid; color=steel blue]P50:= ma((HHV(C,50) + LLV(C,50))/2,5,E);P50; [lineStyle =Dotted]P50*1.05; { 5% above & below }P50*0.95; P50*1.10; { 10% above & below }P50*0.90; |
|
kennerhk
Newbie Joined: 29 Aug 2007 Location: Hong Kong Posts: 8 |
Post Options Quote Reply Posted: 13 Oct 2009 at 11:24pm |
Maximo,
This is perfect! Just what I was looking for. Really appreciate the help on this plus the additional support/resistance indicator as well! Cheers!
|
|
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 |