Announcement

Collapse
No announcement yet.

average hi/lo

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

  • average hi/lo

    I figure I can get the code to calculate the average of the difference between the high and low for the past 5 days, but I want to know if there is code to have this calculation to show up on the left hand corner of the chart.

  • #2
    I just got done writing a little script which changes the title. So I added your value to the title.

    Does that count for upper left?


    EFS attached (hopefully)
    Attached Files

    Comment


    • #3
      Hello ryanlangdon,

      You could also use dgerdes' code and add one of the drawText functions (see Drawing Functions). To position the text label in the upper left corner of the chart you would use the Text.RELATIVETOTOP and Text.RELATIVETOLEFT flags with a fixed tag name parameter.
      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
        dgerdes
        I appreciate the help on the efs, but I was looking for something a little different. Where the calculation will be placed on the chart. The calculation was right on, but is there a way where I can have it calculate only the daily average of the diff from the hi/lo? So if I am on an intraday chart, the formula will calculate from the daily chart and not the intraday chart I have open. It is a little confusing. Thanks for whatever help you can come up with.

        Jason
        I saw how to use the text.relativetoleft for text, but how can I return a calculation into the code. thanks

        Comment


        • #5
          ryanlangdon
          Starting from the top replace function hilodiff () with function hilodiff (interval) and study = sma (5, efsInternal ("hilodiff")); with study = sma (5, efsInternal ("hilodiff",inv("D")));. Then change return val; to return getSeries(study);
          Once you have implemented these modifications the average will be based on the difference between the High and Low of the daily bar.
          While modifying the script you may also want to remove the items inside the parenthesis of function main(K,Fast,Slow,Upper,Lower) as they are not required
          Alex

          Comment

          Working...
          X