Hull Moving Average Pack for ThinkorSwim

Y

ykd2018x

Member
2019 Donor
hey everyone ,

hope making money in good bull run recently , its time to prepare for pull back , whatever goes up fast , comes down with more speed

i was very very busy , not viewing post here or any warehouse relase as i like price indicators the most ,

below mentioned link showing weekly best indicator on trading view , if anyone like to code it for thinkorswim ??? seems good indicator for long term

send me a comment if we alrdy have it , i am leaving thinkorswim as my broker on dec 15th 2019 , they are not good for day trading at all

https://www.tradingview.com/script/...il&utm_term=0_d411e4719e-27477b8dda-277452033

reds
 
Last edited by a moderator:
D

diazlaz

Well-known member
2019 Donor
VIP
thanks how do you trade it or use It ;)
 
D

diazlaz

Well-known member
2019 Donor
VIP
took a pass at porting it:

HMA


EHMA


THMA


Ruby:
#Basic Hull Ma Pack tinkered by InSilico
#Original Port from https://www.tradingview.com/script/hg92pFwS-Hull-Suite
#
#2019.10.30 1.0 @diazlaz - Original Port
#

#INPUTS

input modeSwitch = {default "Hma", "Thma", "Ehma"}; #Hull Variation
input length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
input switchColor = yes; #Color Hull according to trend?
input candleCol = yes; #Color candles based on Hull's Trend?
input visualSwitch = yes; #Show as a Band?
input thicknesSwitch = 2; #Line Thickness
input showLabels = yes;
input src = close; #Source

addLabel (showLabels, modeSwitch, COLOR.ORANGE);
def na = Double.NaN;

# HMA

def hma;
switch (modeSwitch) {
case "Hma":
    hma = wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)));
case "Ehma":
    hma = expAverage(2 * expAverage(src, length / 2) - expAverage(src, length), round(sqrt(length)));
case "Thma":
    hma = wma(wma(src,(length/2) / 3) * 3 - wma(src, (length/2) / 2) - wma(src, (length/2)), (length/2));
}

# PLOTS

def HULL = hma;
def MHULL = HULL[0];
def SHULL = HULL[2];

plot Fi1 = MHULL;
Fi1.AssignValueColor(
if HULL > HULL[2] then COLOR.GREEN else COLOR.RED
);
Fi1.SetLineWeight(thicknesSwitch);

plot Fi2 = SHULL;
Fi2.AssignValueColor(
if HULL > HULL[2] then COLOR.GREEN else COLOR.RED
);
Fi2.SetLineWeight(thicknesSwitch);
Fi2.SetHiding(!visualSwitch);

AddCloud (if visualSwitch then Fi1 else na, Fi2);

# COLORBARS
AssignPriceColor(
if !candleCol then
Color.CURRENT
else
if HULL > HULL[2] then COLOR.GREEN else COLOR.RED
);

#END OF HULL

Please provide any feedback, bugs, backtests, experiences, optimizations on how to best use it.
 
netarchitech

netarchitech

Well-known member
VIP
Nicely done, @diazlaz ! Looking forward to seeing the three MA's in action :)
 
D

diazlaz

Well-known member
2019 Donor
VIP
Nicely done, @diazlaz ! Looking forward to seeing the three MA's in action :)

Please share you findings! All of you are generating lots of great ideas. Thanks for everyone's contributions.
 
S

SmellyCat

New member
I've looked at it with Crude on a daily chart with the 55 setting. It confirms a trend VERY well, however, it is a bit too slow for crude for an entry, but that is only crude. And when I change it to, say a 34 period, it generated a few too many whip saws on crude. But Heck! to confirm a trend like it does is awesome! it would keep someone in a swing trade much longer and it appears to capture much more of a longer swing trade if one could follow the past signals.
 
S

shizah

New member
@diazlaz - thanks for this great indicator. I'm trying to add alerts to it for when the color changes occur and can't get the code right. What would the correct thinkscript code be?
 
