Announcement

Collapse
No announcement yet.

1st code without the Wizard

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

  • 1st code without the Wizard

    Hello,
    This is a code that Alexis wrote for the less code writer proficient . And find it very useful and opens a whole new door for me.


    What line of code do I need to add so that this will update in real-time and what line of code do I need to add so that it can be scaled to the price.

    I think I need to replace line 115 with something else. I tried several from the KB but always get errors. I have no idea how to scale it to price. Just changing it to a price study doesn't work either.

    Thanks for any and all help,

    Russ
    Attached Files

  • #2
    Russ
    From your code it is not clear what you are trying to do.
    As is you are calculating the difference between the current value of atr(30) and the value of atr(10) offset backwards by one period. This means that on the current bar the value of atr(10) is null and you are effectively subtracting 0 from atr(30). This is what is causing the spike in the plot on the current bar
    If instead you are trying to calculate the difference between the current value of atr(30) and the prior value of atr(10) then you need to replace atr(10,1) with atr(10,-1)
    Not sure what you mean with "scale it to price". Anyhow you can overlay the indicator on the price chart by clicking and dragging the indicator window while pressing the Shift key
    Alex

    Comment


    • #3
      Alex,
      The change from +1 to -1 fixed the update problem.

      What I mean by scaled to the price. I would like to add the difference in ATR to the High of the price bar. Really what I am tried to end up with is channel based on the ATR difference according to the high and low of the current bar.

      Just now thinking some more about this, where and what would you add to offset it, say like one bar forward?

      If I knew these things I could be well on my way.

      At the same time understand how to do it for future use. This template that you created is great for doing that.

      Thanks,
      Russ

      Comment


      • #4
        Russ

        I would like to add the difference in ATR to the High of the price bar
        In that case change the setPriceStudy() statement in preMain to true and in the return statement simply add
        high(0)+ATR_Diff

        where and what would you add to offset it, say like one bar forward?
        That is what the bar index of -1 in atr(10,-1) does. Apply it also to atr(30)

        If I knew these things I could be well on my way.
        To learn how to program in EFS you may want to first review the JavaScript Video Series that will introduce you to the JavaScript language, which is the basis for EFS. Then to learn the specifics of formula development you will want to review the EFS Help Guides and Tutorials.
        Alex

        Comment


        • #5
          Alex,
          I works like a champ.
          I will check out the links you posted
          Thanks,
          Russ
          Attached Files

          Comment

          Working...
          X