The Elder Impulse System Amibroker

I’m often asked how to program a certain trading strategy or indicator that one my readers has seen on another site or read about in a book/journal.

So for this new series of articles I will be selecting some of the strategies and indicators which have been highlighted by readers and then I will be showing you how to program them using Amibroker.

Elder Impulse System

Perhaps one of the most popular questions that I receive is related to the Elder Impulse System which was first presented by Dr Alexander Elder in his best-selling book “Come Into My Trading Room“.

So for this article I will be explaining how to create the Elder impulse system charts using Amibroker.

Elder Impulse System Charts

The Elder impulse system uses 2 indicators:

  1. A 13 period Exponential Moving Average (to measure market inertia).
  2. A MACD histogram (to measure market momentum).

An entry signal occurs when both indicators point in the same direction and an exit signal occurs when both indicators are not pointing in the same direction.

To identify the signals quickly, we will first create our Elder Impulse charts.

Note in the following example that when both indicators are pointing up, the candles are green. When both indicators are pointing down, the candles are red. And when both indicators are pointing in the opposite direction, the candles are blue:

Llewelyn James Trader Course MACD


Further to the above rules, Elder suggests that entries made from the daily charts are only permitted if the weekly charts confirm the direction of the market.

To gauge the weekly direction of the market, Elder suggests using a 26 weekly period EMA, a weekly MACD histogram, or both.

For this article, we’ll use both indicators and simply recreate the impulse system from above but using the weekly time-frame.

Note in the following example that you are viewing a daily impulse system chart but I’ve also included a ribbon beneath the price series.

When the ribbon is green, the weekly impulse system is bullish,  when it’s red the weekly impulse system is bearish, and when it’s blue the weekly impulse is neutral.


As per the rules suggested in Elder’s book, you are only permitted to go long/short from the daily charts if the weekly impulse ribbon confirms the direction of the daily impulse.

For example, in Jan 2016 you would not have been permitted to go long TSLA because the weekly impulse was bearish.

Creating the Elder Impulse Charts with Amibroker

To create the Elder Impulse charts with Amibroker, please copy and paste the following formula to your formula editor and click apply:


ML = MACD(12, 26);
SL = Signal(12,26,9);

Bullish = EMA(C,13) > Ref(EMA(C,13),-1) AND MACDH > Ref(MACDH,-1);
Bearish = EMA(C,13) < Ref(EMA(C,13),-1) AND MACDH < Ref(MACDH,-1);


_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, “Close”, IIf(bullish,colorGreen,IIf(bearish,colorRed,colorBlue)), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );


To create the weekly ribbon indicator please copy and paste this formula to your formula editor and click apply:


TimeFrameSet( inWeekly );
WMACDH = MACD( 12, 26 ) – Signal( 12, 26, 9 );
WEMA = EMA(C,26);
WBullish = WEMA > Ref(WEMA,-1) AND WMACDH > Ref(WMACDH,-1);
WBearish = WEMA < Ref(WEMA,-1) AND WMACDH < Ref(WMACDH,-1);

WBullish = TimeFrameExpand(Wbullish,inWeekly,expandlast);
WBearish = TimeFrameExpand(Wbearish,inWeekly,expandlast);

ribboncolor = IIf(WBullish,colorGreen,IIf(Wbearish,colorRed,colorBlue));


Using the Elder Impulse Charts For Analysis

If we run the Elder Impulse Pull-Back System Amibroker explorer today we find just one stock on the S&P500 which meets the criteria for a long position ($PXD).

Note too that we can program our explorer to produce approximate values for the buy-stop order, stop-loss and initial profit target, as well as an approximate risk/reward ratio for the trade.


In the following video I explain how you can further analyse the signals found by the explorer and then structure a trade. (Please select HD for best viewing quality)



  • Tommo

    Reply Reply December 8, 2017

    Something wrong with your code – in weekly data your impulse chart shows correct candles, but weekly ribbon doesn’t change colours. Tested manually with weekly EMA(13) and MACD Histogram.

    • Llewelyn James

      Reply Reply December 8, 2017

      Hi Tommo,

      It is often easier for me to send a more detailed response by email but because you have entered a null email in the comments system I’m afraid that I can’t provide you with any screenshot examples.

      Regarding the Ribbon, it works for me and nobody else has ever said that it doesn’t change. Would you please provide an example ticker so that I can troubleshoot the issue for you?

      Kind regards,


Leave A Response

* Denotes Required Field