Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

tbalanco

Help with Moving Average Label

Recommended Posts

Hi,

 

I was wondering if there is a script or a way to display the number of the moving average graphically on the moving average line?

 

Here is a screen shot of my Tradestation daily chart mocked up with what I would like to do: 2011-09-28_1630 - Tem_B's library

 

Any code out there that can help with this?

 

Thank you in advance.

 

Tem

 

posting the same question multiple time will not get you answers any quicker.

Share this post


Link to post
Share on other sites
Hi,

 

I was wondering if there is a script or a way to display the number of the moving average graphically on the moving average line?

 

Here is a screen shot of my Tradestation daily chart mocked up with what I would like to do: 2011-09-28_1630 - Tem_B's library

 

Any code out there that can help with this?

 

Thank you in advance.

 

Tem

 

Try this:

 

inputs:  Price( Close ), Length( 9 );
variables:  Avg( 0 ) ;

Avg = AverageFC( Price, Length ) ;

plot1(Avg, "MA");

Once
Begin
Value1=Text_new(D, T, H, "Start");
End;

Text_SetString(Value1, "         " +  NumToStr(Length,0));
Text_SetLocation(Value1, D, T, Avg);
Text_SetColor(Value1, Red);

Share this post


Link to post
Share on other sites

Hi,

 

I appreciate your assistance. Would you mind showing me how I can edit my existing standard code in Tradestation included below with your suggestion?

 

Again, I would greatly appreciate it. Unfortunately, not a programmer even at this basic level.

 

My Code from Tradestation standard 3 averages:

 

 

inputs:

Price( Close ),

FastLength( 4 ),

MedLength( 9 ),

SlowLength( 18 ),

Displace( 0 ) ;

 

variables:

FastAvg( 0 ),

MedAvg( 0 ),

SlowAvg( 0 ) ;

 

FastAvg = AverageFC( Price, FastLength ) ;

MedAvg = AverageFC( Price, MedLength ) ;

SlowAvg = AverageFC( Price, SlowLength ) ;

 

if Displace >= 0 or CurrentBar > AbsValue( Displace ) then

begin

Plot1[Displace]( FastAvg, "FastAvg" ) ;

Plot2[Displace]( MedAvg, "MedAvg" ) ;

Plot3[Displace]( SlowAvg, "SlowAvg" ) ;

 

{ Alert criteria }

if Displace <= 0 then

begin

Condition1 = Price > FastAvg and FastAvg > MedAvg and MedAvg > SlowAvg ;

if Condition1 and Condition1[1] = false then

Alert( "Bullish alert" )

else

begin

Condition2 = Price < FastAvg and FastAvg < MedAvg and MedAvg < SlowAvg ;

if Condition2 and Condition2[1] = false then

Alert( "Bearish alert" ) ;

end ;

end ;

end ;

Share this post


Link to post
Share on other sites

Paste this code at end of the indicator

{------------------------------------------------------------------------------}

Once Begin

Value1 = Text_new(D, T, H, "FastLength1");

Value2 = Text_new(D, T, H, "MedLength");

Value3 = Text_new(D, T, H, "SlowLength");

End;

 

Text_SetString(Value1, " [" + NumToStr(FastLength,0) + "]");

Text_SetLocation(Value1, D, T, FastAvg);

Text_SetColor(Value1, Red);

Text_SetStyle(Value1, 0, 2) ;

 

Text_SetString(Value2, " [" + NumToStr(MedLength,0) + "]");

Text_SetLocation(Value2, D, T, MedAvg);

Text_SetColor(Value2, Red);

Text_SetStyle(Value2, 0, 2) ;

 

Text_SetString(Value3, " [" + NumToStr(SlowLength,0) + "]");

Text_SetLocation(Value3, D, T, SlowAvg);

Text_SetColor(Value3, Red);

Text_SetStyle(Value3, 0, 2) ;

 

{------------------------------------------------------------------------------}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.