Announcement

Collapse
No announcement yet.

EMA of Daily Range

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

  • EMA of Daily Range

    Hi Alex,

    Would you know how I could obtain the EMA (Exponential MA) for the Daily Range?

    I am currently trying (in section before preMain) :-

    var DailyRange;

    // The 55 EMA of the period's range
    var EMA55_of_Range = new MAStudy(55, 0, DailyRange, MAStudy.MA, MAStudy.EXPONENTIAL);

    Then in Main :-

    DailyRange = high() - low();
    var vEMA_of_Range = EMA55_of_Range.getValue(MAStudy.MA, 0);

    But I get syntax error saying the DailyRange parameter (the 3rd parameter) in the MAStudy is invalid. I know it is not assigned in value but the variable is declared.

    What needs to be done?

    Thanks,

    Christopher

  • #2
    Re: EMA of Daily Range

    Christopher
    See my reply to a similar question posted in this thread
    Alex


    Originally posted by daborn-fox
    Hi Alex,

    Would you know how I could obtain the EMA (Exponential MA) for the Daily Range?

    I am currently trying (in section before preMain) :-

    var DailyRange;

    // The 55 EMA of the period's range
    var EMA55_of_Range = new MAStudy(55, 0, DailyRange, MAStudy.MA, MAStudy.EXPONENTIAL);

    Then in Main :-

    DailyRange = high() - low();
    var vEMA_of_Range = EMA55_of_Range.getValue(MAStudy.MA, 0);

    But I get syntax error saying the DailyRange parameter (the 3rd parameter) in the MAStudy is invalid. I know it is not assigned in value but the variable is declared.

    What needs to be done?

    Thanks,

    Christopher

    Comment


    • #3
      EMA of Daily Range

      I have created a new function "DailyRange" as follows :-

      function DailyRange() {

      // Returns the daily range
      return (high(0) - low(0));

      }

      And have also created, in Main, a call to this as :-

      var vDailyRange = efsInternal("DailyRange");
      var vEMA_of_Range = ema(55, vDailyRange);

      This appears to be working, but I'd appreciate it if you seen any obvious errors.

      Many thanks for your help.

      Comment


      • #4
        Re: EMA of Daily Range

        Christopher

        This appears to be working, but I'd appreciate it if you seen any obvious errors.
        Not that I can see.
        FWIW the examples suggested in my reply in the linked thread are complete working examples so you may want to reference them when writing your script
        Alex


        Originally posted by daborn-fox
        I have created a new function "DailyRange" as follows :-

        function DailyRange() {

        // Returns the daily range
        return (high(0) - low(0));

        }

        And have also created, in Main, a call to this as :-

        var vDailyRange = efsInternal("DailyRange");
        var vEMA_of_Range = ema(55, vDailyRange);

        This appears to be working, but I'd appreciate it if you seen any obvious errors.

        Many thanks for your help.

        Comment

        Working...
        X