Announcement

Collapse
No announcement yet.

missing points in drawing Moving Average in Chart

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

  • missing points in drawing Moving Average in Chart

    Hi,

    I'm trying to draw a simple Moving Average (MA) in the chart. My EFS is attached, as well as the chart.

    My chart seems to miss drawing the MA the length of days in my simple MA calculation.

    Does anyone know why that's the case?

    William
    Attached Files

  • #2
    Here's the EFS. Not sure why it wasn't attached in the previous post.

    How do I insert images, and EFS code in my email?

    W
    Attached Files

    Comment


    • #3
      I think I found the problem, I should have used -MALength to retrieve the previous data bar instead of the future.

      My next question related to this is, if I want another MA with different input parameter, how do I set them and apply it to the same chart, or in a separate chart directly below the Price chart?

      Thank you in advance.

      William

      Comment


      • #4
        William
        You would need to create a second distinct set of parameters and variables (eg MALength2, temp2, etc) and then run another for loop to calculate the second moving average. Then modify the return statement to return an array.
        You cannot apply this second average to a separate pane because an efs can only plot in a single pane (either the price pane or a separate one)
        Alex

        Comment


        • #5
          I am able to use the same efs formula - MA.efs - and apply it to one chart but with different parameters that give me both a Long MA and Short MA plotting on the same chart.

          But what you're telling me, as least that's how I interpret it, is that I cannot do that unless I specific another set of parameters for the second MA curve, them pass them into the same MA.efs with an extra for loop which calculates the second MA curve.

          Also, how do I open multiple charts, each with different symbol and with different instances of the MA.efs formula? Because when I go the File->New->Advanced Chart, I open another window with chart, but this new window always has the same symbol as the chart previously opened. No matter what symbol I insert on one chart, both chart windows display the same symbol.

          My goal is to have multiple charts opened, each uses the same set of formula (but with different parameters), and each would give buy/sell signals according to the strategy that I have to program. Is that do-able under eSignal? If so, I would be interested to find out how.

          Thank you.

          William

          Comment


          • #6
            William

            But what you're telling me, as least that's how I interpret it, is that I cannot do that unless I specific another set of parameters for the second MA curve, them pass them into the same MA.efs with an extra for loop which calculates the second MA curve
            You would need to do that if you want to calculate and plot two moving averages using a single instance of your efs.
            If instead you want to run two copies of your efs each one calculating a different moving average then just apply that efs twice to the chart and use Edit Studies to set the different parameters.
            As an aside you may find it easier to use the built-in moving average function rather than writing your own.

            Because when I go the File->New->Advanced Chart, I open another window with chart, but this new window always has the same symbol as the chart previously opened. No matter what symbol I insert on one chart, both chart windows display the same symbol.
            That is happening because you have Symbol linking enabled. See this article in the eSignal KnowledgeBase on Symbol and Interval Linking.
            Alex

            Comment


            • #7
              Alex,

              Thank you so much. It's clear now.

              William

              Comment

              Working...
              X