Announcement

Collapse
No announcement yet.

i need help calculating an average please

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

  • i need help calculating an average please

    hi everyone, could anyone please help me to compute the moving average of the last 2 bars ranges then divide it by the moving average of the same 2 bars volumes.. thank you

  • #2
    abjad
    Given that calculating the moving average of the High minus the Low [ie the Range] is the same as calculating the moving average of the High minus the moving average of the Low you can simply write the formula as follows in its most basic form



    For the description and syntax of all the functions used [together with examples of their use] see the corresponding articles in the EFS KnowledgeBase
    If for whatever reason you need something more than this then see the script for an average of High-Low provided in this post and adapt it to your needs using the example given above as the outline
    Alex


    Originally posted by abjad View Post
    hi everyone, could anyone please help me to compute the moving average of the last 2 bars ranges then divide it by the moving average of the same 2 bars volumes.. thank you

    Comment


    • #3
      Originally posted by Alexis C. Montenegro View Post
      abjad
      Given that calculating the moving average of the High minus the Low [ie the Range] is the same as calculating the moving average of the High minus the moving average of the Low you can simply write the formula as follows in its most basic form



      For the description and syntax of all the functions used [together with examples of their use] see the corresponding articles in the EFS KnowledgeBase
      If for whatever reason you need something more than this then see the script for an average of High-Low provided in this post and adapt it to your needs using the example given above as the outline
      Alex
      OMG Alexis, i can't believe that you've solved it in one line... it does exactly what i want it to do..

      can i ask you to show me how to leave it to the user (me in this case) to enter the number of bars needed to be averaged??

      i am not a programmer and if it is a hassle you don't need to worry about it, what you have helped me already with is more than enough and i am very thankful

      Comment


      • #4
        abjad
        Here is how you can do it using the most basic method (again simplicity being the main objective)



        I would suggest that you also review this post which shows you both methods available using a very simple [and comparable to your script] example
        Alex


        Originally posted by abjad View Post
        OMG Alexis, i can't believe that you've solved it in one line... it does exactly what i want it to do..

        can i ask you to show me how to leave it to the user (me in this case) to enter the number of bars needed to be averaged??

        i am not a programmer and if it is a hassle you don't need to worry about it, what you have helped me already with is more than enough and i am very thankful

        Comment


        • #5
          Alexis, thank you very much.... you were very helpful... if i had more questions i will ask for your help.. thank you so much
          Originally posted by Alexis C. Montenegro View Post
          abjad
          Here is how you can do it using the most basic method (again simplicity being the main objective)



          I would suggest that you also review this post which shows you both methods available using a very simple [and comparable to your script] example
          Alex

          Comment


          • #6
            abjad
            You are welcome
            Alex


            Originally posted by abjad View Post
            Alexis, thank you very much.... you were very helpful... if i had more questions i will ask for your help.. thank you so much

            Comment


            • #7
              Alex, it's me again... i am gonna have to annoy you one more time but this time i think i have a harder question lol

              what if what i want to calculate is the sma of the volume but when it comes to range i want the actual range of the concerned bars.. e.g. if length is 3 then i want to calculate the range between the highest high of the previous 3 bars and the lowest low of the same 3 bars instead of (range1 +range2 +range3)/3 !!!!!! is it doable????

              Originally posted by Alexis C. Montenegro View Post
              abjad
              You are welcome
              Alex

              Comment


              • #8
                abjad
                In that case replace sma in the example I provided earlier with either hhv or highest and llv or lowest [it should be self-evident which one is to be used where]. See the EFS KnowledgeBase for the description and syntax of these functions.
                If – as it seems – you intend to use studies based on efs then I would suggest that you spend some time learning how to code in efs the proper way rather than trying to do so through snippets of information. To this purpose you may want to start by reviewing the JavaScript for EFS video series and the Core JavaScript Reference Guide. Those will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and review the Help Guides and Tutorials which will provide you with the specifics of EFS. As you are learning also search the forums where you will find literally thousands between scripts and/or examples that you can use
                Alex


                Originally posted by abjad View Post
                Alex, it's me again... i am gonna have to annoy you one more time but this time i think i have a harder question lol

                what if what i want to calculate is the sma of the volume but when it comes to range i want the actual range of the concerned bars.. e.g. if length is 3 then i want to calculate the range between the highest high of the previous 3 bars and the lowest low of the same 3 bars instead of (range1 +range2 +range3)/3 !!!!!! is it doable????

                Comment

                Working...
                X