Announcement

Collapse
No announcement yet.

Quick sma() Question

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

  • Quick sma() Question

    I am confused, why does this return a null value ? (I have declared it as a global in pre-main):

    MAofVolume=sma(14, volume(0));

    Thanks, I am probably doing something stupid

  • #2
    rogerha,

    Declaring a variable as global has to be done outside main and premain. Also, the assignment of the efs2 object to the global variable has to be within main and should only be done once. Additionally, you are using volume(0) in your declaration. That is a number. Use it without the parenthesis to use the series.
    Last edited by ; 12-19-2006, 12:53 PM.

    Comment


    • #3
      Hello rogerha,

      When creating a study on study series, the source that is passed to the sma() series needs to be in the form of a Series Object. For any of the series functions or built-in study functions that can be used to create a series object, you must not specify a bar index parameter. When you request a specific bar index, such as volume(0), the function returns the specific value from that bar index of 0 rather than the volume series. Try the following.

      MAofVolume=sma(14, volume());
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        Gotchya.

        Gentleman, thank you both for your help. I wish you both a very happy christmas/holidays, and a good new year !

        Roger

        Comment


        • #5
          rogerha,

          You are most welcome. May you and yours have a merry Christmas and a happy New Year.

          As a follow-up to what Jason indicated, I was going to recommend you use the efs2 toolbox. I checked it first and noted it placed the zero in there when inserting the volume as a series.

          Just remove the zero there and keep the parenthesis. While it is extremely useful, be aware that is an idiosyncrasy of that tool.

          Comment


          • #6
            Thanks again Steve.

            Comment

            Working...
            X