Print Page | Close Window

Price vs. MA Indicator - Need Some Help

Printed From: BullCharts Forum
Category: BullCharts
Forum Name: BullScript
Forum Discription: Technical discussion related specifically to the BullScript programming language.
URL: http://www.bullcharts.com.au/forum/forum_posts.asp?TID=582
Printed Date: 24 Apr 2025 at 12:53am
Software Version: Web Wiz Forums 9.69 - http://www.webwizforums.com


Topic: Price vs. MA Indicator - Need Some Help
Posted By: kennerhk
Subject: Price vs. MA Indicator - Need Some Help
Date 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. 




Replies:
Posted By: maximo
Date 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]

  


Posted By: maximo
Date 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;



Posted By: kennerhk
Date 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!



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums® version 9.69 - http://www.webwizforums.com
Copyright ©2001-2010 Web Wiz - http://www.webwiz.co.uk