Page 1 of 1

Need Help Putting Text On Chart

Posted: 10 Dec 2008
by flipflopper
I have two moving averages for my 30 minute chart... they are the 65 and 130 period SMA.

In reality they are the 5 and 10 day moving average.

Is there a way to add text after each moving average calling them a 5 day and 10 day?

Posted: 11 Dec 2008
by TJ
where do you want to add the text?

can you post a chart?

Posted: 11 Dec 2008
by flipflopper
See attached

Cut and Paste

Posted: 11 Dec 2008
by RobotMan
This should get you pointed in the right direction. It is kinda generic. You will need to use the code twice in the same indicator and rename the vars. You will probably want to use "ver 2".

Code: Select all

inputs:
Price(Close),
Length(20)
//, TText("My Avg") <-- ver 2
;

vars:
SpacerTxt(" "),
MAval(C), MAref(-1) ;

MAval = Average(Price,Length);

Plot1(MAval,"MovAvg");

If MAref <> -1 Then Text_SetLocation_s(MAref, Date, Time_s, MAval)
Else Begin
MAref = Text_New_s(Date, Time_s, MAval, SpacerTxt + NumToStr(MAval ,2) );
// MAref = Text_New_s(Date, Time_s, MAval, SpacerTxt + TText ); <-- ver 2
Text_SetStyle(MAref, 0, 2);
Text_SetColor(MAref, GetPlotColor(1));
End;

Posted: 11 Dec 2008
by TJ
I have added a bonus for you.

enjoy!

TJ

Posted: 11 Dec 2008
by RobotMan
TJ: Snazzy!

I was looking at what I posted and I thought:
It's funny how, when composing a post in the "reply window", everything is formatted and indented really nice and easy to read, but when you hit the submit button, the final post looks like sh!t.
Too bad we can attach everything but .pla files huh.

Posted: 11 Dec 2008
by TJ
TJ: Snazzy!

I was looking at what I posted and I thought:
It's funny how, when composing a post in the "reply window", everything is formatted and indented really nice and easy to read, but when you hit the submit button, the final post looks like sh!t.
Too bad we can attach everything but .pla files huh.
to format your code, you have to use the code button...
it is located in the middle of the Format list.
(you will see it when you are composing your message)

Posted: 11 Dec 2008
by RobotMan
Hi TJ

Nice. I edited my post and it looks better. Thanks!
I wish I could reduce the code font size though....

Posted: 11 Dec 2008
by flipflopper
Thanks for the help guys!!

Posted: 11 Dec 2008
by TJ
I have done one better... now with Auto-text.

The MA length is automatically inserted into the text... no need to adjust the text when you change your MA length.

enjoy!

Posted: 11 Dec 2008
by flipflopper
Very nice TJ. Thanks!!