Value $ amount and arrow up and down for MA

Hi, can someone make this code for the MA to be display for MA $ value and also arrow up or down. Please see photo. I highlight in blue and yellow.
no , i have no idea what you are asking for.
write out some sentences to describe the rules that the study should follow and what you want to see on the chart.

top chart, guessing 3 average lines ?
lower chart , ?? no idea
 
  • 100 %
Reactions: LLP
no , i have no idea what you are asking for.
write out some sentences to describe the rules that the study should follow and what you want to see on the chart.

top chart, guessing 3 average lines ?
lower chart , ?? no idea
on the top part of the chart I put yellow arrow, and blue line, those are the $ value for SMA5 and it shows it is above SMA5 or below SMA5 with the arrow. All runs auto.
Example on the chart display:

SMA5 =$1163.00 , arrow down with Red color (means price is at $1163.00 and is below SMA5),
SAM10 = $11360,30 arrow up green color (means price is at $11360.00 and it is above SAM10,
SMA 20= $11369.60 , arrow up green color (means price is at $11369.60 and it is above SMA20)

Bottom is just a MACD display with:
DIF = 4.174 with red color arrow (means DIF is at 4.174 is down )
DEA = 3.867 with green color arrow (means DEA is at 3.867 is up)

KDJ is display with value + arrow :
K=51.39 with red arrow down (means K value is 51.39 is down)
D=56.1 with red arrow (means D value is 56.1 is down)
J= 41.827 with green arrow (means J value is 41.827 and is up)

It is from futumumu apps.
 
Do you understand :)


first, let me say i'm sorry for not responding months ago. i admit i am terrible about following up with posts.

------------------------------

...Do you understand ?
no , i'm still confused.

you went from 1 extreme to the other.
in post 1 you didn't write any descriptions.
in post3 you wrote a lot of words, that are confusing. you didn't explain 'what' is compared to 'what'.
i've seen this 100 times. someone has an idea in their head, and when they try to describe it, the words come out wrong. when writing a post, take your time, and reread it and edit it. try to pretend you are explaining it to someone who knows nothing about stocks.


...SMA5 =$1163.00 , arrow down with Red color (means price is at $1163.00 and is below SMA5),...
what price is at 1163?
if sma5 = 1163 , how can a price of 1163 be below it?


...SAM10 = $11360.30 arrow up green color (means price is at $11360.00 and it is above SAM10,...
just because sma10 is 11360.30 , doesn't cause another price to be 11360.
do you mean the stock price is 11360?
11360 is not greater than 11360.30...


the rest of the post is the same, vague and confusing.

here is my guess on what you want,
if the stock price is greater than an average price, a label is green, else it is red.

see how simple that is. no numbers, just a few words, that describe a comparison.

i hope this helps.

------------------------------

upper chart study

shows 3 labels on upper chart,
each label shows an average name (MA5) and its price.
the labels are colored based on,
.. if stock price is below the average price, it is red,
.. if stock price is above the average price, it is green,
.. if stock price is the same as the average price, it is white.

i added another label, that checks if the 3 averages are stacked, based on the average lengths.
if the ma1 > ma2 and ma2 > ma3 then green
if the ma1 < ma2 and ma2 < ma3 then red


Code:
# avg_value_up_down_00

def na = double.nan;
def bn = barnumber();
#def lastbar = !isnan(close[0]) and isnan(close[-1]);


def price = close;
input ma1_len = 5;
#input ma1_type =  AverageType.EXPONENTIAL;
input ma1_type =  AverageType.simple;
def ma1 = round(MovingAverage(ma1_type, price, ma1_len),2);

input ma2_len = 10;
input ma2_type =  AverageType.simple;
def ma2 = round(MovingAverage(ma2_type, price, ma2_len),2);

input ma3_len = 20;
input ma3_type =  AverageType.simple;
def ma3 = round(MovingAverage(ma3_type, price, ma3_len),2);

def stackup = (ma1 > ma2 and ma2 > ma3);
def stackdwn = (ma1 < ma2 and ma2 < ma3);


input show_avg_lines = yes;
plot z1 = if show_avg_lines then ma1 else na;
z1.setdefaultcolor(getcolor(1));
z1.hidebubble();
plot z2 = if show_avg_lines then ma2 else na;
z2.setdefaultcolor(getcolor(2));
z2.hidebubble();
plot z3 = if show_avg_lines then ma3 else na;
z3.setdefaultcolor(getcolor(3));
z3.hidebubble();


input show_labels = yes;
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "MA" + ma1_len + ": " + ma1, (if ma1 > close then color.red else if ma1 < close then color.green else color.white));
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "MA" + ma2_len + ": " + ma2, (if ma2 > close then color.red else if ma2 < close then color.green else color.white));
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "MA" + ma3_len + ": " + ma3, (if ma3 > close then color.red else if ma3 < close then color.green else color.white));
addlabel(show_labels, " ", color.black);


