Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Color Price Bar - Impulse System
Author/Uploader: MTR Investors Group - (email hidden)
Date/Time added: 2009-06-27 11:39:20
Origin: Dr. Elder - Book "Come Into My Trading Room"
Keywords:
Level: basic
Flags: system

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

When the MACD Histogram is up and EMA(21) is up Price bars are green. When MACD Histogram is down and EMA(21) is down price bars are red. If the MACD Histogram and EMA(21) are moving in two different directions the price bars are blue.

\"When the impulse system is Green you may go long or stand aside. When the impulse system is red you may go short or stand aside. I wait for the impulse system to go off green before shorting and off red before going long\" - Dr. Elder

Formula:

/*--------------------------------------------------------------------
MTR Investors Group - www.MTRIG.com

Color price bars with MACD Histogram Bars changes. Use on weekly chart 
to determine market trend. See Elder "Come into my trading room"
----------------------------------------------------------------------*/
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g,
Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

TimeFrameSet( inDaily) ;

//MACD
r1 = Param( "Impulse Fast avg", 12, 2, 200, 1 );
r2 = Param( "Impulse Slow avg", 26, 2, 200, 1 );
r3 = Param( "Impulse Signal avg", 9, 2, 200, 1 );

ml = MACD(r1, r2);
sl = Signal(r1,r2,r3);
Hist = ml-sl;

MACUP = Hist > Ref(Hist,-1);
MACDN = Hist < Ref(Hist,-1);

MA1 = Param( "Impluse MA", 21, 21, 200, 1 );

MAUP = EMA(C,MA1) > Ref(EMA(C,MA1),-1);
MADN = EMA(C,MA1) < Ref(EMA(C,MA1),-1);

//BarColor = IIf(Close == Open,
colorBlack,IIf(Close>Open,colorGreen,colorRed));

BarColor  = IIf(MACUP AND MAUP,colorGreen,IIf(MACDN AND
MADN,colorRed,colorBlue));

Plot( C, "Close", BarColor, styleNoTitle | ParamStyle("Style") |
GetPriceStyle() );

Comments:

Manas
manas123behera [at] yahoo.com
2009-07-20 10:20:25
Its not working in Ami, please help.
I am getting error message-----Missing Buy/Sell variable assignment for Scan function in Ami, and You need to define filter variable in Explore.please look into it
MTR Investors Group - MTRIG.com
support [at] mtrig.com
2009-07-25 12:23:29
This is not meant to run back-tests. This is meant to replace your Default Price Chart in AMIBroker to color the bars according to the Elder Impulse System. Save this formula in your Basic Charts folder. Call it Price - Impulse. Go to a new chart tab, delete the price on that chart, now drag Price - Impulse to that pane.

Take a look at the second chart on the page below. Contact me if you want a screen shot or go to blog.mtrig.com and search for Impulse. The second chart on that page is the plotted impulse system.
Pascal
matsen2 [at] hotmail.com
2010-06-24 23:03:09
I have tried it too by putting it in basic charts folder and i get an error:

Price:
MADN = EMA(C,MA1) < Ref(EMA(C,MA1),-1);
//BarColor = IIf(Close == Open,
colorBlack,
--------^

Error 30.
Syntax error

Use\\\'Edit Formula\\\'to correct error\\\"\\\'


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM