Hull Moving Average Pack for ThinkorSwim

Y

ykd2018x

Member
VIP
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



reds
 
Last edited by a moderator:
D

diazlaz

Active member
VIP
Warehouse
thanks how do you trade it or use It ;)
 
D

diazlaz

Active member
VIP
Warehouse
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
Warehouse
Nicely done, @diazlaz ! Looking forward to seeing the three MA's in action :)
 
D

diazlaz

Active member
VIP
Warehouse
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
Warehouse
@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

#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
# 2019.11.14 2.0 @tomsk - 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
 

Top