Set text and color of label for price above or below ema


Category:
0
0

Hello Hahn,

I wanted to know if you could create a chart label for the 5 minute chart. The label conditions should be

 

If the price (close) is above the 9EMA on chart, THEN label should say “COVER SHORT” with a green background)

If the price (close) is below the 9EMA on chart, THEN label should say “Ready for SHORT” with a red background).

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on August 14, 2018 11:30 am
117 views
0

The email you have entered for this user account is invalid. This prevents me from contacting you when changing the title and url of your posts. I will not respond to this post until a valid email address is updated on your user profile (find the link to your profile in the upper left corner of the site, under the heading “User Settings”).

( at August 14, 2018 1:43 pm)
0

sorry fixed

( at August 14, 2018 2:14 pm)
0
Private answer

This request is so similar to several others that I seriously considered just linking to those previous posts. Seems that after showing so many different examples of how to do this…..

I understand. It seems easy to me because this is what I do for a living. It is what I love to do and I am very grateful to have an audience to serve.

input length = 9;
def ema = ExpAverage(close, length);
AddLabel(yes, if close > ema then "COVER SHORT" else "Ready for SHORT", if close > ema then Color.GREEN else Color.RED);

Best of luck to you in your trading!

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on August 14, 2018 2:50 pm
0

You are the best ?

( at August 14, 2018 3:51 pm)
0

To expand on this request, and modify the code

If the price (close) is below the 9EMA on chart AND the daily volume is over 1.5mil, THEN label should say “Ready for SHORT” with a red background)

( at August 22, 2018 12:27 pm)
0

This modification would create a third condition. You will need to define the text and background color you would use when close is less than ema but volume is less than 1.5 mil.

( at August 22, 2018 12:31 pm)
0

when close is less than ema but volume is less than 1.5 mil.= red back ground (Ready for short)

when close is above ema regardless of volume= (grey background) DO NOT SHORT

when the close is above the ema with more than 1.5mil volume= (grey background) DO NOT SHORT Volume over limit!

( at August 22, 2018 2:31 pm)
0

I am completely confused now. Taking your entire list of specifications into account I have the following list:

1. Close is above the 9EMA: “COVER SHORT”
2. Close is below the 9EMA: “Ready for SHORT”
3. Close is below the 9EMA AND the daily volume is over 1.5mil: “Ready for SHORT”
4. Close is less than ema but volume is less than 1.5 mil: “Ready for short”
5. Close is above ema regardless of volume: “DO NOT SHORT”
6. Close is above the ema with more than 1.5mil volume: “DO NOT SHORT Volume over limit!”

Items 1 and 5 are contradictory. Items 2 and 3 are identical. I believe this has gone completely off the rails. This is going to confuse everyone trying to follow this post. I do not wish to continue.

( at August 22, 2018 9:07 pm)