T

tomsk

Well-known member
VIP
@shizah I have modified @diazlaz Hull Pack study to add alerts. It now rings an alert whenever the color transitions from green to red or vice versa. Here is the revised study, I have tested it both ways on the /ES. Have fun
Code:
#Basic Hull Ma Pack tinkered by InSilico
#Original Port from https://www.tradingview.com/script/hg92pFwS-Hull-Suite
#
# 2019.10.30 1.0 [USER=258]@diazlaz[/USER] - Original Port
# 2019.11.14 2.0 [USER=1369]@tomsk[/USER]   - Added alerts for color bar transitions

input modeSwitch = {default "Hma", "Thma", "Ehma"}; #Hull Variation
input length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
input switchColor = yes; #Color Hull according to trend?
input candleCol = yes; #Color candles based on Hull's Trend?
input visualSwitch = yes; #Show as a Band?
input thicknesSwitch = 2; #Line Thickness
input showLabels = yes;
input src = close; #Source

addLabel (showLabels, modeSwitch, Color.ORANGE);

def hma;
switch (modeSwitch) {
case "Hma":
    hma = wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)));
case "Ehma":
    hma = expAverage(2 * expAverage(src, length / 2) - expAverage(src, length), round(sqrt(length)));
case "Thma":
    hma = wma(wma(src,(length/2) / 3) * 3 - wma(src, (length/2) / 2) - wma(src, (length/2)), (length/2));
}

def hull = hma;
def Mhull = hull[0];
def Shull = hull[2];
def transition = hull > hull[2];

plot Fi1 = Mhull;
Fi1.AssignValueColor(if transition then Color.GREEN else Color.RED);
Fi1.SetLineWeight(thicknesSwitch);

plot Fi2 = Shull;
Fi2.AssignValueColor(if transition then Color.GREEN else Color.RED);
Fi2.SetLineWeight(thicknesSwitch);
Fi2.SetHiding(!visualSwitch);

AddCloud (if visualSwitch then Fi1 else Double.NaN, Fi2);
AssignPriceColor(if !candleCol then Color.CURRENT else if transition then COLOR.GREEN else COLOR.RED);

Alert((!transition[1] and transition) or (transition[1] and !transition), "Hull Color Change", Alert.BAR, Sound.RING);
# END
 
T

tomsk

Well-known member
VIP
@tomsk How do you post this study as a scan?


@mailbagman2000 Here is the study converted into a scan. Note that there are two plot statements in the scan. I have configured this for the bullish case. If you'd like to use the bullish bearish scan, just comment out the bullish scan and uncomment the bearish scan. All this is listed at the end of the file. In case you're not sure, please read the following post.

https://usethinkscript.com/threads/how-to-use-the-tos-scanner.284/#post-10505
Here then is your COMPLETED scan code. I have tested this against a scan of the S&P 500 using daily aggregation a few minutes ago. A bullish scan has 4 results while a bearish scan has 5 results.

Code:
# Basic Hull Ma Pack Scan
# tomsk
# 12.27.2019

# Basic Hull Ma Pack tinkered by InSilico
# Original Port from https://www.tradingview.com/script/hg92pFwS-Hull-Suite

input modeSwitch = {default "Hma", "Thma", "Ehma"}; #Hull Variation
input length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
input src = close; #Source

def hma;
switch (modeSwitch) {
case "Hma":
    hma = wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)));
case "Ehma":
    hma = expAverage(2 * expAverage(src, length / 2) - expAverage(src, length), round(sqrt(length)));
case "Thma":
    hma = wma(wma(src,(length/2) / 3) * 3 - wma(src, (length/2) / 2) - wma(src, (length/2)), (length/2));
}

def hull = hma;
def transition = hull > hull[2];

# Delete (#) the plot not needed

plot scanBull = !transition[1] and transition;
#plot scanBear = transition[1] and !transition;

# End Basic Hull Ma Pack Scan
 
