TradingView
blackcat1402
Oct 26, 2020 9:04 AM

[blackcat] L2 Ehlers ITrendline Trigger Trend-Following System 

GoldOANDA

Description

Level: 2

Background

John F. Ehlers introuced the Instantaneous Trendline and the Trigger of the trend-following system in his "Cybernetic Analysis for Stocks and Futures" chapter 3 on 2004.


Function

The process for creating a trendfollowing trading system from the indicators is simple. One unique aspect of the code is that the ITrend is forced to be a finite impulse response (FIR)-smoothed version of price for the first seven bars of the calculation.
This initialization is included to cause the ITrend to converge more rapidly to its correct value from the beginning transient. The strategy enters a long position when the trigger crosses over the Instantaneous Trendline and enters a short position when the trigger crosses under the Instantaneous Trendline. However, an effective trading system is more than following a simple set of indicators.
First, experience has shown that greater profits result from using limit orders rather than market orders or stop orders. Market orders are selfexplanatory. Stop orders mean the market must be going in the direction of the trade before the order is filled. For example, for long-position trades, the stop order must be placed above the current price. Thus, the price must increase from its current level before you get stopped into the long-position trade. This means you necessarily give up some of the profits you would otherwise have gotten if you had entered on a market order at the instant of your signal. You can lose additional profits from stop orders due to slippage.

Key Signal

Trigger ---> trend-following system fast line
ITrend ---> trend-following system slow line

Pros and Cons

100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.

Remarks

The 22th script for Blackcat1402 John F. Ehlers Week publication.

Readme

In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.

The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.

Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.

Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.

Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.

Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.

Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.

Release Notes

Correct BS label display bug as found by @gerardgervais
thanks for your kind reminding! :D

Release Notes

Make label size adjustable
Comments
gerardgervais
Hi! blackcat1402,

I do like very much this indicator, but I am not able to see correctly the "Buy" and "Sell" labels, that are far too high, or too low, on my screen, and not at all within the range of the candles, and the normal range of a screen as we usually set it for trading.

For my settings where I see this "anomaly", it's a chart of Futures (ZN) in 1 minute. Should this be part of the problem?

In fact, it was so far away up and down that I did think that they were not displayed at all. I discovered them by very hugely diminishing the vertical scale, setting the candle's height so small that they were actually unusable.

Precisely, all the labels (each one) are around 65 ticks below or above the candles, not at all close to them as shawn on your published example.

I do not know anything at all about programming, this is why I ask you here two things in fact as questions and a little ergonomy improvment for the user to get this indicator a little better user friendly, maybe not very difficult and I hope not taking too much time to be done:

1-. is it possible that you fix that problem of the labels' location, and

2-.if you can, add the possibility to get the choice of

a-. replacing the labels by a triangle, or other signs,
b-. setting the location at a convenient place for the trader, and, at last,
c-. having the choice of the size of the label, triangle, arrow, etc.?

Thanks a lot if you can do something about this, I would sincerely appreciate very much.
blackcat1402
@gerardgervais, thanks for your feedbak error was corrected.
gerardgervais
@blackcat1402,

First point, a great thanks for that very quick answer!

So, I did go and check on my Tradingview ZN one minute chart. But, unfortunately, the appearance is still exactly the same for me (65 ticks of distance from the candle). I did reset my web page and nothing changed either. I do not know why. So I checked for other futures, ES, CL, but the same thing happened there too. Except that the distance (in ticks between the label and the candle) may be a bit different from an instrument to another one. Mystery of electronics!

One last question, as I'm at present looking for some good indicators (who would like bad ones?) for scalping and day trading, as I'm building my strategy: have you a bunch of a few good things which could help me, in your L4 / L5 library? And could you show me? I'd appreciate simplicity and consistency, of course.

I'm not writing this here so that you'd let me test them, but just give me the name and a link for them so I may be able to get a glance at them, as I could see with the present indicator, having those qualities. Even through PM, if not here, which I can understand easily.

Best Regards, and... have nice week-end!

Gérard
Below is a copy of the screen (ZN 1m), where you can see the indicator as it appears now after the resets (no change). But I guess the copy and paste I dit for the screen did not work!
gerardgervais
@blackcat1402,

Hi again, and last time on the subject, blackcat 1402!

I just saw, right now, that, if there is stil the same thing on the 1 min charts screen, everything is perfectly in place on the 30 seconds chart. True mystery of electronics!!! Maybe a good trick for the engineers of Tradingview, or about the Pine language. Much too complicate for me!

Have a nice week

Great thanks again and best regards,

Gérard.
More