//+------------------------------------------------------------------+ //| Econome Javier Momentum Arrows.mq4 v. 1.0 | //| Copyright © 2018 by Econome | //| Based on nnjeim MA Cross | //| Reliant on Trend Lab AllAv3.1 | //| | //+------------------------------------------------------------------+ #property copyright "Copyright © 2018 by Econome" #property link "http://www.forex-station.com" /* Requires AllAverages_v3.1.mq4 */ // List of MAs: // MA_Method= 0: SMA - Simple Moving Average // MA_Method= 1: EMA - Exponential Moving Average // MA_Method= 2: Wilder - Wilder Exponential Moving Average // MA_Method= 3: LWMA - Linear Weighted Moving Average // MA_Method= 4: SineWMA - Sine Weighted Moving Average // MA_Method= 5: TriMA - Triangular Moving Average // MA_Method= 6: LSMA - Least Square Moving Average (or EPMA, Linear Regression Line) // MA_Method= 7: SMMA - Smoothed Moving Average // MA_Method= 8: HMA - Hull Moving Average by Alan Hull // MA_Method= 9: ZeroLagEMA - Zero-Lag Exponential Moving Average // MA_Method=10: DEMA - Double Exponential Moving Average by Patrick Mulloy // MA_Method=11: T3_basic - T3 by T.Tillson (original version) // MA_Method=12: ITrend - Instantaneous Trendline by J.Ehlers // MA_Method=13: Median - Moving Median // MA_Method=14: GeoMean - Geometric Mean // MA_Method=15: REMA - Regularized EMA by Chris Satchwell // MA_Method=16: ILRS - Integral of Linear Regression Slope // MA_Method=17: IE/2 - Combination of LSMA and ILRS // MA_Method=18: TriMAgen - Triangular Moving Average generalized by J.Ehlers // MA_Method=19: VWMA - Volume Weighted Moving Average // MA_Method=20: JSmooth - Smoothing by Mark Jurik // MA_Method=21: SMA_eq - Simplified SMA // MA_Method=22: ALMA - Arnaud Legoux Moving Average // MA_Method=23: TEMA - Triple Exponential Moving Average by Patrick Mulloy // MA_Method=24: T3 - T3 by T.Tillson (correct version) // MA_Method=25: Laguerre - Laguerre filter by J.Ehlers // MA_Method=26: MD - McGinley Dynamic // List of Prices: // Price = 0 - Close // Price = 1 - Open // Price = 2 - High // Price = 3 - Low // Price = 4 - Median Price = (High+Low)/2 // Price = 5 - Typical Price = (High+Low+Close)/3 // Price = 6 - Weighted Close = (High+Low+Close*2)/4 // Price = 7 - Heiken Ashi Close // Price = 8 - Heiken Ashi Open // Price = 9 - Heiken Ashi High // Price =10 - Heiken Ashi Low #property indicator_chart_window #property indicator_buffers 6 #property indicator_color1 Yellow #property indicator_color2 Yellow #property indicator_color3 Orange #property indicator_color4 Orange #property indicator_color5 Green #property indicator_color6 Red //---- input parameters extern int LMAper=20; extern int MMAper=10; extern int SMAper=5; extern int LMApri=4; extern int MMApri=0; extern int SMApri=4; extern int LMAmet=25; extern int MMAmet=23; extern int SMAmet=23; extern string PriceMode = ""; extern string _0 = "Close"; extern string _1 = "Open"; extern string _2 = "High"; extern string _3 = "Low"; extern string _4 = "Median"; extern string _5 = "Typical"; extern string _6 = "Weighted Close"; extern string _7 = "Heiken Ashi Close"; extern string _8 = "Heiken Ashi Open"; extern string _9 = "Heiken Ashi High"; extern string _10 = "Heiken Ashi Low"; extern string MAMode = ""; extern string __0 = "SMA"; extern string __1 = "EMA"; extern string __2 = "Wilder"; extern string __3 = "LWMA"; extern string __4 = "SineWMA"; extern string __5 = "TriMA"; extern string __6 = "LSMA"; extern string __7 = "SMMA"; extern string __8 = "HMA"; extern string __9 = "ZeroLagEMA"; extern string __10 = "DEMA"; extern string __11 = "T3 basic"; extern string __12 = "ITrend"; extern string __13 = "Median"; extern string __14 = "GeoMean"; extern string __15 = "REMA"; extern string __16 = "ILRS"; extern string __17 = "IE/2"; extern string __18 = "TriMAgen"; extern string __19 = "VWMA"; extern string __20 = "JSmooth"; extern string __21 = "SMA_eq"; extern string __22 = "ALMA"; extern string __23 = "TEMA"; extern string __24 = "T3"; extern string __25 = "Laguerre"; extern string __26 = "MD"; // MA_Method= 0: SMA - Simple Moving Average // MA_Method= 1: EMA - Exponential Moving Average // MA_Method= 2: Wilder - Wilder Exponential Moving Average // MA_Method= 3: LWMA - Linear Weighted Moving Average // MA_Method= 4: SineWMA - Sine Weighted Moving Average // MA_Method= 5: TriMA - Triangular Moving Average // MA_Method= 6: LSMA - Least Square Moving Average (or EPMA, Linear Regression Line) // MA_Method= 7: SMMA - Smoothed Moving Average // MA_Method= 8: HMA - Hull Moving Average by Alan Hull // MA_Method= 9: ZeroLagEMA - Zero-Lag Exponential Moving Average // MA_Method=10: DEMA - Double Exponential Moving Average by Patrick Mulloy // MA_Method=11: T3 - T3 by T.Tillson // MA_Method=12: ITrend - Instantaneous Trendline by J.Ehlers // MA_Method=13: Median - Moving Median // MA_Method=14: GeoMean - Geometric Mean // MA_Method=15: REMA - Regularized EMA by Chris Satchwell // MA_Method=16: ILRS - Integral of Linear Regression Slope // MA_Method=17: IE/2 - Combination of LSMA and ILRS // MA_Method=18: TriMAgen - Triangular Moving Average generalized by J.Ehlers // MA_Method=19: VWMA - Volume Weighted Moving Average // MA_Method=20: JSmooth - Smoothing by Mark Jurik // List of Prices: // Price = 0 - Close // Price = 1 - Open // Price = 2 - High // Price = 3 - Low // Price = 4 - Median Price = (High+Low)/2 // Price = 5 - Typical Price = (High+Low+Close)/3 // Price = 6 - Weighted Close = (High+Low+Close*2)/4 // Price = 7 - Heiken Ashi Close // Price = 8 - Heiken Ashi Open // Price = 9 - Heiken Ashi High // Price =10 - Heiken Ashi Low extern int ArrowShift1=60; extern int ArrowShift2=120; extern int ArrowShift3=180; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; double ExtMapBuffer5[]; double ExtMapBuffer6[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW,EMPTY,1); SetIndexArrow(0,228); SetIndexBuffer(0,ExtMapBuffer1); SetIndexEmptyValue(0,0.0); SetIndexStyle(1,DRAW_ARROW,EMPTY,1); SetIndexArrow(1,230); SetIndexBuffer(1,ExtMapBuffer2); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_ARROW,EMPTY,1); SetIndexArrow(2,236); SetIndexBuffer(2,ExtMapBuffer3); SetIndexEmptyValue(2,0.0); SetIndexStyle(3,DRAW_ARROW,EMPTY,1); SetIndexArrow(3,238); SetIndexBuffer(3,ExtMapBuffer4); SetIndexEmptyValue(3,0.0); SetIndexStyle(4,DRAW_ARROW,EMPTY,4); SetIndexArrow(4,241); SetIndexBuffer(4,ExtMapBuffer5); SetIndexEmptyValue(4,0.0); SetIndexStyle(5,DRAW_ARROW,EMPTY,4); SetIndexArrow(5,242); SetIndexBuffer(5,ExtMapBuffer6); SetIndexEmptyValue(5,0.0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit,i; int counted_bars=IndicatorCounted(); if (counted_bars<0) return(-1); if (counted_bars>0) counted_bars--; limit=Bars-1; if(counted_bars>=1) limit=Bars-counted_bars-1; if (limit<0) limit=0; double curlma=0.0,prevlma=0.0,curmma=0.0,prevmma=0.0,cursma=0.0,prevsma=0.0; for (i=limit;i>=0;i--) //TF,P,Per,Sh,Me,Col,So,SoShif,sou,mode,shi { curlma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,LMApri,LMAper,0,LMAmet,1,0,0,"alert.wav","alert2.wav",0,i); prevlma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,LMApri,LMAper,0,LMAmet,1,0,0,"alert.wav","alert2.wav",0,i+1); curmma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,MMApri,MMAper,0,MMAmet,1,0,0,"alert.wav","alert2.wav",0,i); prevmma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,MMApri,MMAper,0,MMAmet,1,0,0,"alert.wav","alert2.wav",0,i+1); cursma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,SMApri,SMAper,0,SMAmet,1,0,0,"alert.wav","alert2.wav",0,i); prevsma =iCustom(NULL, NULL, "! ! AllAverages_v3.1",0,SMApri,SMAper,0,SMAmet,1,0,0,"alert.wav","alert2.wav",0,i+1); ExtMapBuffer1[i]=0; ExtMapBuffer2[i]=0; /* ExtMapBuffer3[i]=0; ExtMapBuffer4[i]=0; ExtMapBuffer5[i]=0; ExtMapBuffer6[i]=0; */ //Signal 1 if ((cursma>curmma) && (prevsma<=prevmma) && Close[i]>Low[i+2]) ExtMapBuffer1[i]=Low [i+1]-ArrowShift1*Point; //uparrow if ((cursma=prevmma) && Close[i]curlma) && (prevsmaLow[i+2]) ExtMapBuffer3[i]=Low[i+1]-ArrowShift2*Point; //uparrow if ((cursmaprevlma) && Close[i]curlma) || (curmma>curlma)) && ((prevsma<=prevlma) && prevmma<=prevlma) && Close[i]>Low[i+2] ) ExtMapBuffer5[i]=Low[i+1]-ArrowShift3*Point; if ( ((cursma=prevlma) && prevmma>=prevlma) && Close[i]