M

mailbagman2000

Member
@mailbagman2000 Here is the study converted into a scan. Note that there are two plot statements in the scan. I have configured this for the bullish case. If you'd like to use the bullish bearish scan, just comment out the bullish scan and uncomment the bearish scan. All this is listed at the end of the file. In case you're not sure, please read the following post.

https://usethinkscript.com/threads/how-to-use-the-tos-scanner.284/#post-10505
Here then is your COMPLETED scan code. I have tested this against a scan of the S&P 500 using daily aggregation a few minutes ago. A bullish scan has 4 results while a bearish scan has 5 results.

Code:
# Basic Hull Ma Pack Scan
# tomsk
# 12.27.2019

# Basic Hull Ma Pack tinkered by InSilico
# Original Port from https://www.tradingview.com/script/hg92pFwS-Hull-Suite

input modeSwitch = {default "Hma", "Thma", "Ehma"}; #Hull Variation
input length = 55; #Length(180-200 for floating S/R , 55 for swing entry)
input src = close; #Source

def hma;
switch (modeSwitch) {
case "Hma":
    hma = wma(2 * wma(src, length / 2) - wma(src, length), round(sqrt(length)));
case "Ehma":
    hma = expAverage(2 * expAverage(src, length / 2) - expAverage(src, length), round(sqrt(length)));
case "Thma":
    hma = wma(wma(src,(length/2) / 3) * 3 - wma(src, (length/2) / 2) - wma(src, (length/2)), (length/2));
}

def hull = hma;
def transition = hull > hull[2];

# Delete (#) the plot not needed

plot scanBull = !transition[1] and transition;
#plot scanBear = transition[1] and !transition;

# End Basic Hull Ma Pack Scan
thanks will try and see how it works out.
 
C-Note Johnson

C-Note Johnson

New member
I found this indicator for TradingView. Looks like it has potential. I tried to copy and paste it into ToS script editor. It puked. I was wondering if there was a way to convert it to ToS script. The pine code is below. Thanks, C-Note Johnson
Code:
//@version=4
study(title = "Hull VWMA", shorttitle="HVWMA", overlay = true)
len = input(8, minval=1)
src = input(close, title="Source")
lsrc = log(src)
geometric = input(type=input.bool,defval=false)
linewidth = input(3,minval=1)

corrvol = nz(volume) + 1  // Makes it properly handle charts where volume is only available for part of its history.
volume_wma(series,length) => wma(series*corrvol,length)/wma(corrvol,length)
volume_hma(series,length) => wma(2*volume_wma(series, length/2)-volume_wma(series, length), round(sqrt(length)))
oscillator_coloring(series) => series > 0 ? color.green : color.red

volume_hullma =  volume_hma(geometric ? lsrc : src,len)
out = geometric ? exp(volume_hullma) : volume_hullma
plot(out,color=oscillator_coloring(change(out)),linewidth=linewidth,title="Vol. Weighted Hull MA")
 
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
Came across this Hull streategy and its working very well... https://tos.mx/XJnywQ4



Code:
#  One Note Download
addOrder(OrderType.BUY_AUTO, no);input price = close;
input length = 49;
input displace = 0;

plot HMA = MovingAverage(AverageType.HULL, price, length)[-displace];

HMA.DefineColor("Bullish", GetColor(1));
HMA.DefineColor("Bearish", GetColor(0));
HMA.AssignValueColor(if HMA > HMA[1] then HMA.color("Bullish") else HMA.color("Bearish"));
AssignPriceColor(if HMA > HMA[1] then HMA.color("Bullish") else HMA.color("Bearish"));
addOrder(OrderType.BUY_AUTO, HMA crosses above HMA[1]);
addOrder(OrderType.Sell_AUTO, HMA crosses below HMA[1]);
 
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
NICE THANKS, Big fan of hull horserider wrote a hull script not sure how this differs from his version?
 
Last edited:

Similar threads

Top