Repaints Hull Moving Average Turning Points and Concavity (2nd Derivatives)

Repaints
Status
Not open for further replies.

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

but as some of us have tested it out, the max min will keep repainting. What does not repaint is the hull line and colors, so watch for together wholesomely.

Once all are in confluence, there's your⬆️⬆️⬇️⬇️⬅️➡️⬅️➡️🅱️🅰️
 
@mashume trying to use your lower study scan code. Looks like the signals are coming back a few days after on the scans. I am looking to get daily signals from the lower study
 
@kshires4

You may have an out-of-date version of the code. Please check to see what version number is in your code. I think the most recent is V3.

happy trading
mashume
 
@mashume This is what I have: looks like version 3 - Is this giving a signal from the lower_hull_moving average?

Code:
script ConcavityDivergence {
#
# Hull Moving Average Concavity Divergence
#  or
# The Second Derivative of the Hull Moving Average
#
# Author: Seth Urion (Mahsume)
# Version: 2020-02-21 Initial Public
#
# This code is licensed (as applicable) under the GPL v3
#
# ----------------------

declare lower;

input price = HL2;

input HMA_length = 34;
input lookback = 2;

def HMA = HullMovingAvg(length = HMA_length, price = price);

def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;

def next_bar = HMA[1] + delta_per_bar;

def concavity = if HMA > next_bar then 1 else -1;

plot zero = 0;
zero.setdefaultcolor(color.gray);
zero.setpaintingstrategy(PaintingStrategy.DASHES);

plot divergence = displacer(-1, HMA - next_bar);
divergence.setDefaultColor(Color.LIME);
divergence.SetLineweight(2);

plot cx_up = if divergence crosses above zero then 0 else double.nan;
cx_up.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_up.SetDefaultColor(Color.LIGHT_GREEN);
cx_up.SetLineWeight(4);

plot cx_down = if divergence crosses below zero then 0 else double.nan;
cx_down.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_down.SetDefaultColor(Color.RED);
cx_down.SetLineWeight(4);

}

def signal = ConcavityDivergence("hma length" = 55)."concavity";
def HMA = ConcavityDivergence("hma length" = 55)."HMA";
def next = ConcavityDivergence("hma length" = 55)."next_bar";

plot buy = signal < 0 and (HMA - next) > (HMA[1] - next[1]);
 
Try this, you're script is a bit out of date

Code:
script ConcavityDivergence {
#
# Hull Moving Average Concavity Divergence
#  or
# The Second Derivative of the Hull Moving Average
#
# Author: Seth Urion (Mahsume)
# Version: 2020-03-23 V4
#
# This code is licensed (as applicable) under the GPL v3
#
# ----------------------

declare lower;

input price = HL2;

input HMA_length = 55;
input lookback = 2;

plot HMA = HullMovingAvg(length = HMA_length, price = price);

def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;
plot next_bar = HMA[1] + delta_per_bar;

plot concavity = if HMA > next_bar then 1 else -1;
}

def signal = ConcavityDivergence("hma length" = 55)."concavity";
def HMA = ConcavityDivergence("hma length" = 55)."HMA";
def next = ConcavityDivergence("hma length" = 55)."next_bar";

plot buy = signal < 0 and (HMA - next) > (HMA[1] - next[1]);


This is a hacked down version just for a scanner. Don't use this script as a plotting indicator.
-mashume
 
Last edited:
@madeinnyc
The current version is Version: 2020-02-23 V3
You can find the code in post 1 of this thread.

I'm not sure whether the shared link is up to date (I'm fairly sure it's not), but the code is. Copy and paste it over the code in the indicator and you should be good.

mashume
 
Watchlist code in post #94 is not working for me. All I get is dark green for all securities in my watchlist. It doesn't sync with the upper code. BTW, awesome code.

bGPt4eO.jpg
 
