Announcement

Collapse
No announcement yet.

coloring bars based on atrs

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

  • coloring bars based on atrs

    Linda Raschke uses a bar color study that is based on average true ranges. I have found it to be useful in tradestation. How would one go about creating the following in esignal.

    If a bar moves a certain amout of atrs of the lowest low the bar turns green and if it moves a certain amout of atrs off the high it turns red.

    I believe she uses 20 bars and 2.5 atrs. but this could obviously be adjusted to what a user likes. It is obviously very similar to a keltner channel but uses the past 20 lowest low or past 20 bars highest high as a reference instead of the moving average or centerline. I have tried the formula wizard and even cut and paste but I am not a programmer and it just seemed to be difficult for me.

    thanks for the help if anyone chosses to give this a shot

    john

  • #2
    var vATR14 = new ATRStudy(14);
    var vDonchian = new DonchianStudy(20, 0);
    var vLastAlert = -1;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("corona");
    setColorPriceBars(true);
    }

    function main() {
    setPriceBarColor(Color.blue);

    if (
    high() >= vDonchian.getValue(DonchianStudy.UPPER, -1)+2*vATR14.getValue(ATRStudy.ATR)
    ) onAction1();

    if (
    low() <= vDonchian.getValue(DonchianStudy.LOWER, -1)-2*vATR14.getValue(ATRStudy.ATR)
    ) onAction2();

    return null;
    }
    function onAction1() {
    setPriceBarColor(Color.red);
    vLastAlert = 1;
    }

    function onAction2() {
    setPriceBarColor(Color.lime);
    vLastAlert = 2;
    }

    Comment


    • #3
      thank you for the very fast response considering it is a weekend.

      I read through the code and I see it turns all my bar blue which is the intitial setting, A good trick I could have used in the past instead of having to change all my charts to a neutral color to get indicators to show up correctly. But they do not seem to chage to red or lime. Almost as if the return null is doing something or something in the code is not picking up the values created by the central part of the code. you see I do not even know coding nomenclature.

      Perhaps I transferred it incorrectly. But if not I belive this could be educational for other new coders like myself so I do not feel too selfish here.

      By the way I guess I followed you guys over from RQ and I think overall this is a much better product to actually trade with. Although I do miss the scanner (hint).

      thank you

      John

      Comment


      • #4
        Mine didnt change the bars to red or lime very often, but when the criteria were met, the bars changed.

        What time frame bars are you using and what symbol?
        Attached Files

        Comment


        • #5
          thanks perhaps I need to play with the parameters. I know in the study I am trying to duplicate the study usually changed if there was a quick move off a low to the otherside of a twenty ema. Sort of corresponded to a hard change in the slope of an macd. but I will work on it thanks for your time on this. By the way I just checked I it does change every once in a while so Iwill study this further thanks again.


          I used the study on all my time frames. Weekly down to one minutes.

          By the way if you are interested in the study you can see it on some of Linda's charts at lbrcapital.com under educational charts. She has stated the orange happens after a certain period of time when nothing happens and it is a limitation inher software. (I believe she said that but would not swear to it)

          Last edited by corone; 03-09-2003, 05:49 PM.

          Comment


          • #6
            see above
            Last edited by corone; 03-09-2003, 07:58 PM.

            Comment


            • #7
              David Loomis

              I am so fired up I can now dump tradestation. I got it to work. I had to switch the upper and the lower and I flipped the red and the green.

              Thank you very much for you help this weekend.

              Comment


              • #8
                Interesting code, van Tharp had the same idea using price volatility for a daily trailing stop. he suggested a multiplier between 2-3 of ATR. I really like all the different uses for the donchian channel. Check your ATR when there are gaps...I remember seeing a new ATR code that took care of an anomaly of that nature.

                chris...

                Comment


                • #9
                  final ATR code? download

                  can anyone provide the final finished code for the ATR color bars that Linda Rashke uses? I have read the previous dialoges and it seemes that loomis finally got what he was after but there is no final code published for downloading. I am hopeless with code writing.
                  Thanks,
                  Graham Davis

                  Comment


                  • #10
                    correction

                    my fault - I meant Corone finally got what he was after.

                    Comment


                    • #11
                      this may work

                      var vATR14 = new ATRStudy(9);
                      var vDonchian = new DonchianStudy(20, 0);
                      var vLastAlert = -1;

                      function preMain() {
                      setPriceStudy(true);
                      setStudyTitle("atr");
                      setColorPriceBars(true);
                      }

                      function main() {
                      setPriceBarColor(Color.yellow);

                      if (
                      high() >= vDonchian.getValue(DonchianStudy.LOWER, -1)+2.5*vATR14.getValue(ATRStudy.ATR)
                      ) onAction1();

                      if (
                      low() <= vDonchian.getValue(DonchianStudy.UPPER, -1)-2.5*vATR14.getValue(ATRStudy.ATR)
                      ) onAction2();

                      return null;
                      }
                      function onAction1() {
                      setPriceBarColor(Color.lime);
                      vLastAlert = 1;
                      }

                      function onAction2() {
                      setPriceBarColor(Color.red);
                      vLastAlert = 2;
                      }

                      Comment


                      • #12
                        much thanks

                        corone - I just wanted to say thanks very much for the code.
                        I just had the privelage of see Linda yeaterday in Chicago - at the traders Expo - she really is wonderfull. Thanks
                        PS - if youre in the live futeure room my nickname in there is "gdavi68" send me a private during the day if you see somthing. I have a number of people that I keep in constant dialoge with during the trading day via the LBR chatroom and we have great fun.
                        Sincerely,
                        Graham Davis

                        Comment


                        • #13
                          keltner

                          Anyone have a clue why the standard moving average of 20ema - - - and the basis line (which is a 20ema ) on the keltner channels arent exactly the same number ?
                          Attached Files

                          Comment


                          • #14
                            sgarbs
                            Try changing the Source for the 20ema to H+L+C/3
                            Alex

                            Comment

                            Working...
                            X