coding to receive buy or sell signals from HHLLS indicator

J

jalyo

New member
Hello,

I have done the coding as the following for the HHLLS indicator:

def HHLLS = HHLLS (length = 8);

input length = 8;
input over_bought = 60;
input signal_line = 50;
input over_sold = 10;
input averageType = AverageType.HULL;

Assert(length > 1, "'length' must be greater than one: " + length);

def HH = if high > high[1] then (high - Lowest(high, length)) / (Highest(high, length) - Lowest(high, length)) else 0;
def LL = if low < low[1] then (Highest(low, length) - low) / (Highest(low, length) - Lowest(low, length)) else 0;

AddLabel(yes, if HH > signal_line and LL < over_sold then "VERY BULLISH" else if LL > signal_line and HH < over_sold then “VERY BEARISH”);


Basically, what Im trying to do is When the HH line crosses the signal_line, which is 50, above, and the LL line is below over_sold line, which is 10, it labels it as “bullish”. And When LL crosses above 50, and HH is below 10, it labels it as “Bearish”. I get an error message when I input this coding into thinkscript.

This is to be used for the “market watch” tab.

Thank You
 
BenTen

BenTen

Administrative
Staff
VIP
Warehouse
Add this to the end of your script

Code:
def Bullish_Signal =  HH > signal_line and LL < over_sold;
def Bearish_Signal = LL > signal_line and HH < over_sold;

plot bullish = bullish_signal;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(3);
plot bearish = bearish_signal;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.CYAN);
bearish.SetLineWeight(3);
See if it does anything.
 
H

horserider

Well-known member
VIP
Warehouse
@jalyo Are you sure the math works? Seems to make no plots. Anyway at bottom is code that might work for your labels. Since cannot even get a plot I have no idea if it works.
Code:
def HHLLS = HHLLS (length = 8);

input length = 8;
input over_bought = 60;
input signal_line = 50;
input over_sold = 10;
input averageType = AverageType.HULL;

Assert(length > 1, "'length' must be greater than one: " + length);

def HH = if high > high[1] then (high - Lowest(high, length)) / (Highest(high, length) - Lowest(high, length)) else 0;
def LL = if low < low[1] then (Highest(low, length) - low) / (Highest(low, length) - Lowest(low, length)) else 0;

plot HHline = HH;
HHline.setDefaultColor(GetColor(5));
plot LLline =LL;
LLline.setDefaultColor(GetColor(3));

AddLabel (HH crosses above signal_line and LL < over_sold, "Very Bullish",
(color.GREEN));
#GetColor(Label_Color_Choice));
AddLabel(LL crosses above signal_line and HH < over_sold, "VERY BEARISH", #GetColor(Label_Color_Choice));
(Color.RED));
 
LucidDreamer

LucidDreamer

New member
Error code at 14:79
Highlights the "if" in the:
AddLabel(yes, if HH > signal_line and LL < over_sold then "VERY BULLISH" else if LL > signal_line and HH < over_sold then “VERY BEARISH”);
 

Top