Hull MA Scanner

H

HighBredCloud

Well-known member
VIP
Can someone who is proficient in coding make a scan for this particular Hull MA for both Bullish and Bearish conditions? This particular Hull MA is not based on the color change from negative to positive or vice versa but rather when the candle pierces through the moving average above or below the line...This would allow for a possible quicker entry/exit for a swing trade. Ideal for daily charts. Thanks.

Code:
plot Data = close;#Hull Moving Average
#Colors and arrows and labels by EBTrader 02.22.15

input price = close;
input length = 20;
input displace = 0;

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

HMA.DefineColor("Up", color.green);
HMA.DefineColor("Down", color.red);
HMA.AssignValueColor(if price > HMA then HMA.color("Up") else HMA.color("Down"));
AssignPriceColor(if price > HMA then HMA.color("Up") else HMA.color("Down"));

#===================start arrows and labels

input crossingType = {default any, above, below};
def signal = CompoundValue(1, if crosses(price, HMA,crossingDirection.ABOVE) then 1 else if crosses(price, HMA, crossingDirection.BELOW)  then -1 else signal[1], 0);
input showarrows = yes;
plot U1 = showarrows and signal > 0 and signal[1] <= 0;
U1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
U1.SetDefaultColor(Color.green);
U1.SetLineWeight(3);
plot D1 = showarrows and signal < 0 and signal[1] >= 0;
D1.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
D1.SetDefaultColor(Color.red);
D1.SetLineWeight(3);

input usealerts = no;
Alert(usealerts and U1, "UP", Alert.BAR, Sound.Bell);
Alert(usealerts and D1, "DOWN", Alert.BAR, Sound.Chimes);

def uptrend = price > HMA;
def downtrend = price < HMA;

addlabel(uptrend, "Uptrend", color.green);
addlabel(downtrend, "Downtrend", color.red);




#================end arrows and labels
 
YungTraderFromMontana

YungTraderFromMontana

Well-known member
Code:
#Hull Moving Average
#Colors and arrows and labels by EBTrader 02.22.15

input price = high;
input length = 20;
input displace = 0;

def HMA = MovingAverage(AverageType.HULL, price, length)[-displace];
def uptrend = price > HMA;
def downtrend = price < HMA;



plot bullish = (price[1] < hma) and (price > hma)


#================end arrows and labels
I think this should do it. For bearish just swap < and > on the plot.
 
Last edited:
H

HighBredCloud

Well-known member
VIP
@YungTraderFromMontana cool...thank you...Let me check this out in live market tomorrow...and just to double check this scan is based on the candle crossing the MA line and not the color change of the Hull MA?
 
YungTraderFromMontana

YungTraderFromMontana

Well-known member
@YungTraderFromMontana cool...thank you...Let me check this out in live market tomorrow...and just to double check this scan is based on the candle crossing the MA line and not the color change of the Hull MA?
If I understood you right then yes, I essentially made a scan that will scan for tickers if the high crosses the hma. I used high instead of close so you can use it midday and pick up on stocks that crossed so you don't have to wait for until close for confirmation on the scan.
 
H

HighBredCloud

Well-known member
VIP
If I understood you right then yes, I essentially made a scan that will scan for tickers if the high crosses the hma. I used high instead of close so you can use it midday and pick up on stocks that crossed so you don't have to wait for until close for confirmation on the scan.
I think that's what I wanted. And I say that only because I am not a coder and I don't know the logic that needs to be used for such a scan. Hence my previous question.

So as long as the scan you made by using the high instead of the close allows for such a color change to come on quicker instead of the standard Hull than that is exactly what I wanted. Please refer to the picture below... Thank You once again...Can't wait to use it.

The GREEN/RED candles represent the Hull from the script that I provided vs the traditional magenta and cyan Hull Ma...

 
H

HighBredCloud

Well-known member
VIP
@YungTraderFromMontana So I tried to use the scanner today...and I am having some issues...Please take a look at the pic below...looks like there are two plots...not sure how to fix that. Could you please take a look at this code again and fix it...? I wouldn't know where to begin.

 
YungTraderFromMontana

YungTraderFromMontana

Well-known member
@YungTraderFromMontana So I tried to use the scanner today...and I am having some issues...Please take a look at the pic below...looks like there are two plots...not sure how to fix that. Could you please take a look at this code again and fix it...? I wouldn't know where to begin.

change the top plot to a def. Make sure only the last line of code is a plot. I fixed the code in the previous post.
 

Similar threads

Top