Coding to receive buy or sell signals from HHLLS indicator

jalyo

New member
Hello,

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

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;

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

Administrative
Staff
VIP
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.
 

horserider

Well-known member
VIP
@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

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”);
 

whats up

Member
VIP
HHLLS indicator from TOS. Trying to put different time, but got stuck any input would be helpful first time trying to code.

Code:
declare lower;
input length = 20;
input over_bought = 60;
input signal_line = 50;
input over_sold = 10;
input averageType = AverageType.EXPONENTIAL;
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 HHS = 100 * MovingAverage(averageType, HH, length);
plot LLS = 100 * MovingAverage(averageType, LL, length);
plot OverBought = over_bought;
plot SignalLine = signal_line;
plot OverSold = over_sold;
HHS.SetDefaultColor(GetColor(6));
LLS.SetDefaultColor(GetColor(5));
OverBought.SetDefaultColor(GetColor(7));
SignalLine.SetDefaultColor(GetColor(7));
OverSold.SetDefaultColor(GetColor(7));


#input length = 20;
input agg = AggregationPeriod.DAY;
Assert(length > 1, "'length' must be greater than one: " + length);
def c = close(period = agg);
Assert(length > 1, "'length' must be greater than one: " + length);
 

BenTen

Administrative
Staff
VIP
@whats up Add the following script right below declare lower;

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);
 

whats up

Member
VIP
@whats up Add the following script right below declare lower;

Code:
input aggregationPeriod = AggregationPeriod.DAY;
def open = open(period = aggregationPeriod);
def high = high(period = aggregationPeriod);
def low = low(period = aggregationPeriod);
def close = close(period = aggregationPeriod);
thankyou benn really appreciate
 

Similar threads

Top