LazyBear

Indicator: Elder Impulse System

According to Elder, "The Impulse System encourages you to enter a trade cautiously but exit fast, by identifying inflection points where a trend speeds up or slows down. This is the professional approach to trading, the total opposite of the amateur's style. Beginners jump into trades without thinking too much and take forever to get out, hoping and waiting for the market to turn their way."

The Impulse System is based on two indicators, a 13-day exponential moving average and the MACD-Histogram. The moving average identifies the trend, while the MACD-Histogram measures momentum. As a result, the Impulse System combines trend following and momentum to identify impulses that can be traded.

By default it uses your chart's time frame, but you can set it to any custom time frame via options page. Optionally, price bars can be color coded too.

More info:
http://stockcharts.com/school/doku.php?id=chart_school:chart_analysis:elder_impulse_system

Steps to import / use custom indicators from this chart:
PDF: https://drive.google.com/file/d/0Bx48Du_2aPFncUhIemNrZUY1dTA/edit?usp=sharing
Remove from Favorite Scripts Add to Favorite Scripts
//
// @author LazyBear
//
// If you use this code in its original/modified form, do drop me a note. 
//
study("Elder Impulse System [LazyBear]", shorttitle="EIS_LB")
useCustomResolution=input(false, type=bool)
customResolution=input("D", type=resolution)
source = security(tickerid, useCustomResolution ? customResolution : period, close)
showColorBars=input(false, type=bool)
lengthEMA = input(13)
fastLength = input(12, minval=1), slowLength=input(26,minval=1)
signalLength=input(9,minval=1)

calc_hist(source, fastLength, slowLength) =>
    fastMA = ema(source, fastLength)
    slowMA = ema(source, slowLength)
    macd = fastMA - slowMA
    signal = sma(macd, signalLength)
    macd - signal

get_color(emaSeries, macdHist) =>
    g_f = (emaSeries > emaSeries[1]) and (macdHist > macdHist[1])
    r_f = (emaSeries < emaSeries[1]) and (macdHist < macdHist[1])
    g_f ? green : r_f ? red : blue
    
b_color = get_color(ema(source, lengthEMA), calc_hist(source, fastLength, slowLength))    
bgcolor(b_color, transp=0)
barcolor(showColorBars ? b_color : na)
@taylo88885, still would like to know if its possible, to create in tradingview script, the ability to indicate what closing price would be required to change the colors of the indicator. Examples: what closing price would it take to switch color from "red to green" or "green to blue", etc.

would really like know, if it is possible with tradingview script, to predetermine (show on chart or indicator) what close price would be required to to change an indicators values from positive to negative, visa versa. thanks.
Reply
Somehow green bars don't appear
Reply
alex.a alex.a
Reply
alex.a alex.a
@LazyBear not green but blue sorry for confusion
Reply
Has anyone been able to use the 'alertcondition' function on pines script to set an alert for when the colour changes to red or green?

I have been trying, but have been unable to do so.
Reply
mgenji
Thank you so much.
Reply
Hi LazyBear, thanks for this indicator. When I try modifying it I get:
Error: Undeclared identifier `emaSeries`;

Do you know what the issue is?
Reply
jeffrocket jeffrocket
@jeffrocket, never mind, I saw what was I doing wrong.
+1 Reply
Awsome. Than you very much.
Reply
thanks for putting time into bringing this to light.. :)
Reply
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体中文
繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out