alexgrover

Simple Lines

alexgrover Wizard 已更新   
Introduction

Making lines is great in technical analysis since it can highlights principal movements and make the analysis of the price easier when using certain methodologies (Elliott Waves, patterns).
However most of the indicators making lines (Zig-Zag, simple linear regression) are non causal (repaint), this is the challenge i tried to overcome, making an indicator capable of making lines in a smart way (able to follow price without loosing a linear approach) and with the least lag possible, i inspired myself from the behaviour of the renko when using a small brick size. This indicator does not repaint.

The code is short and i hope, understandable for all of you, making lines is not a difficult task and its important to know that when a problem appear complex it does not mean that the code used to solve this problem must be complex. Lets see the indicator in details.

The indicator

The indicator have 4 parameters, the length parameter who control the length of lines, the emphasis parameter who control the stability and also the ability to make lines closer to the price (thus minimizing the sum of squares), the mult parameter which is similar to emphasis and a point option that we will discuss later.

When emphasis and mult are both equal to 1 the indicator will sometimes draw a perfect line, however this line will try to follow the price and thus can create a noisy result.


This is where emphasis and mult will correct this behaviour. The emphasis parameter give a more periodic look as well as some control to the lines but can also destroy them.


This should not happen with mult, this parameter also give more predictability to the lines. Overall it correct the drawbacks of the parameters combinations mentioned earlier.


Its also possible to mix both the emphasis and mult parameter, but take into account that when both are equals the result consist of less reactive lengthy lines with low accuracy. Its better to only use one of them and let the other stay to 1.

Point Option

The indicator can sometimes have a weird look, appearing almost flat or just dont appearing at all. When such thing happen use the point option.

XPDUSD without point option.


with point option :


Time Frame Problem and Its Fix

When using higher time-frames the result of the indicator can appear different, in general the higher the time frame the lengthier are the lines. In order to fix this you can use decimals in the length parameter


length and mult both equal to 5.5, emphasis cant use decimals.

Conclusion

I have highlighted a simple way to make use of the small renko box size method in order to return reactive lines without making the indicator repaint. However Its ability to be close to the price as well as being always super reactive is not a guarantee.

For any suggestion/help feel free to pm me, i would be happy to help you :)

版本注释:
Can display color based on indicator direction.

Check out the indicators we are making at luxalgo: www.tradingview.com/u/LuxAlgo/
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?