Advanced Moving Average Buy Sell AFL Always Reach Goals
MOVING AVERAGE BUY SELL AFL
Advanced Moving Average Buy Sell AFL for Amibroker is used by advance trader. Its a advance trading system for Forex & other stock marker. This AFL provides you lot of information and focus your concentration about trade signals.
Yes, This AFL provides you buy sell signal that’s why we call it – moving average buy sell afl. Its also similar to call moving average crossover afl.
What is A Moving Average
Moving Average (MA) – is a calculation to analyze data points by creating a series of averages of different subsets of the full data set. A moving average (MA) is a widely used indicator in technical analysis that helps smooth out price action by filtering out the noise from random short-term price fluctuations. Moving averages smooth the price data to form a trend following indicator. They do not predict price direction, but rather define the current direction, though they lag due to being based on past prices.
One sweet way to use moving averages is to help you determine the trend. The simplest way is to just plot a single moving average on the chart. When price action tends to stay above the moving average, it signals that price is in a general UPTREND. If price action tends to stay below the moving average, then it indicates that it is in a DOWNTREND.
The moving average is a popular technical indicator which investors use to analyze price trends. It is simply a security’s average closing price over the last specified number of days It is a trend-following, or lagging, indicator because it is based on past prices.
Image of AFL [amibroker formula language].
MOVING AVERAGE (MA) BUY SIGNAL
In Image it is clearly focus where to buy signal. When short term moving average crossover the long term moving average from below than it is BUY signal.
In a sense, When moving average crossover than AFL provide a color changing option. That’s mean when its transform white color to green color than it is a Buy Signal. As well as AFL provides a Text format to inform BUY Signal.
MOVING AVERAGE (MA) SELL SIGNAL
In Image it is clearly focus where to Sell Signal. When short term moving average crossover the long term moving average from up than it is a SELL signal.
In a sense, When moving average crossover than AFL provide a color changing option. That’s mean when its transform green color to white color than it is a Sell Signal. As well as AFL provides a Text format to inform SELL Signal.
ADVANCED MOVING AVERAGE BUY SELL 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | //-------------------------------------------- // Formula Name: Advanced Moving Average Based Trading Buy Sell AFL // 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"); GfxSetBkMode(1); X=850; 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,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle); function GetSecondNum() { Time = Now( 4 ); Seconds = int( Time % 100 ); Minutes = int( Time / 100 % 100 ); Hours = int( Time / 10000 % 100 ); SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds ); return SecondNum; } RequestTimedRefresh( 1 ); TimeFrame = Interval(); SecNumber = GetSecondNum(); Newperiod = SecNumber % TimeFrame == 0; SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame; SecsToGo = TimeFrame - SecsLeft; SetChartOptions(0,chartShowArrows|chartShowDates); showsig=ParamList("Show Signals","YES|NO"); Showprice=ParamList("Show Buy/Sell Prices","YES|NO"); Plot( C, "Close", ParamColor("Color", colorBlack), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); period = Param("Period", 13, 1, 240, 1); mult = Param("Multiplier", 2.21, 0, 3, 0.01); A=EMA (RSI(14),5); B=EMA (RSI(21),5); f=ATR(period); x=5; VS[0] = Close[0]; trend[0] = 0; HighC[0]=0; Lowc[0]=0; for( i = period+1; i < BarCount; i++ ) { vs[i] = vs[i-1]; trend[i] = trend[i-1]; highC[i] = HighC[i-1]; lowc[i] = lowc[i-1]; if ((trend[i]>=0) AND ( C[i] <VS[i])) { trend[i] =-1; HighC[i] = C[i]; lowc[i] = C[i]; } if ((trend[i]<=0) AND (C[i] >VS[i])) { trend[i]=1; HighC[i] = C[i]; lowc[i] = C[i]; } if (trend[i]==-1) { if (C[i]<lowc[i]) lowc[i] = C[i]; VS[i]= lowc[i]+ (mult*f[i]); } if (trend[i]==1) { if (C[i]>HighC[i]) HighC[i] = C[i]; VS[i]= HighC[i]-(mult*f[i]); } } Pribbon=ParamList("Ribbon? ", "Yes|No"); if (Pribbon=="Yes") { Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon", IIf( trend==1, colorGreen, IIf( trend==-1, colorRed, 0 )), /* choose color */ styleOwnScale|styleArea|styleNoLabel, -0.5, 100 ); } _SECTION_BEGIN("Volume"); Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), ParamStyle( "Style", styleHistogram | styleThick |styleOwnScale, maskHistogram ),7 ); _SECTION_END(); TrailStop = HHV( C - 2.1 * ATR(3), 7); //trailstop=(IIf(!downtrend OR uptrend, trailstop, Null)); //Plot( trailstop , "Trailing stop", colorCustom12, 8); //Plot( IIf(shrttgt<TrailStop,trailstop,(shrttgt+trailstop)/2) , "Trailing stop", colorCustom11, 8); TrailStop1 = LLV( C + 2.1 * ATR(3), 7); //trailstop1=(IIf(!uptrend OR downtrend, trailstop1, Null)); //Plot( TrailStop1, "Trailing stop1", colorBlack, 8); _SECTION_BEGIN("GMMA"); a=C; g=(EMA(Close,3) * (2 / 4 - 1)-EMA(Close,60) * (2 / 61 - 1)) / (2 /4- 2 /61); e=Ref(g,-1); Plot (EMA(a,3), "3ema", colorBlue,styleNoLabel); Plot (EMA(a,5), "5ema", colorBlue,styleNoLabel); Plot (EMA(a,8), "8ema", colorBlue,styleNoLabel); Plot (EMA(a,10), "10ema", colorBlue,styleNoLabel); Plot (EMA(a,12), "12ema", colorBlue,styleNoLabel); Plot (EMA(a,15), "15ema", colorBlue,styleNoLabel); Plot (EMA(a,30), "30ema", colorRed,styleNoLabel); Plot (EMA(a,35), "35ema", colorRed,styleNoLabel); Plot (EMA(a,40), "40ema", colorRed,styleNoLabel); Plot (EMA(a,45), "45ema", colorRed,styleNoLabel); Plot (EMA(a,50), "50ema", colorRed,styleNoLabel); Plot (EMA(a,55), "55ema", colorRed,styleNoLabel); Plot (EMA(a,60), "60ema", colorRed,styleNoLabel); //Plot(C,"close", colorBlack,styleCandle); Cond1=StochK(14)>StochD(14); Cond2=StochK(14)<StochD(14); Buy=Cross(EMA(C,15),EMA(C,60)); Sell=Cross(EMA(C,60),EMA(C,15)); Filter = Buy OR Sell; _SECTION_END(); AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar ); AddColumn(Close,"Close",1.2); AddColumn(Volume,"Volume",1.0); Cond13=PDI()>MDI(); _SECTION_END(); _SECTION_END(); _SECTION_BEGIN("my FIST"); Slowavg=Param("Slow Average",10,10,70,1); Fastavg=Param("Fast Average",3,1,15,1); gapx=Param("Tolerance",3,0,10,.001); SPsignals=ParamList("Generate new Buy/Sells after SP","YES|NO"); n4=4; Datex=DateNum(); Buy1=Cross(EMA(C,fastavg),EMA(C,slowavg)); Sell1=Cross(EMA(C,slowavg),EMA(C,fastavg)); EMA3=EMA(C,3); EMA30=EMA(C,30); Lastsig=0; diff=5; for (i=1;i<BarCount;i++) { if(Datex[i]!=Datex[i-1] AND Interval()<86400) { if(EMA3[i]> EMa30[i] ) buy1[i]=1; if(EMA3[i]< EMA30[i] ) Sell1[i]=1; } if(Buy1[i]) { if(Sell1[i-1]) { Buy1[i]=0; Sell1[i-1]=0; } } if(Sell1[i]) { if(Buy1[i-1]) { Buy1[i-1]=0; Sell1[i]=0; } } } gapema=abs(EMA(C,fastavg)-EMA(C,slowavg)); Nowbuy=0;Nowsell=0;starti=0;Lastbuy=Lastsell=0; avp=(O+C)/2; for (i=1;i<BarCount;i++) { if(Datex[i]!=Datex[i-1]) { Nowbuy=0;Nowsell=0;starti=0;Lastbuy=Lastsell=0; } if(Buy1[i] ) { if (lastbuy==0)Nowbuy=1; Nowsell=0; Buy1[i]=0; } if(Sell1[i] ) { Nowbuy=0; if(Lastsell==0)Nowsell=1; Sell1[i]=0; } if (Nowbuy==1 AND gapema[i]>gapx) { Buy1[i]=1; Nowbuy=0; Nowsell=0; } if (Nowsell==1 AND gapema[i]>gapx ) { Sell1[i]=1; starti=i; Nowsell=0; Nowbuy=0; } if (Buy1[i]) { Lastbuy=1; Lastsell=0; } if (Sell1[i]) { Lastbuy=0; Lastsell=1; } } slhigh=HHV(H,BarsSince(Buy1)); sllow=LLV(L,BarsSince(Sell1)); gapy=Param("SP",10,0,50,0.01); Lastshort=0;priceatcover=priceatshort=0;Cover2=0;Lastcover=0;Sell2=0;Lastsell=newbuy=newshort=0; for (i=1; i<BarCount-1;i++) { if(Datex[i]!=Datex[i-1] ) { Lastshort=0;priceatsell=priceatcover=priceatshort=0;Lastcover=0;Lastsell=newbuy=newshort=0; } if (Sell1[i]) { Lastshort=1; Lastbuy=0; Lastsell=0; starti=i; priceatshort=H[i]; } if(Buy1[i]) { Lastbuy=1; Lastshort=0; Lastcover=0; starti=i; priceatbuy=L[i]; } if (spsignals=="YES") { if (newshort==1 AND avp[i]<priceatcover-n4 AND O[i]>C[i]) { sell1[i]=1; newshort=0; } } if (C[i]-sllow[i]>gapy AND Lastshort==1 AND Lastcover==0 AND I>starti AND sllow[i]==sllow[i-1]) { Cover2[i]=1; Lastcover=1; priceatcover=C[i]; newshort=1; } if ((Lastcover==1 AND C[i]<priceatcover-(gapy/2)) )Lastcover=0; if (spsignals=="YES") { if (newbuy==1 AND avp[i]>priceatsell+n4 AND O[i]<C[i]) { Buy1[i]=1; newbuy=0; } } if(slhigh[i]-C[i]>gapy AND Lastbuy==1 AND Lastsell==0 AND i>starti AND slhigh[i]==slhigh[i-1]) { Sell2[i]=1; Lastsell=1; // priceatsell=avp[i]; priceatsell=C[i]; } if ((Lastsell==1 AND C[i]>priceatsell+(gapy/2)) )Lastsell=0; } shape = Buy * shapeUpArrow + Sell * shapeDownArrow; shape1 = Buy1 * shapeUpTriangle + Sell1 * shapeDownTriangle; shape2 = Cover2 * shapeHollowUpArrow+ Sell2*shapeHollowDownArrow; if(showsig=="YES") { PlotShapes( shape, IIf( Buy, colorBlue, colorRed ),0, IIf( Buy, Low, High ) ); PlotShapes( shape1, IIf( Buy1, colorBlue, colorRed ),0, IIf( Buy1, Low, High ) ); PlotShapes( shape2, IIf( Cover2, colorGreen, colorGreen ),0, IIf( Cover2, Low, High ) ); } GraphXSpace = 5; dist = 5*ATR(10); mth=int(DateNum()/100)-int(DateNum()/10000)*100; Currmthstart=int(DateNum()/100)*100; Profit=profitmth=0; Lastsig=Lastbuysig=Lastsellsig=Lastcoversig=Lastshortsig=0; for( i = 0; i < BarCount; i++ ) { if (i>0) { if(mth[i]!=mth[i-1]) { profitmth[i]=0; } else { profitmth[i]=profitmth[i-1]; } } if(i>0)profit[i]=profit[i-1]; if((i>0 AND Datex[i]!= Datex[i-1]) OR i==(BarCount-1)) { if(i!=BarCount-1) { if (Lastbuysig==1)profit[i]=profit[i]+avp[i-1]-priceatbuy; if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i-1]; } else { if (Lastbuysig==1)profit[i]=profit[i]+avp[i]-priceatbuy; if (Lastshortsig==1)profit[i]=profit[i]+priceatshort-avp[i]; } if (showprice=="YES" AND Interval()< 86400)PlotText( "Profit\n" + WriteVal(Profit[ i ],1.0) , i, L[ i ]- dist[i]/2, colorBlack ); if(Datex[i]>Currmthstart[i] AND mth[i]==mth[i-1] ) { ProfitMth[i]=profitmth[i-1]+profit[i]; } profit[i]=0; Lastsig=Lastbuysig=Lastsellsig=Lastcoversig=Lastshortsig=0; } if (Buy1[i]) { Lastbuysig=1; priceatbuy=avp[i]; if (Lastshortsig==1) { profit[i]=profit[i]+priceatshort-avp[i]; Lastshortsig=0; } } if (Sell1[i]) { Lastshortsig=1; priceatshort=avp[i]; if (Lastbuysig==1) { profit[i]=profit[i]+avp[i]-priceatbuy; Lastbuysig=0; } } if (Cover2[i]) { Lastcoversig=1; priceatcover=avp[i]; if (Lastshortsig==1) { profit[i]=profit[i]+priceatshort-avp[i]; Lastshortsig=0; } } if (Sell2[i]) { Lastsellsig=1; priceatsell=avp[i]; if (Lastbuysig==1) { profit[i]=profit[i]+avp[i]-priceatbuy; Lastbuysig=0; } } if(showprice=="YES" ) { if( Buy[i] ) PlotText( "CBuy\n@" + avp[ i ] , i, L[ i ]-dist[i], colorBlue ); if( Sell[i] ) PlotText( "CSell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue); if( Buy1[i] ) PlotText( "EBuy\n@" + avp[ i ], i, L[ i ]-dist[i], colorBlue ); if( Sell1[i] ) PlotText( "ESell\n@" + avp[ i ], i, H[ i ]+dist[i], colorBlue); } } Plot( 1, "", IIf(EMA(C,15)>EMA(C,60) , colorPaleGreen, colorRose ),styleArea | styleOwnScale, 0, 1 ); _SECTION_END(); _SECTION_BEGIN("Volume At Price"); //PlotVAPOverlay(Param("Lines", 1000, 100, 1000, 10), Param("Width", 15, 1, 100, 1), ParamColor("Color", colorBlue), ParamToggle("Side", "Left|Right", 1) | 4 *ParamToggle("Z-order", "On top|Behind", 1)); _SECTION_END(); Title = "Moving Average TRADES "+Date()+" "+ Interval(format=2)+" "+Name()+" "+"O "+WriteVal(O,1.2)+" "+"H "+WriteVal(H,1.2)+" L"+WriteVal(L,1.2)+" C "+WriteVal(C,1.2)+" Vol "+WriteVal(V,1.0)+" "+EncodeColor (colorRed)+WriteIf(EMA(C,3)>EMA(C,16),EncodeColor(colorGreen),EncodeColor(colorRed))+" EMA 3/16 "+WriteVal(EMA(C,3),1.0)+"/"+WriteVal(EMA(C,16),1.0)+WriteIf(EMA(C,15)>EMA(C,60),EncodeColor (colorGreen),EncodeColor(colorRed))+" EMA 15/60 "+WriteVal(EMA(C,15),1.0)+"/"+WriteVal(EMA(C,60),1.0)+" ProfitMth "+WriteVal(profitmth+profit,1.0)+" Bar Secs Left "+ WriteVal(secstogo,1.0)+" "+ "\n"+EncodeColor(colorRed)+" Stoploss " +WriteVal(Trailstop,1.2) ; |
How to Use AFL for Amibroker
- Download Amibroker AFL File.
- Now copy the afl file and paste it to \Program Files\AmiBroker\Formulas\Custom. [For 32 bit]
- Have you 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? Than Just Watch our Video Tutorial.
Tags amibroker afl
0 thoughts on “Advanced Moving Average Buy Sell AFL Always Reach Goals”