BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Display single value as text.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Display single value as text.

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

Joined: 13 Oct 2012
Posts: 3
Post Options Post Options   Quote markos Quote  Post ReplyReply Direct Link To This Post Topic: Display single value as text.
    Posted: 16 Oct 2012 at 10:34pm
Here is the chart:
Back to Top
markos View Drop Down
Newbie
Newbie
Avatar

Joined: 13 Oct 2012
Posts: 3
Post Options Post Options   Quote markos Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2012 at 10:31pm
Charles

Thanks for the pointer.  I managed to get it to work with a bit more tweaking.
Below is the code:

{Moving Average Calculation}

[target=Price; category=Moving Average;]

expr := expression("Expression");

method := inputma("Method",SIMPLE);

n := input("Time periods",14,1);

res := ma(expr,n,method);

[linestyle=Solid; color=Red]

res;

{Alan Hull's ROAR calculation for best fit Moving Average}

[linestyle=hidden; visible=no]

ResNow := Res;

Res52W :=ref(res,-52);

Change := ResNow - Res52w;

ROARtxt := 100*(Change/ResNow);

{This part displays the ROAR as a percentage}

a:=IF(systemdate=Systemdate ,RoarTxt, Undefined);

[linestyle=Text; textalign=Above,Left; target=price;visible=yes]

if(barnumber=lastvalue(barnumber), Round(a,2) + "%", undefined);High;


Back to Top
cmacdon View Drop Down
BullCharts Guru
BullCharts Guru


Joined: 09 Sep 2012
Location: Brisbane
Posts: 236
Post Options Post Options   Quote cmacdon Quote  Post ReplyReply Direct Link To This Post Posted: 16 Oct 2012 at 9:03pm
Markos
 
I looked at a charrt after using your scrip.  It shows aa MA line with I think the current value shown as text at every bar.  Ther was another line but it seem off the scale?
 
From the gist of your narrative I assume you want to only show a text value at the last bar?
 
I hacked some code previously provided by Maximo on a bullscript post for "Text on Chart" and attach the amendment  to uyou code as it only shows the value allocated for the last bar.
 
I coverd up you second line as i did not understand what it was.
 
You can reiinstate by removing THE BRACKETS{} and further amend if you so wish
 
The last bar text is turned on by ticking the text box in the style menu.
 
Regards
Charles
 
 
 
 

[target

=Price; category=Moving Average;]

expr :=

expression("Expression");

method :=

inputma("Method",SIMPLE);

n :=

input("Time periods",14,1);

res :=

ma(expr,n,method);

[linestyle

=Solid; color=Red]

res;

[linestyle

=hidden; visible=no]

ResNow := Res;

Res52W :=

ref(res,-52);

Change := ResNow - Res52w;

ROARtxt := 100*(Change/ResNow);

{ROARtxt;}

{[linestyle=text; visible = yes; colour = blue]

lastROAR:= lastvalue(ROARtxt);

lastROAR;close}

{ This additional bit is just a hacking and slight amendment of the code Maximo supplied in his Bullscript Forum post For Text on Chart }

a:=

IF(systemdate=Systemdate ,RoarTxt, Undefined);

Bars:=

datediff("D", Systemdate, systemdate) + 1;

[linestyle

=Text

; textalign=Above,Left; target=price]

if

(barnumber=lastvalue(barnumber), Round(a,2) + " ", undefined);

High

;

 
 
BC User since June 2007
Back to Top
markos View Drop Down
Newbie
Newbie
Avatar

Joined: 13 Oct 2012
Posts: 3
Post Options Post Options   Quote markos Quote  Post ReplyReply Direct Link To This Post Posted: 15 Oct 2012 at 9:36pm
Hi all,

I have written a script (we copied bits from here and there and added something of my own).
But I am having an issue with the output.  Basically the indicator plots two plots on a symbol, but I want the second plot to only display its las value as text.  I can get it to display as text, but I get every value.
I created the script this way as I wanted the same time frame applied to both plots (I also couldn't work out how to use the timeframe specified in one indicator in another without having to set it each time I applied it)

Any assistance would be appreciated

Here is my last effort:

[target=Price; category=Moving Average]


expr := expression("Expression");

method := inputma("Method",SIMPLE);

n := input("Time periods",14,1);


res := ma(expr,n,method);

[linestyle=Solid; color=Red] 

res;

[linestyle=hidden; visible=no]

ResNow := Res;

Res52W := ref(res,-52);

Change := ResNow - Res52w;

ROARtxt := 100*(Change/ResNow);

ROARtxt;

[linestyle=text; visible = yes; colour = blue]

lastROAR:= lastvalue(ROARtxt);

lastROAR;close


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