DEMA: Double Exponential Moving Average | Valuable – Amibroker AFL
DOUBLE EXPONENTIAL MOVING AVERAGE AFL
DEMA – Double exponential moving average is a measure of a security’s trending average price. This gives the most weight to recent price data. Like exponential moving average ( EMA) it is more reactive to price fluctuations than a simple moving average (SMA) thereby bringing more value to short-term traders attempting to pinpoint trend changes.
The formula is:
DEMA = ( 2 * EMA(n)) – (EMA(EMA(n)) ), where n= period
By using Double exponential moving average formula we make modify amibroker afl. Below picture show you where to buy and where to sell. Using this afl you may make much profit if you use it properly. In picture when formula fulfill the sell condition than its show red signal. Reversely when condition fulfill buy condition than it automatically show you green signal. Just download AFL and enjoy with happy trading.
Image of Amibroker AFL [amibroker formula language].
DEMA FOR AMIBROKER AFL CODE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | //------------------------------------------------------------------------------ // Formula Name : Double Exponential Moving Average (DEMA) by pipschart // Author : KrT group // Uploader : www.pipschart.com // E-mail : info@pipschart.com // Amibroker Blog : www.pipschart.com/amibroker // Origin : Modified & Collected from different sources. //------------------------------------------------------------------------------ _SECTION_BEGIN("KrT group Logo"); GfxSetBkMode(1); X=750; Y=1; Font=10; GfxSelectFont("Impact",Font*2.2, 550);GfxSetTextColor(colorRed);GfxTextOut("KrT group",x,y); GfxSelectFont("Impact",Font*2.2, 550);GfxSetTextColor(colorGreen);GfxTextOut("RESEARCH",x+120,Y); _SECTION_END(); SetChartOptions(0,chartShowArrows|chartShowDates); _SECTION_BEGIN("DEMA BUY"); Cond1 = DEMA( Close , 5 ) > DEMA( Open , 36 ); Cond2 = DEMA( Close , 7 ) > DEMA( Open , 36 ); Cond3 = DEMA( Close , 9 ) > DEMA( Open , 36 ); Cond4 = DEMA( Close , 11 ) > DEMA( Open , 36 ); Cond5 = DEMA( Close , 13 ) > DEMA( Open , 36 ); Cond6= DEMA( Close , 5 ) < DEMA( Open , 21 ); Cond7= DEMA( Close , 7 ) < DEMA( Open , 21 ); Cond8= DEMA( Close , 9 ) < DEMA( Open , 21 ); Cond9= DEMA( Close , 11 ) < DEMA( Open , 21 ); Cond10= DEMA( Close , 13 ) < DEMA( Open , 21 ); Buy = Cond1 AND Cond2 AND Cond3 AND Cond4 AND Cond5; Sell = Cond6 AND Cond7 AND Cond8 AND Cond9 AND Cond10; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-30); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0, H, Offset=20); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorGreen, 0,H, Offset=30); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25); dist = 3*ATR(10); dist1 = 3*ATR(10); for( i = 0; i < BarCount; i++ ) { if( Buy[i] ) { PlotText( "nBuy@:" + C[ i ], i, C[ i ]-dist[i], colorGreen, colorDarkOliveGreen ); } if( Sell[i] ) { PlotText( "Sel@:" + C[ i ], i, C[ i ]+dist1[i], colorRed, colorDarkOliveGreen ); } } _SECTION_END(); _SECTION_BEGIN("DEMA SELL"); Cond11 = DEMA( Close , 5 ) < DEMA( Open , 36 ); Cond12 = DEMA( Close , 7 ) < DEMA( Open , 36 ); Cond13 = DEMA( Close , 9 ) < DEMA( Open , 36 ); Cond14 = DEMA( Close , 11 ) < DEMA( Open , 36 ); Cond15 = DEMA( Close , 13 ) < DEMA( Open , 36 ); Cond16= DEMA( Close , 5 ) > DEMA( Open , 21 ); Cond17= DEMA( Close , 7 ) > DEMA( Open , 21 ); Cond18= DEMA( Close , 9 ) > DEMA( Open , 21 ); Cond19= DEMA( Close , 11 ) > DEMA( Open , 21 ); Cond20= DEMA( Close , 13 ) > DEMA( Open , 21 ); Buy = Cond16 AND Cond17 AND Cond18 AND Cond19 AND Cond20; Sell = Cond11 AND Cond12 AND Cond13 AND Cond14 AND Cond15; Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-20); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorOrange, 0,L, Offset=-30); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-25); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=20); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=30); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-25); dist = 3*ATR(10); dist1 = 3*ATR(10); for( i = 0; i < BarCount; i++ ) { if( Buy[i] ) { PlotText( "nCov@:" + C[ i ], i, C[ i ]-dist[i], colorGreen, colorDarkOliveGreen ); } if( Sell[i] ) { PlotText( "Sht@:" + C[ i ], i, C[ i ]+dist1[i], colorRed, colorDarkOliveGreen ); } } _SECTION_END(); _SECTION_BEGIN("DEMA COLOR"); Cond1 = DEMA( Close , 5 ) > DEMA( Open , 36 ); Cond2 = DEMA( Close , 7 ) > DEMA( Open , 36 ); Cond3 = DEMA( Close , 9 ) > DEMA( Open , 36 ); Cond4 = DEMA( Close , 11 ) > DEMA( Open , 36 ); Cond5 = DEMA( Close , 13 ) > DEMA( Open , 36 ); Cond11 = DEMA( Close , 5 ) < DEMA( Open , 36 ); Cond12 = DEMA( Close , 7 ) < DEMA( Open , 36 ); Cond13 = DEMA( Close , 9 ) < DEMA( Open , 36 ); Cond14 = DEMA( Close , 11 ) < DEMA( Open , 36 ); Cond15 = DEMA( Close , 13 ) < DEMA( Open , 36 ); CondA= Cond1 AND Cond2 AND Cond3 AND Cond4 AND Cond5; CondB= Cond11 AND Cond12 AND Cond13 AND Cond14 AND Cond15; BarColor = IIf(CondA,colorGreen,IIf(CondB,colorRed,colorWhite)); Plot( C, "Close", BarColor, styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); GraphXSpace=10; _SECTION_END(); |
Download AFL
How to use Amibroker AFL
- Download the Amibroker AFL.
- Now copy the afl file and paste it to \Program Files\AmiBroker\Formulas\Custom. [For 32 bit]
- If You have 64 bit operating system than paste it to \Program Files(x86)\AmiBroker\Formulas\Custom.
- Go to formula section of Amibroker and you will get the afl in Custom folder.
Don’t Know How To Set Amibroker? If not than Just Watch.
Tags amibroker afl
0 thoughts on “DEMA: Double Exponential Moving Average | Valuable – Amibroker AFL”