TradingView
alexgrover
30 de Sep. de 2019 17:31

T-Step LSMA 

Intel CorporationNASDAQ

Descripción

Introduction

The trend step indicator family has produced much interest in the community, those indicators showed in certain cases robustness and reactivity. Their ease of use/interpretation is also a major advantage. Although those indicators have a relatively good fit with the input price, they can still be improved by introducing least-squares fitting on their calculations. This is why i propose a new indicator (T-Step LSMA) which aim to gather all the components of the trend-step indicator family (including the auto-line family).

The indicator will use as a threshold the mean absolute error between the input and the output (T-Channel) scaled with the efficiency ratio (Efficient Trend Step) while using least squares in order to provide a better fit with the price (Auto-Filter).

The Indicator

The interpretation of the indicator is easy, the indicator estimate an up-trending market when in blue, down-trending when in orange, the signal only depend on the trend-step part (b in the code).

length control the period of the efficiency ratio as well as any components in the lsma calculation. The efficiency ratio allow to provide adaptivity, therefore the threshold will be lower when market is trending and higher when market is ranging.

Sc control the amount of feedback of the indicator, a value of 1 will use only the closing price as input, a value of 0.5 will use 50% of the closing price/indicator output as input, this allow to get smoother results.

It is possible to get the non-smooth version of the indicator by checking "No Smoothing".



This allow the indicator to filter more information.

Least Squares Smoothing - Benefits

One could ask why introducing least squares smoothing, there are several reasons to this choice, we have seen that trend-step indicators are boxy, they filter most of the variational information in the price, introducing least squares smoothing allow to gain back some of this variational information while providing a better fit with the price, the indicator is more noisy but also more practical in certain situations.

For example the indicator in its boxy form can't really be useful as input for other indicators, which is not the case with this version.



Relative strength index of period 14 using the proposed indicator as input.

Down-Sides

The indicator is dependent on the time frame used, larger time frames resulting in an indicator overfitting, sticking with lower time frames might be ideal. The indicator behavior might also change depending on the market in which it is applied.

Setting Up Alerts For The Indicator

Alerts conditions are already set, in order to create an alert based on the indicator follow these steps :

Go to the alert section (the alarm clock) -> create new alert -> select T-Step LSMA in condition -> Below select Up or Dn (Up for a up-trending alert and Dn for a down-trending alert)

In option select "once per bar close", change the message if you want a personalized message.

Conclusion

I don't think i'll post other indicators related to the trend-step framework for the time to comes, nonetheless the ones posted proven to have interesting results as well as many upsides. Although i don't think they would generate positive long-terms returns they could still be of use when using smarter volatility metrics as threshold. The proposed indicator conserve more information than its relatives and might find some use as input for other indicators.

Recommended Use Of The Code

Although i don't put restrictions on the code usage, i still recommend creative and pertinent changes to be made, graphical changes or any minor changes are not necessary, remember that such practice is disrespectful toward the author, you don't want to load up the tradingview servers for nothing right ?

Support Me

Making indicators sure is hard, it takes time and it can be quite lonely to, so i would love talking with you guys while making them :) There isn't better support than the one provided by your friends so drop me a message.

Notas de prensa

overlay error fixed, i apologize.
Comentarios
LucF
This is beautiful work, and pure added value to the TV Public Library. Love your approach to challenges, your capacity to focus on a very precise goal, and how you straight-talk us through your research. Your work provides is a model and inspiration for coders on TV. I hope you publish for a very long time to come. Respect, Alex.
alexgrover
@LucF, Thanks for the comment, i guess the trend step indicator family was a pretty good thing to post ,i hope to propose many more indicators in the future. Its always great to read your support :)
Junglistt
It's amazing what you can do with such concise code! Excellent work from someone with obviously a deep understanding of the topic!! Keep up the good work, it is greatly appreciated!
alexgrover
@Junglistt, Thanks for the kind words, i assume the code could possibly shortened but i guess its fine to leave as it is right now.
Pratik_4Clover
My support is reaching to the point of being almost online stalker here. haha

Jokes aside, we really love your innovative approaches, keep em coming :)
alexgrover
@OWL, If supporting a lot would be the considered stalking then i would allow everyone to stalk me :) Thx for your comment.
VirtualJack
Amazing. Thanks.
rhanna
one of your best. thanks a lot.
alexgrover
@rhanna, Glad to hear that, thanks for your support :)
XIAOMEIXW
GO GO GO ,THANKS~~~
Más