mbarcala
Active member
I'm using this TMO label that show me some information about the signal, i want to add another detail in my label that tells me when the signal goes ob and os, i try few ideas but every time only show me one, like if the signal is above 0 and above ob only show me one but not both, can some one give me an idea how to write this part?
My label tells me when the signal is rising or falling and if its over 0 or below -0 and what I was trying to add inside the label is that let me know if its above 10 or below -10 too. Something like TMO above 0 and over 10, same for below?
My label tells me when the signal is rising or falling and if its over 0 or below -0 and what I was trying to add inside the label is that let me know if its above 10 or below -10 too. Something like TMO above 0 and over 10, same for below?
Code:
# TMO Label
def length = 14;
def calcLength = 5;
def smoothLength = 3;
def ob = if isNaN(close) then Double.NAN else round(length * .7);
def os = if isNaN(close) then Double.NAN else -round(length * .7);
def data = fold i = 0 to length with s do s + (if close > getValue(open, i) then 1 else if close < getValue(open, i) then - 1 else 0);
def EMA5 = ExpAverage(data, calcLength);
def Main = ExpAverage(EMA5, smoothLength);
def Signal = ExpAverage(Main, smoothLength);
def riUp = main >= main[1];
def faDn = main < main[1];
AddLabel(yes,
if riUp and main and signal < 0 then " TMO Rising Below: " + " -0 " + " " else
if riUp and main and signal > 0 then " TMO Rising Above: " + " 0 " + " " else
if faDn and main and signal > 0 then " TMO Falling Above " + " 0 " + " " else
if faDn and main and signal < 0 then " TMO Falling Below " + " -0 " + " " else " ",
if riUp and main and signal < 0 then Color.Dark_GREEN else
if riUp and main and signal > 0 then Color.GREEN else
if faDn and main and signal > 0 then Color.DARK_RED else
if faDn and main and signal < 0 then Color.RED else Color.CURRENT);
Last edited by a moderator: