//+------------------------------------------------------------------+ //| | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006" #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 SpringGreen #property indicator_color4 Salmon #property indicator_width1 3 #property indicator_width2 3 #property indicator_width3 2 #property indicator_width4 2 //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double CrossUp[]; double CrossDown[]; extern int Flsma = 15; extern int Slsma = 22; extern bool CrossBarInProgress = false; extern bool AlertCross= false; double dFlsma,dSlsma; double Fsum,Ssum; double Fwt,Swt; int BarInProgress; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { dFlsma=Flsma; dSlsma=Slsma; BarInProgress=0; //---- drawing settings SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2, DRAW_ARROW, EMPTY); SetIndexArrow(2, 233); SetIndexBuffer(2, CrossUp); SetIndexStyle(3, DRAW_ARROW, EMPTY); SetIndexArrow(3, 234); SetIndexBuffer(3, CrossDown); //---- initialization done return(0); } int start() { if (Volume[0]>1 && !CrossBarInProgress) BarInProgress=1; else BarInProgress=0; for(int shift = Bars-Slsma-1; shift >= BarInProgress; shift--) { Ssum = 0; Fsum = 0; for(int i = Slsma; i >= 1 ; i--) { Ssum=Ssum+( i - ((dSlsma + 1)/3) )*Close[Slsma-i+shift]; if (i<=Flsma) Fsum = Fsum+( i - ((dFlsma + 1)/3) )*Close[Flsma-i+shift]; } Swt = Ssum*6/(Slsma*(Slsma+1)); Fwt = Fsum*6/(Flsma*(Flsma+1)); ExtMapBuffer1[shift] = Swt; //Blue ExtMapBuffer2[shift] = Fwt; //Red CrossUp[shift]=0; CrossDown[shift]=0; if (Fwt>Swt && ExtMapBuffer2[shift+1]<ExtMapBuffer1[shift+1]) { CrossUp[shift] = Swt-10*Point; if (AlertCross && shift==0) Alert("LSMA crossed, BUY ",Symbol()," at ",Close[0]); } else if (Fwt<Swt && ExtMapBuffer2[shift+1]>ExtMapBuffer1[shift+1]) { CrossDown[shift] = Swt+10*Point; if (AlertCross && shift==0) Alert("LSMA crossed, SELL ",Symbol()," at ",Close[0]); } } return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains tick volumes of each bar
Series array that contains close prices for each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_ARROW
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features:
It issuies visual alerts to the screen