Last edited by a moderator:
@bobomatic
That is odd. They work for me. Do check that the aggregation period
1. set it by clicking the gear icon in your watchlist,
2. select 'customize...'
3. click the scroll next to Concavity and then
4. select the period to match your chart (or whatever you'd like it to be) from the dropdown at the top left of the script window.

If it still isn't working for you, we can try some further investigation. The values it's showing seem kinda big for some reason. You can also try pasting this code into that script window from step 4. I modded the text colors to be clearer, and multiplied the number displayed by a large factor to make it more human readable (fewer 0.0 kind of things, as the numbers can be REALLY small... 5x10^-5)

Code:
script ConcavityDivergence {
#
# Hull Moving Average Concavity Divergence
#  or
# The Second Derivative of the Hull Moving Average
#
# Author: Seth Urion (Mahsume)
# Version: 2020-02-23 V3
# Watchlist Column 2020-03-24 V2
#
# This code is licensed (as applicable) under the GPL v3
#
# ----------------------

declare lower;

input price = HL2;

input HMA_length = 55;
input lookback = 2;

plot HMA = HullMovingAvg(length = HMA_length, price = price);

def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;

def next_bar = HMA[1] + delta_per_bar;

def concavity = if HMA > next_bar then 1 else -1;

plot zero = 0;
zero.setdefaultcolor(Color.LIGHT_GRAY);
zero.setpaintingstrategy(PaintingStrategy.DASHES);

plot divergence = HMA - next_bar;
divergence.setDefaultColor(Color.LIME);
divergence.SetLineweight(2);

plot cx_up = if divergence crosses above zero then 0 else double.nan;
cx_up.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_up.SetDefaultColor(Color.LIGHT_GREEN);
cx_up.SetLineWeight(4);

plot cx_down = if divergence crosses below zero then 0 else double.nan;
cx_down.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_down.SetDefaultColor(Color.RED);
cx_down.SetLineWeight(4);

plot good_momentum = 0.32 * highest(divergence, HMA_Length * 2);
good_momentum.SetPaintingStrategy(PaintingStrategy.LINE);
good_momentum.SetStyle(Curve.SHORT_DASH);
good_momentum.SetDefaultColor(Color.GREEN);

plot bad_momentum = 0.32 * lowest(divergence, HMA_Length * 2);
bad_momentum.SetPaintingStrategy(PaintingStrategy.LINE);
bad_momentum.SetStyle(Curve.SHORT_DASH);
bad_momentum.SetDefaultColor(Color.RED);


}
plot data = ConcavityDivergence().divergence * 10000;
def HMA = ConcavityDivergence().HMA;

data.AssignValueColor(if data >= 0 then if HMA > HMA[1] then Color.BLACK else Color.WHITE else if HMA > HMA[1] then color.BLACK else color.WHITE);
AssignBackgroundColor(if data >= 0 then if HMA > HMA[1] then Color.GREEN else Color.DARK_GREEN else if HMA > HMA[1] then color.DARK_ORANGE else color.DARK_RED);
 
@mashume are there major difference between the versions? Because i use the first one

The largest difference is that the original version compared the current bar to the next bar. The current version compares the current bar to the last bar. It's a minor technical niggle, but it seemed to speed up the response for whatever reason. If you're happy with the signals from the Inital Public V1, you're welcome to continue using it. There are no fundamental changes to the nature of the indicator.

mashume
 
@asragov et al,
Links to new (faster versions):

UPPER
https://tos.mx/ljjgn40

LOWER
https://tos.mx/Y8VY8RA

Upper includes alert, lower does not.

@codydog, thank you for your kind words. I'm intrigued with the Leavitt Convolution... Homework. :) I do this a lot for the maths I'm afraid. It means a lot that the tool I've shared here is both somewhat useful, but also extensible -- that the math behind it works given any reasonable input.

SCANS
AFTER loading the new versions, and being careful with the names. %-\ You should be able to create new filter scans.
In the scans tab:
  1. Add a Filter
  2. Choose Study
  3. In the left-most dropdown which defaults to ADX Crossover or something select Custom...
  4. Click ThinkScript Editor near the top of the window
  5. Paste this code:
Code:
Concavity("hma length" = 55)."buy" is true within 1 bars

or this code:

Code:
def signal = ConcavityDivergence("hma length" = 55)."concavity";
def HMA = ConcavityDivergence("hma length" = 55)."HMA";
def next = ConcavityDivergence("hma length" = 55)."next_bar";

plot buy = signal < 0 and (HMA - next) > (HMA[1] - next[1]);

Adjust as needed. The second won't show you things that are at a BUY, it shows things that currently have negative concavity, but the moving in a direction that may signal a buy sooner or later (if at all, of course).

Good Luck, and Happy Trading.
Mashume
Says Concavity ("hma length") =55 is invalid
 
@mailbagman2000
The code I have in my scanner looks like this:

Code:
Concavity("price" = close, "hma length" = 55)."buy" is true

You may adjust close to be HL2 or whatever suits you. The important thing, I think from your last post, is that all the parameters are inside the parenthesis.

Hope that helps.

-mashume
 
Has anyone made any money on this (even paper money is good), Would you be kind enough to share your exact process and entry & exit steps. Also share any specific settings/setup with which you have been able to avoid "multiple quick entry and exit signals in the consolidation phase".


P.S Refrain from posting any theoretical systems or hypothetical examples.

@mashume

@JB7 - I use it in conjunction with zscore and it works well. Its not a stand alone tool though.

My style is much more short term, higher trade volume than many others. I also consider break even trades important versus the traditional win/loss many folks go on and on about. I refer you to Greg Laughlin's comment "Insights into high frequency trading...", esp page 3 table for more background.

I use it on a 1 day, 2 min chart, with -
hma length = 13, lookback =1,

I also switched from HMA to EHMA.

imo, if any of the "gurus" try to sell you their stuff, and say how rich they are from using any indicator, I'd ask for their 1040, signed by a reputable CPA firm. And same for me, I may think I know what I'm doing or I may be Bozo's first cousin - you simply don't know - so massive grain of salt with my comments and never forget its your money.

Happy trading!
 
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
591 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top