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

Repaints
Status
Not open for further replies.
@mashume

Hi, was watching the 'new' version and was wondering what you thought about this idea - as sometimes it gives a false positive - incorporate a money flow filter and to avoid the always in the mkt syndrome, have open long, close long, open short, close short, to allow money flow to develop (or some other filter) to filter out the chop.

Thanks and happy trading!
 

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

@codydog

I think some sort of filter is probably advisable for actually trading the indicator. At least some stop loss for long trades.

With that in mind, I've been playing around on tick charts with the Leavitt Convolution Slope indicator tracking VOLUME. I'm not sure quite how to implement it into a trading strategy.

I've been watching the Finite Volume Elements as an indicator to pair up with the HMA.
https://usethinkscript.com/threads/finite-volume-elements-fve-for-thinkorswim.596/

If you see some additional data point that provides a good signal confirmation, please do let us know. The fun of useThinkScript is the community around here.


@madeinnyc

I don't see any reason it won't. :)
 
'Doh

Good catch!

In the multi-average version, I renamed HMA to MA to tell myself I was working with any MovingAverage... The joys of managing software branches
 
@codydog

I think some sort of filter is probably advisable for actually trading the indicator. At least some stop loss for long trades.

With that in mind, I've been playing around on tick charts with the Leavitt Convolution Slope indicator tracking VOLUME. I'm not sure quite how to implement it into a trading strategy.

I've been watching the Finite Volume Elements as an indicator to pair up with the HMA.
https://usethinkscript.com/threads/finite-volume-elements-fve-for-thinkorswim.596/

If you see some additional data point that provides a good signal confirmation, please do let us know. The fun of useThinkScript is the community around here.


@madeinnyc

I don't see any reason it won't. :)

I use zscore for both price and money flow, as well as old fashioned money flow per bar.

If you're interested, I have Leavitt as a upper MA, could post it if you're interested.

I value the give and take of a community as well. I think some forget that folks like Virtu and Renaissance run every conceivable version of every indicator and can guess very accurately, what volumes will come in,so, the whole this is secret stuff, is laughable.
 
@codydog, I'd love to see what it looks like, thanks!

Not sure where this came from but --
Code:
# Leavitt, Jay A., PhD [2017]. “Beyond The Hull With Leavitt Projections,” Technical Analysis of StockS & commoditieS, Volume 35: February.

## orig n was 20

script LeavittProjection{
input y = close;
input n = 8;
rec x = x[1] + 1;
def a = (n * sum(x * y, n) - sum(x, n) * sum(y, n) ) / ( n *sum(Sqr(x), n) - Sqr(sum(x, n)));
def b = (sum(Sqr(x), n) * sum(y, n) - sum(x, n) * sum(x *y, n) ) / ( n * sum(Sqr(x), n) - Sqr(sum(x, n)));
plot LeavittProjection= a*x+ b;
}

script LeavittConvolution
{ input   price = close;
input n = 13;
def intLength = Floor(Sqrt(n));

plot LeavittConvolution = LeavittProjection (LeavittProjection (price, n), intLength);
}
def price = Close;
input length = 8;

def intLength = Floor(Sqrt(length));
plot LeavittConvolution = LeavittProjection (LeavittProjection (price, length), intLength);
LeavittConvolution.AssignValueColor(if LeavittConvolution > LeavittConvolution [1] then Color.blue else if LeavittConvolution < LeavittConvolution [1] then  Color.RED else color.white);
leavittConvolution.setlineweight(2);
leavittConvolution.hidebubble();

addlabel(1,"leavit " + round(leavittConvolution,2), if LeavittConvolution > LeavittConvolution [1] then Color.blue else if LeavittConvolution < LeavittConvolution [1] then  Color.RED else color.white);

#
Not sure if you saw this, but its interesting - "Insights into high frequency trading from the virtu ipo" by Greg Laughlin , esp page 3 . I have it in a pdf if its not online or paywalled.
 
