BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Price vs. MA Indicator - Need Some Help
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Price vs. MA Indicator - Need Some Help

 Post Reply Post Reply
Author
Message / View First Unread Post
kennerhk View Drop Down
Newbie
Newbie
Avatar

Joined: 29 Aug 2007
Location: Hong Kong
Posts: 8
Post Options Post Options   Quote kennerhk Quote  Post ReplyReply Direct Link To This Post 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. 

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: 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]

  
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: 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;

Back to Top
kennerhk View Drop Down
Newbie
Newbie
Avatar

Joined: 29 Aug 2007
Location: Hong Kong
Posts: 8
Post Options Post Options   Quote kennerhk Quote  Post ReplyReply Direct Link To This Post 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!  Clap  Cheers!
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