addlabel(show_labels, 
(if (stackup or stackdwn) then "Avgs stacked" else "--"),
(if stackup then color.green else if stackdwn then color.red else color.black));
#

ISV4wwi.jpg




===================================


lower charts

--------------------------

i don't know what KDJ is , so i can't help with that.

--------------------------

macd labels

...DIF = 4.174 with red color arrow (means DIF is at 4.174 is down )...
not sure what 'is down' means. i'll guess it is the price change from the previous bar.


i copied the code from MACD and added a couple formulas and labels.


Code:
# macd_value_up_down_00

# MACD
# TD Ameritrade

declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

#-----------------------------------

# compare current bar value to the value from previous bar
def isvalueup = (value > value[1]);
def isavgup = (avg > avg[1]);
def isdiffup = (diff > diff[1]);


input show_labels = yes;
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "MACD: " + value, (if isvalueup then color.green else color.red));
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "Avg: " + avg, (if isavgup then color.green else color.red));
addlabel(show_labels, " ", color.black);
addlabel(show_labels, "Diff: " + diff, (if isdiffup then color.green else color.red));
addlabel(show_labels, " ", color.black);
#
 
basically is a SMA box on top showing if the CLOSE PRICE is above the SMA value.
It will show if the current price is above the SMA 5/10/20/50 value $.

The box I circle in yellow.

example: TEAM, current price is $144.82, so it is above the SMA5 value, it appear as an UP ARROW GREEN with $133.65 ($133.65 is the minimum $ for the current price to meet in order for the price to cross above SMA5) , then if you see SMA50 line , it appear as DOWN ARROW with $165.29 (because for currently the price of TEAM is $144.82, is not reach the SMA50 value $)

 
# avg_value_up_down_00 def na = double.nan; def bn = barnumber(); #def lastbar = !isnan(close[0]) and isnan(close[-1]); def price = close; input ma1_len = 5; #input ma1_type = AverageType.EXPONENTIAL; input ma1_type = AverageType.simple; def ma1 = round(MovingAverage(ma1_type, price, ma1_len),2); input ma2_len = 10; input ma2_type = AverageType.simple; def ma2 = round(MovingAverage(ma2_type, price, ma2_len),2); input ma3_len = 20; input ma3_type = AverageType.simple; def ma3 = round(MovingAverage(ma3_type, price, ma3_len),2); def stackup = (ma1 > ma2 and ma2 > ma3); def stackdwn = (ma1 < ma2 and ma2 < ma3); input show_avg_lines = yes; plot z1 = if show_avg_lines then ma1 else na; z1.setdefaultcolor(getcolor(1)); z1.hidebubble(); plot z2 = if show_avg_lines then ma2 else na; z2.setdefaultcolor(getcolor(2)); z2.hidebubble(); plot z3 = if show_avg_lines then ma3 else na; z3.setdefaultcolor(getcolor(3)); z3.hidebubble(); input show_labels = yes; addlabel(show_labels, " ", color.black); addlabel(show_labels, "MA" + ma1_len + ": " + ma1, (if ma1 > close then color.red else if ma1 < close then color.green else color.white)); addlabel(show_labels, " ", color.black); addlabel(show_labels, "MA" + ma2_len + ": " + ma2, (if ma2 > close then color.red else if ma2 < close then color.green else color.white)); addlabel(show_labels, " ", color.black); addlabel(show_labels, "MA" + ma3_len + ": " + ma3, (if ma3 > close then color.red else if ma3 < close then color.green else color.white)); addlabel(show_labels, " ", color.black); addlabel(show_labels, (if (stackup or stackdwn) then "Avgs stacked" else "--"), (if stackup then color.green else if stackdwn then color.red else color.black)); #
I try your code on ticker: TEAM it didn't show the same result of the XQ apps
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
188 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top