Last edited by a moderator:
2020-02-26-TOS-CHARTS.png


@mashume Hi, I tried out your study on the chart above. After spending good time with the inputs, it seems Close, 55, 2 gave the best signals. What I'm trying to learn by posting is if it's possible to improve the exit points? For example, you'll notice the three red boxes. The first box on the left I marked with a red star. This is where I would ideally exit had the length of the bar fell below the previous bar. But even if the exit would have been on the next bar to the right, still ok! However, the signal given by the orange arrow is three bars later after the star bar. Whereas, when compared to the middle box, that orange arrow gave a perfect exit point. What caused the difference between both signals (Left & middle?).

I placed a star on the last box to the right signaling the ideal exit. But the reversal on this one was a staggering 56 points (measured from low-to-low), that finally triggered the blue arrow. There must be a way to improve the signaling function to avoid these types of reversals. I'm not sure there's much I can do with the inputs....but welcome any suggestions or thoughts. Thanks!
 
@madeinnyc, Glad you are trying it out. It is an interesting take on price action, no?

As to your question of speeding the exit signals, it could be done, perhaps by switching to a faster (shorter) length after entering the trade. But that would not really be the best approach. Looking at the case above, where the concavity flipped between 7:00 and 7:15, it is simply that the expected curve, given the tremendous slope change between 6:30 and 6:40 caused the expected next value to be high, and when it wasn't, the concavity flipped.

I've been experimenting with a 'damping' factor, balancing responsiveness and removal of false signals. I'm more, personally, concerned with why the indicator didn't gloss over the minor correction between 7:00 and 7:15 and issue a sell signal (as it did, but for the first time) at 7:50. That is where I would have preferred to see the signal initially.

If you'd like some insight into the state of damping, (mostly where it hasn't gotten to as yet) I offer the following screen of the same security and timeframe as you have up. Note the green and red dashed lines representing turning momentum. I'm working onmaking these adaptive, such that false (temporary or transitive only) concavity changes would be ignored.

DvfgvxM.png


As always, your best indicator is between your ears :)

Happy Trading
-mashume
 
@jvbaty

Check the version of the indicator you have to be certain whether to specify HMA_LENGTH or MA_LENGTH

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

This one is returning
NLOK, PRGO, CME, CHRW
this evening on the Daily scan

Not sure why yours isn't returning things, sorry.

mashume
 
I've seen a lot of indy's that backtest with a positive p/l that just fall apart when just forward testing. The backtest on this had some impressive results but if the entry signal isn't given until after one bar past where the signal shows, was the p/l calculated based on the bar where the signal was given or the bar where you would observe the signal (one bar later)? Has anyone tried forward testing this (I know its only been up a short time so the sample size will be very small) and if so, how'd it do? I guess this looks like it may have potential and I'm looking for some ideas on a real-world way to trade this. In any event, hats of to Mashume, I understood about 2/3 of your theory. Thats a top shelf brain you got there.
 
We all have favorite MAs, so, I've been running your script with HMA and EHMA, EHMA seems to lead by 1-2 bars, rarely they give opposing signals, but when they both agree on a bar, its like a NASA ignition. Using a setting of H+L/2 and 8,2 on a 1 day, 2min chart.

I think the wide swings many experience in current conditions can be decreased by using a simple trailing stop system and with such low commissions, maybe it makes sense to take smaller peices of the pie and let them add up.
 
If you really want something to bake your noodle....put hull strategies on a range chart (found in your timeframe settings). I have not with this one yet but will look at it over the weekend. I have had stellar results on backtesting those before.
 
If you really want something to bake your noodle....put hull strategies on a range chart (found in your timeframe settings). I have not with this one yet but will look at it over the weekend. I have had stellar results on backtesting those before.
Does ThinkorSwim ever offer range charts? I know Tradestation has them, but haven't seem them on TOS.
 
