//+------------------------------------------------------------------+ //| MasTrend.mq4 | //| mladen | //+------------------------------------------------------------------+ //mod209fxtsd MAsTrend C #property copyright "mladen" #property link "mladenfx@gmail.com" #property indicator_separate_window #property indicator_buffers 1 #property indicator_color1 Red // // // // // extern int Price = PRICE_CLOSE; extern int Mas.Type = MODE_SMA; extern int Mas.Start = 20; extern int Mas.End = 200; extern int Mas.Step = 10; // // // // // double MasTrendBuffer[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexBuffer(0,MasTrendBuffer); return(0); } // // // // // int start() { int counted_bars=IndicatorCounted(); int limit,i; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Bars-counted_bars; // // // // // for(i=limit; i>=0; i--) { int masPeriod = Mas.Start; int masCount = 0; int total = 0; for (; masPeriod<=Mas.End; masPeriod+= Mas.Step, masCount++) { double ma0 = iMA(NULL,0,masPeriod,0,Mas.Type,Price,i); double ma1 = iMA(NULL,0,masPeriod,0,Mas.Type,Price,i+1); if (ma0 > ma1) total++; if (ma0 < ma1) total--; } MasTrendBuffer[i] = 100.00*total/masCount; } return(0); }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Indicators Used:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: