#property copyright "Copyright © 2008, Nasatajrie" #property link "nasatajrie@yahoo.com" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Red #property indicator_color2 Red #property indicator_color3 Blue #property indicator_color4 Blue double g_ibuf_76[]; double g_ibuf_80[]; double g_ibuf_84[]; double g_ibuf_88[]; extern int Rperiod = 30; extern int RperiodShift = 0; extern int Filter = 0; extern int Rprice = 0; extern int LSMA_Period = 30; extern int LSMA_PeriodShift = 0; int gi_120; int gi_124; int gi_128; int gi_132; int gi_136; int gi_140; int gi_144; double gd_148; double gd_156; double g_ibuf_172[]; double g_ibuf_176[]; double gda_unused_180[]; double g_ibuf_184[]; double gda_unused_188[]; int init() { IndicatorBuffers(7); SetIndexBuffer(0, g_ibuf_76); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2); SetIndexShift(0, LSMA_PeriodShift); SetIndexBuffer(1, g_ibuf_80); SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2); SetIndexShift(1, LSMA_PeriodShift); SetIndexBuffer(2, g_ibuf_84); SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2); SetIndexShift(2, RperiodShift); SetIndexBuffer(3, g_ibuf_88); SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2); SetIndexShift(3, RperiodShift); SetIndexBuffer(4, g_ibuf_176); SetIndexBuffer(5, g_ibuf_172); SetIndexBuffer(6, g_ibuf_184); return (0); } int start() { gi_120 = Bars - Rperiod - 5; gi_140 = Rperiod; gi_144 = LSMA_Period; gi_136 = gi_120 - gi_140 - 1; for (gi_124 = gi_136; gi_124 >= 0; gi_124--) { g_ibuf_176[1] = 0; for (gi_128 = gi_140; gi_128 >= 1; gi_128--) { gd_148 = gi_140 + 1; gd_148 /= 3.0; gd_156 = 0; gd_156 = (gi_128 - gd_148) * (Close[gi_140 - gi_128 + gi_124]); g_ibuf_176[1] += gd_156; } g_ibuf_172[gi_124] = 6.0 * g_ibuf_176[1] / (gi_140 * (gi_140 + 1)); gi_132 = gi_124; g_ibuf_184[gi_124] = g_ibuf_172[gi_132 + 1] + 2.0 * (g_ibuf_172[gi_132] - (g_ibuf_172[gi_132 + 1])) / (gi_144 + 1); g_ibuf_76[gi_124] = g_ibuf_172[gi_124]; g_ibuf_80[gi_124] = g_ibuf_184[gi_124]; g_ibuf_84[gi_124] = g_ibuf_172[gi_124]; g_ibuf_88[gi_124] = g_ibuf_184[gi_124]; if (g_ibuf_172[gi_124] < g_ibuf_184[gi_124]) { g_ibuf_88[gi_124] = EMPTY_VALUE; g_ibuf_84[gi_124] = EMPTY_VALUE; } } return (0); }