English

## Help Converting Indicator

 15 kraziekris 2014.08.13 20:21   Hi,I have an indicator which is in TradeStation.I have already had the function written in MQL but the developer went awol. I hope that its simple to finish because the actual indicator is very simple.In TradeStation this is the code ```Inputs:                 Price(Close),                           Period(32),                 UpColour(green),                 DnColour(red);          Value1 = function1(Price, period, 2); Plot1(Value1, "line"); { Color criteria } if Value1 > Value1[1] then                 SetPlotColor[0]( 1, UpColour) else if Value1 < Value1[1] then                 SetPlotColor[0]( 1, DnColour ) else                 SetPlotColor[0]( 1, Cyan );``` Now likeThe part which says Value1 = function1(Price, period, 2);This is the function here.```double function1 ( int CurrentBar, double Price, int iptPeriod, int iptPoles) { static double  aa, b , w , y1 , y2 , y3 , y4 ,     a_1 , a_12 , a_13 , a_14 , a2 , a3 , a4 ;    double x = 0;    double y = 0;    int period = 2;    int poles = 0;    double SQRT2 = MathSqrt(2.0);    double pi=3.1415926535;         if (iptPeriod < 2)                   period = 2;         else                 period = iptPeriod;                           if (iptPoles < 1)                 poles = 1;         else if (iptPoles > 4)                 poles = 4;         else                 poles = iptPoles;          if (CurrentBar == MaxBarsBack) {             w = 1.2222* 2.0 * pi / period;             //w = 220 * w / pi; // in degrees             //w = w*pi/180.0;  // convert to radians               b = (1 - MathCos(w)) / (MathPow(SQRT2, 2.0/poles) - 1.0);                      aa = -b + MathSqrt(b*b + 2*b);             a_1 = 1.0 - aa;             a_12 = a_1 * a_1;             a_13 = a_12 * a_1;             a_14 = a_12 * a_12;             a2 = aa * aa;             a3 = aa * aa * aa;             a4 = a2 * a2;                      y1 = Price;             y2 = y1;             y3 = y2;             y4 = y3;         }         x = Price;                  if (poles == 1)                 y = aa * x + a_1 * y1;         else if (poles == 2)                 y = a2 * x + 2 * a_1 * y1 - a_12 * y2;         else if (poles == 3)                 y = a3 * x + 3 * a_1 * y1 - 3 * a_12 * y2 + a_13 * y3;         else if (poles == 4)                 y = a4 * x + 4 * a_1 * y1 - 6 * a_12 * y2 + 4 * a_13 * y3 - a_14 * y4;                  if (New_Bar) {           y4 = y3;           y3 = y2;           y2 = y1;           y1 = y;           }                  return (y); } ``` The work is almost done I just need to get this indicator to be put together so that it plots. ThanksKris