TradingView
bennycjonesmusic
16 Oca 2021 00:23

Trend Intensity Index With SignalLine 

GBP/JPYOANDA

Açıklama

Hi guys,

This is my first public script on TV. I was just messing about with some simple ideas and I noticed that the difference between a signalLine and the TrendIntensity line was (potentially and theoretically) a good way of spotting a ranging market.

I was initially just going to release Evergets version of this with a histogram and a signal-line, but I decided I'd much rather put in the work and code it from scratch so I could practice my coding.

I am still relatively new to Pinescript, but I have compared this to Evergets version, and on the same settings it is 1 to 1.

How to use:

When TrendIntensity(aqua) is above SignalMa (maroon), it implies a bullish sentiment.

When SignalMa is above TrendIntensity, it implies a bearish sentiment.

The histogram is simply the absolute difference between the two. Green = bullish, Red = bearish, flat = potentially ranging.

Enjoy guys.

I would like to thank Everget for his Jurik moving average.


Feedback welcome, but be kind... this is free and open for you all to use as you please.




Sürüm Notları

*Indicator developed by M.H Pee. Many thanks to him.

Sürüm Notları

*added minor length as well for additional customisation

Sürüm Notları

*Just wanted to change the pic on the front so other indicators were not in ;)

Sürüm Notları

*Fixed confusing Histo colours.. was occasionally red when there was a strong uptrend, or green when there was a strong downtrend. This is because both lines hug the top or bottom when this happens, and the question of the TII being above or below the SignalLine in this case becomes unimportant.

Sürüm Notları

*Got rid of minor length, as I find it better without it personally.
Yorumlar
Minimal_Est
might be cool to make it MTF.
bennycjonesmusic
@Minimal_Est, if I get round to it, I'll try and do it. Good idea though.
Minimal_Est
@bennycjonesmusic, shoudnt be too hard to do. If you might help me, I can probably get that done. It would be great to reduce the lag of the entry conditions.
Minimal_Est
@bennycjonesmusic, oh and perhaps also a smoother to the signal and trend intensity, to remove some noise. But i do think this indicator has lots of possibilities.
bennycjonesmusic
@Minimal_Est, as far as smoothing goes -the signal line is a jurik moving average by standard, so that definitely doesn't need smoothing, and the indicator itself was developed by M.h pee and functions as is required.

If you wish to speed it up, I recommend a lower length. It should be very fast at a lower length. I've had some success using the crossovers as entries and the level of trend intensity... as well.. the level of the intensity of the trend haha.

If you want something lag free, I recommend Ehler's reflex oscillator. Midtown Sk8r guy does a marvellous script of that. However, I would suggest that anything lag-free is more prone to false entries...

this one is definitely for the trend traders who are not as bothered about getting in early.
bennycjonesmusic
@Minimal_Est, deleted my comment.. thats annoying.. anyways mtf...

MTFRes1 = input(title = "Multi Time Frame RSI1 Res?", type = input.resolution, defval = '')
f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src1, lookahead = barmerge.lookahead_on)
MTF1 = f_secureSecurity(syminfo.tickerid, MTFRes1, close)

Change every instance or src or close with MTF1, that should do the trick. The src1... the 1 needs to be enclosed in square brackets. Comments dont like square brackets.
bennycjonesmusic
@Minimal_Est, the src1 stops it from repainting.. if you dont care, then just put src. P.s If you can't do it for whatever reason, I'll do it later, I'm thinking of adding adaptive lengths anyway.
Minimal_Est
@bennycjonesmusic, first of all thank you for the quick reply. Yes the code is yours so I am not going to argue, I didnt understand if there was a smoothing already or not. Clearly nobody wants repainting if you want to use it for backtesting purpouses. I am gonna try, one I have some time to make it MTF in order to have the indicator on a 1d timeframe and the candles on 4h timeframe. So that when the cross happens, I dont have to wait for the candle close. Would be even better with a 1m time frame for the candles and a 1d timeframe for the indicator, but as we all know it is not possible with tradingview at the moment.
zzb123
Nice work ,thanks my friend.
Daha Fazla