Announcement

Collapse
No announcement yet.

ATR Channel?

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

  • ATR Channel?

    Hi,

    Tried using the search function but couldn't seem to find what I was looking for.

    Have no idea how to plot it with the EFS wizard... hope the EFS2 wizard will be more "hopeless coder" friendly.

    Wondering if such an EFS already exists...

    The channel is created using ATR with a user definable period.

    1. The top channel line is created by adding ATR to the each bar's low.

    2. The bottom channel line is created by subtracting ATR from each bar's high.

    Yes it's a pretty narrow channel but it's meant to act as a protective stop trailer for profitable trades or a potential reversal entry trailer. I think it's a great mechanism for entering trades myself when trading reversals but have manually calculated each bar's ATR point... hoping an EFS exists or someone can make one easily.
    Last edited by Anson; 03-22-2005, 02:10 AM.

  • #2
    Anson
    You can easily create this study using the builtinATR.efs that is in the Builtin folder.
    Add the following two lines just before the return statement
    var hiBand = low()+vATR.getValue(ATRStudy.ATR);
    var loBand = high()-vATR.getValue(ATRStudy.ATR);

    Then replace the return statement with return new Array (hiBand,loBand); and add a setPriceStudy(true); statement in preMain.
    Alex

    Comment


    • #3
      Thanks alot, Alex!


      One last question if you would be so kind.
      How do I make the labels as seen below appear as HighBand and LowBand etc?
      There's some way to set the name of the stuff as it appears on the Cursor Window right?

      Many thanks again.
      Anson

      Comment


      • #4
        Anson
        You are most welcome.
        To answer your question in preMain replace the existing setCursorLabelName("ATR", 0); with setCursorLabelName("HiBand", 0); and just below it add setCursorLabelName("LoBand", 1);
        That will create the appropriate labels in the Cursor Window
        Alex

        Comment


        • #5
          Muchos gracias!

          Comment


          • #6
            Anson
            Again you are most welcome.
            FWIW the same formula will be much easier to write in EFS2 as you can see in the enclosed script which includes a very basic example
            Alex


            PHP Code:
            function preMain() {
                
            setPriceStudy(true);
                
            setStudyTitle("ATR Channel");
                
            setCursorLabelName("HiBand"0);
                
            setCursorLabelName("LoBand"1);
                
            setDefaultBarFgColor(Color.blue0);
                
            setDefaultBarFgColor(Color.red1);
                    
                var 
            fp1 = new FunctionParameter("Length"FunctionParameter.NUMBER);
                
            fp1.setLowerLimit(1);        
                
            fp1.setDefault(14); 
            }

            function 
            main(Length){
                
                return new Array (
            low(0)+atr(Length,0),high(0)-atr(Length,0));

            Comment

            Working...
            X