@madeinnyc, Glad you are trying it out. It is an interesting take on price action, no?

As to your question of speeding the exit signals, it could be done, perhaps by switching to a faster (shorter) length after entering the trade. But that would not really be the best approach. Looking at the case above, where the concavity flipped between 7:00 and 7:15, it is simply that the expected curve, given the tremendous slope change between 6:30 and 6:40 caused the expected next value to be high, and when it wasn't, the concavity flipped.

I've been experimenting with a 'damping' factor, balancing responsiveness and removal of false signals. I'm more, personally, concerned with why the indicator didn't gloss over the minor correction between 7:00 and 7:15 and issue a sell signal (as it did, but for the first time) at 7:50. That is where I would have preferred to see the signal initially.

If you'd like some insight into the state of damping, (mostly where it hasn't gotten to as yet) I offer the following screen of the same security and timeframe as you have up. Note the green and red dashed lines representing turning momentum. I'm working onmaking these adaptive, such that false (temporary or transitive only) concavity changes would be ignored.

DvfgvxM.png


As always, your best indicator is between your ears :)

Happy Trading
-mashume

Thanks Mashume! I appreciate the thought process of your reply! I watched it again today...as you know, major selloff which was perfect timing to take this for a test-drive. In particular, what concerned me were the signals given from 9:35 - 10:10 a.m. & 14:55 - 15.30 p.m. From the opening at 9:30 to 10:10 a.m., it was clear the market was choppy and sideways. But the afternoon from 13:30 pm onward was purely a downside selloff and false signals appeared. I know this is a work in progress and it came to mind to suggest adding features that avoids signals in choppy/sideways moves. Also perhaps adding something that smooths out the noise during periods of high volatility like today.

Regarding the Top HMA length feature: Does lengthening the window cause the indicator to calibrate each price change against a longer, more stable volatility window? Does shortening the window make the indicator more sensitive to brief swings in volatility? Or, how about adding an input tuning that uses changes in underlying volatility and price action to continually adjust internal rules so that minor disturbances of significant trends (like the p.m. today), do not fire false signals?

I know that strong trends typically end with statistically significant reversals in price action.....weaker trends are sensitive to smaller reversals. However, most of these changes are invisible on the price chart but can be tracked by the indicator. So the input I'm suggesting would change the indicator's behavior to match the strength of the trend and the sensitivity setting.
 
@madeinnyc Yes range bars are right where you pick your timeframe. Goto timeframe\range\ then you can pick ticks or ATR

Set it to 50 ticks 1 year on /ES with the 55 HMA strategy...$10 million over 87 trades of 100 contracts
 
Last edited:
@subharmonic Thanks for the guidance! I trade the /NQH20, so following your steps, of the two choices, ticks or ATR, the ATR provided less noise (false signals) vs. the 5 minute chart I was using with that study. I had never thought of using an ATR style chart until you mentioned it. I think this is something @mashume would like to see.....would love his thoughts on it too!
 
Last edited:
I usually trade on a tick chart covering one day or so (ticks set to something reasonable, but dependant on the security) -- I find ticks and Volume go well together, and give a good picture of the sizes of trades happening, -- with a general (hour or two x 5 or 10 days) for an overview, and a renko block chart on ATR. So yes, I like to see things in several forms at once. :)

It's a difficult thing to get signals to happen in real time, as the indicator requires a change in the concavity of the slope, akin to turning a corner, to be triggered, and without knowing how tightly the curve moves, you can't really know that you've gone 'round a corner. Such is the maths of this particular one. It is perhaps (but may repaint badly) able to be mitigated by using OPEN prices instead of close, as the open is fixed for the bar as soon as it starts. I don't have definitive answers, but thank your for your interest in this indicator.

-mashume
 
I understand the desire to trade at a millisecond level, with latest prices fresh off a MM desk - but- unless you're co-located at an exchange and are a major customer, you simply can't.
 
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
445 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