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?
Need Help Putting Text On Chart
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
- RobotMan
- Posts: 375
- Joined: 12 Jul 2006
- Location: Los Altos, California, USA
- Has thanked: 31 times
- Been thanked: 13 times
- Contact:
Cut and Paste
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;
- Attachments
-
- MA with Text.txt
- (511 Bytes) Downloaded 513 times
Last edited by RobotMan on 11 Dec 2008, edited 1 time in total.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- RobotMan
- Posts: 375
- Joined: 12 Jul 2006
- Location: Los Altos, California, USA
- Has thanked: 31 times
- Been thanked: 13 times
- Contact:
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.
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.
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
to format your code, you have to use the code button...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.
it is located in the middle of the Format list.
(you will see it when you are composing your message)
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time
- TJ
- Posts: 7742
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
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!
The MA length is automatically inserted into the text... no need to adjust the text when you change your MA length.
enjoy!
- Attachments
-
- avg_w_autotext.txt
- (1.69 KiB) Downloaded 541 times
-
- Posts: 261
- Joined: 28 Feb 2008
- Has thanked: 2 times
- Been thanked: 1 time