Announcement

Collapse
No announcement yet.

Need help for "Asymmetrical Exponential Mmoving Average" code conversion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help for "Asymmetrical Exponential Mmoving Average" code conversion

    Can anyone help to convert the following simple but useful Wealth-lab codes to EFS please?

    "Asymmetrical Exponential Mmoving Average" (ASEMA )by DrKoch.
    There are two periods, one for upward movements, the other for downward movements. This changes the shape of band limits in a favorable way.

    Many thanks in advance...
    Last edited by howcool; 06-03-2004, 02:10 PM.

  • #2
    how interesting ... thx for link

    Comment


    • #3
      Unlike Wealth-lab, this board is not a right place for seek help.

      Comment


      • #4
        I am sorry no one has been able to help you but I too have wealth lab and the ASEMA script does not work. I am not very familiar with the Wealth Lab script so I am not sure what is wrong with it.

        Is the script suppose to draw one or three lines? What is the condition that determines which line to draw if one line is drawn?

        If you will answer these two questions this script can be written in ten minutes. Also next time instead of giving a link post the script that you want translated.



        WealthScript Code
        // This is an asymetrical Exponential moving average (EMA)
        // There a two periods, one for upward movements,
        // the other for downward movements. This changes the shape
        // of band limits in a favorable way.
        //
        // The periods are float parameters so it is possible to have a period of 3.5 bars.
        //
        // Tip: Optimize your favorit trading system with non-integer
        // periods.
        function ASEMASeries( Series: Integer; per_up: Float; per_down: Float ): integer;
        begin
        var Bar: integer;
        var sName: string;
        var Value: float;
        var x, x_old, alpha_up, alpha1_up, alpha_dn, alpha1_dn: float;

        sName := 'ASEMA(' + GetDescription( Series ) + ',' + FloatToStr( per_up ) + ',' + FloatToStr( per_down ) + ')';
        Result := FindNamedSeries( sName );
        if Result >= 0 then
        Exit;
        // calculate time constants
        alpha1_up := exp(-2.0 / (per_up-1));
        alpha_up := 1.0 - alpha1_up;
        alpha1_dn := exp(-2.0 / (per_down-1));
        alpha_dn := 1.0 - alpha1_dn;
        Result := CreateNamedSeries( sName );
        x_old:= GetSeriesValue(0, Series);
        for Bar := 0 to BarCount() - 1 do
        begin
        x := GetSeriesValue(Bar, series);
        if x > x_old then begin
        x := alpha_up * x + alpha1_up * x_old;
        end else begin
        x := alpha_dn * x + alpha1_dn * x_old;
        end;
        SetseriesValue(Bar, Result, x);
        x_old := x;
        end;
        end;

        function ASEMA( Bar: integer; Series: Integer; per_up: Float; per_down: Float ): float;
        begin
        Result := GetSeriesValue( Bar, ASEMASeries( Series, per_up, per_down ) );
        end;

        Comment


        • #5
          I took a shot at a translation. You can find the ASEMA script here:

          http://share.esignal.com/groupconten...us&groupid=114

          Chris

          Comment


          • #6
            Originally posted by whatever
            Is the script suppose to draw one or three lines? What is the condition that determines which line to draw if one line is drawn?
            If you will answer these two questions this script can be written in ten minutes. Also next time instead of giving a link post the script that you want translated.
            Hi whatever,
            The script just draw one line. Hint: You should use two ASEMA lines with different parameter to indicate up or down trend.
            Actually I posted whole script (same as you posted) but deleted it two days later since I thought no one will help me. I am sorry about that.

            Mike

            Comment


            • #7
              Chris,
              Thank you! exactly what I need.

              Mike

              Originally posted by ckryza
              I took a shot at a translation. You can find the ASEMA script here:

              http://share.esignal.com/groupconten...us&groupid=114

              Chris

              Comment

              Working...
              X