Help with EMA Bar Tread Label Script

Nightkiller

New member
It is a label on the top left of think or swim describing the current EMA trend

yzv6ysl.png
 
Last edited by a moderator:

Nightkiller

New member
Define a strong EMA trend and we'll code a label for you.
Awesome!thanks, let me go to the drawing board and think about how I will define each one. Im thinking I want to use 4 categories Strong Bearish Trend, Weak Bearish Trend, Weak Bullish Trend, and Strong Bullish Trend and the way those are defined are by certain EMAs above or below one another.
 

beardeddonut

New member
VIP
This is all I got so far. Looking to creat a trend bar label to show streanth of tread simulator to this:

aLvdR0E.png


Code:
#defines EMA values as random percentage.
#Will have to code the EMA inputs yourself to display useful data. Otherwise, color is just random.



def var = Round(Random(), 2);

#Labels turn lime if var is a certain percentage
AddLabel(yes, " ", if (var<=0.1) then color.lime else color.dark_red);
AddLabel(yes, " ", if (0.1<var && var <=0.2) then color.lime else color.red);
AddLabel(yes, " ", if (0.2<var && var <=0.3) then color.lime else color.magenta);
AddLabel(yes, " ", if (0.3<var && var <=0.4) then color.lime else color.dark_orange);
AddLabel(yes, " ", if (0.4<var && var <=0.5) then color.lime else color.orange);
AddLabel(yes, " ", if (0.5<var && var <=0.6) then color.lime else color.orange);
AddLabel(yes, " ", if (0.6<var && var <=0.7) then color.lime else color.yellow);
AddLabel(yes, " ", if (0.7<var && var<=0.8) then color.lime else color.dark_green);
AddLabel(yes, " ", if (0.8<var && var<=0.9) then color.lime else color.dark_green);
AddLabel(yes, " ", if (0.9<var && var<=1) then color.lime else color.dark_green);
#Displays result value for debugging
AddLabel(yes, "var: " + (var), color.cyan);
 

Similar threads

Top