Announcement

Collapse
No announcement yet.

Heiken-Aishi Bars.

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

  • Heiken-Aishi Bars.

    How do I get Heiken Aishi Bars on my chart? I found the study in efs but it plots the bar in a separate pane. How can I get it to plot the heikin Ashi bars on my price pane itself? I would like to use HA bars rather than regular bars.
    Thank you.
    Last edited by Eric1704; 06-10-2007, 01:30 PM.

  • #2
    Hi Eric,
    Is the attached similar to what you are looking for?
    Diane
    Attached Files
    Last edited by Diane P; 06-10-2007, 02:28 PM.

    Comment


    • #3
      Thanks Diane. I tried that but it plots the HA bars besides the regular bars on the same pane. Is there way you can only have HA bars on pane rather than both types?
      Thank you.

      Comment


      • #4
        Eric,
        I minimize the chart bars & increase the size of the HA bars & it works well for me. Sorry it doesn't help you. You might try changing the color of the chart bars to match the background color of your chart & then apply the HA study.
        Diane

        Comment


        • #5
          Thank you.

          How do you minimize the bars Diane? I will try changing the colors on the chart too.
          Eric.

          Comment


          • #6
            Thanks Diane. I will try changing the colors. How do you change the size of your bars?
            Eric.

            Comment


            • #7
              Hi Eric,
              At the top of your chart screen, you should have an Advanced Chart ToolBar.You'll see a thick bar & a thin bar on that toolbar. If you click the thin bar, it will make your bars thinner thus smaller. Hope this helps.
              Diane
              Last edited by Diane P; 06-11-2007, 07:46 AM.

              Comment


              • #8
                OK, let's ask this another way.
                How do we modify the chart to display the bars using the Heikin-Ashi OHLC values and NOT over-wright the display? I don't want to resize my bars everytimg I resize or rescale my chart AND I want to be able to use OHLC bars OR candlesticks and have the display reflect the Heikin-Ashi values. I guess what I am asking for is a Heikin-Ashi modifite to the various "chart types". Is that possible in and EFS? Thanks in advance, Dennis

                Comment


                • #9
                  Hi Dennis,
                  To my knowledge, there is no "blank" price chart on which you could display only Heikin-Ashi bars. The chart types would display their indicated types, ie., a bar chart would display bars. A candlestick chart would display candlesticks, etc. I don't believe there is an efs that would do what you are asking.
                  Diane
                  Last edited by Diane P; 06-13-2007, 10:13 AM.

                  Comment


                  • #10
                    Diane,
                    Thanks for the reply. I really think this is a short coming of eSignal that would be easy to correct and/or implement. The calculation is quite simple and would not require a significant amount of CPU time. I think I'll send it in to the "development team" as an upgrade suggestion.
                    Dennis

                    Comment


                    • #11
                      Thank you Diane and Dennis. That is what I was trying to figure out. Just plot Heikin Ashi bars only on the chart. Sorry for the confusion.
                      Thank you.

                      Comment


                      • #12
                        Originally posted by Diane P
                        Hi Eric,
                        Is the attached similar to what you are looking for?
                        Diane
                        Hi Diane,

                        Thanks for posting the coding for Heiken Ashi bars. I noticed in the coding notes that it creates only the last 200 bars of HA bars, is there anyway to increase that number??

                        Thanks for your help.

                        -Kanirajan

                        Comment


                        • #13
                          Hi Kanirajan,
                          1) In the main, add "nLength" .(without the quotation marks).

                          2) At line 114 insert, if(nLength==null)nLength=300;(or whatever number you want). I haven't tried this, but hopefully it will help.
                          Diane

                          Comment


                          • #14
                            Hi Diane,

                            I'm not sure what you are referring to when you say the "main". I don't have much experience with coding on ESignal. Here is what I have:

                            /************************************************** ***************
                            Provided By : eSignal. (c) Copyright 2003
                            EFS Formula : Heikin-Ashi

                            Version 2.0

                            9/13/2004

                            Notes:
                            * Non-price study
                            * Draws most recent 200 bars
                            * Formula Parameters
                            - Bullish Color Default: Green
                            - Bearish Color Default: Red
                            - Smoothing Default: None [None, T3, KAMA]
                            * 2.0 Added T3 and KAMA smoothing options per
                            http://warrants.bnpparibas.com/de/doc/WZ_0804.pdf (page 16)

                            ************************************************** ***************/

                            function preMain() {
                            setStudyTitle("Heikin-Ashi 1 ");
                            setCursorLabelName("HA-High", 0);
                            setCursorLabelName("HA-Low", 1);
                            setCursorLabelName("HA-Open", 2);
                            setCursorLabelName("HA-Close", 3);
                            setDefaultBarFgColor(Color.black, 0);
                            setDefaultBarFgColor(Color.black, 1);
                            setDefaultBarFgColor(Color.black, 2);
                            setDefaultBarFgColor(Color.black, 3);
                            setPlotType(PLOTTYPE_DOT, 0);
                            setPlotType(PLOTTYPE_DOT, 1);
                            setPlotType(PLOTTYPE_DOT, 2);
                            setPlotType(PLOTTYPE_DOT, 3);
                            setDefaultBarThickness(0, 0);
                            setDefaultBarThickness(0, 1);
                            setDefaultBarThickness(3, 2);
                            setDefaultBarThickness(3, 3);
                            setPriceStudy(true);
                            setShowTitleParameters(false);


                            var fp1 = new FunctionParameter("cBull", FunctionParameter.COLOR);
                            fp1.setName("Bullish Candles");
                            fp1.setDefault(Color.blue);

                            var fp2 = new FunctionParameter("cBear", FunctionParameter.COLOR);
                            fp2.setName("Bearish Candles");
                            fp2.setDefault(Color.red);

                            var fp3 = new FunctionParameter("sSmooth", FunctionParameter.STRING);
                            fp3.setName("Smoothing");
                            fp3.addOption("None");
                            fp3.addOption("T3");
                            fp3.addOption("KAMA");
                            fp3.setDefault("T3");

                            var fp4 = new FunctionParameter("nT3Periods", FunctionParameter.NUMBER);
                            fp4.setName("T3 Periods");
                            fp4.setLowerLimit(1);
                            fp4.setDefault(3);

                            var fp5 = new FunctionParameter("vFactor", FunctionParameter.NUMBER);
                            fp5.setName("T3 V Factor");
                            fp5.setLowerLimit(0);
                            fp5.setDefault(0.5);

                            var fp6 = new FunctionParameter("nKAMAPeriods", FunctionParameter.NUMBER);
                            fp6.setName("KAMA Periods");
                            fp6.setLowerLimit(2);
                            fp6.setDefault(2);
                            }


                            var haClose = null;
                            var haOpen = null;
                            var haClose1 = null;
                            var haOpen1 = null;
                            var iCntr = 0;

                            // T3 vars
                            var b = null; // V Factor
                            var b2 = null;
                            var b3 = null;
                            var c1 = null;
                            var c2 = null;
                            var c3 = null;
                            var c4 = null;
                            var f1 = null;
                            var f2 = null;
                            var e1 = null;
                            var e2 = null;
                            var e3 = null;
                            var e4 = null;
                            var e5 = null;
                            var e6 = null;
                            var e1_1 = 0;
                            var e2_1 = 0;
                            var e3_1 = 0;
                            var e4_1 = 0;
                            var e5_1 = 0;
                            var e6_1 = 0;
                            var Price = null;
                            var bInit = false;

                            // KAMA vars
                            var nBarCounter = 0;
                            var aAMA = null;
                            var aFPArray = new Array();
                            var bInitialized = false;
                            var bPrimed = false;

                            function main(cBull, cBear, sSmooth, nT3Periods, vFactor, nKAMAPeriods) {
                            var nState = getBarState();

                            if (nState == BARSTATE_NEWBAR) {
                            if ((haClose == null || haOpen == null) && close(-1) != null) {
                            haClose = close(-1);
                            haOpen = open(-1);
                            }
                            haClose1 = haClose;
                            haOpen1 = haOpen;
                            iCntr += 1;
                            if (iCntr > 300) iCntr = 0;
                            }

                            if (haClose1 == null || haOpen1 == null) return;

                            haOpen = (haOpen1 + haClose1) / 2;
                            haClose = (open() + high() + low() + close()) / 4;
                            if (sSmooth == "T3") {
                            setStudyTitle("Heikin-Ashi 1");
                            haClose = T3Avg(nT3Periods, vFactor, haClose);
                            } else if (sSmooth == "KAMA") {
                            setStudyTitle("Heikin-Ashi w/ " + nKAMAPeriods + "-Period KAMA Smoothing ");
                            haClose = KAMA(nKAMAPeriods, haClose);
                            } else {
                            setStudyTitle("Heikin-Ashi 1 ");
                            }
                            if (haClose == null) return;
                            var haHigh = Math.max(high(), haOpen, haClose);
                            var haLow = Math.min(low(), haOpen, haClose);

                            //candlesticks
                            var vColor = Color.black;
                            if (haClose > haOpen) vColor = cBull;
                            if (haClose < haOpen) vColor = cBear;
                            setBarFgColor(vColor, 2);
                            setBarFgColor(vColor, 3);
                            drawLineRelative(0, haHigh, 0, haLow, PS_SOLID, 1, Color.lightgrey, "Shadow"+iCntr);
                            drawLineRelative(0, haOpen, 0, haClose, PS_SOLID, 3, vColor, "Body"+iCntr);

                            var retArray = new Array(4);
                            retArray[0] = haHigh.toFixed(2)*1;
                            retArray[1] = haLow.toFixed(2)*1;
                            retArray[2] = haOpen.toFixed(2)*1;
                            retArray[3] = haClose.toFixed(2)*1;

                            return retArray;
                            }

                            //*** T3 ****

                            function T3Avg(nPeriods, vFactor, vPrice) {

                            if (bInit == false) {
                            b = vFactor;
                            b2 = b * b;
                            b3 = b * b * b;
                            c1 = -b3;
                            c2 = 3 * b2 + 3 * b3;
                            c3 = -6 * b2 - 3 * b - 3 * b3;
                            c4 = 1 + 3 * b + b3 + 3 * b2;
                            f1 = 2 / (nPeriods + 1);
                            f2 = 1 - f1;
                            bInit = true;
                            }

                            if (getBarState() == BARSTATE_NEWBAR) {
                            e1_1 = e1;
                            e2_1 = e2;
                            e3_1 = e3;
                            e4_1 = e4;
                            e5_1 = e5;
                            e6_1 = e6;
                            }

                            e1 = f1 * vPrice + f2 * e1_1;
                            e2 = f1 * e1 + f2 * e2_1;
                            e3 = f1 * e2 + f2 * e3_1;
                            e4 = f1 * e3 + f2 * e4_1;
                            e5 = f1 * e4 + f2 * e5_1;
                            e6 = f1 * e5 + f2 * e6_1;

                            var T3Average = c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3;
                            return T3Average;
                            }
                            //*** END of T3 Functions ****


                            //*** KAMA ****

                            function KAMA(Period, vClose) {
                            var x;
                            var nNoise;
                            var nSignal;
                            var nSmooth;

                            if (bInitialized == false) {
                            Period = Math.round(Period);
                            aAMA = new Array(Period);
                            for ( x=0; x<Period; x++ ) {
                            aAMA[x] = 0.0;
                            }
                            bInitialized = true;
                            }

                            if ( getBarState() == BARSTATE_NEWBAR ) {
                            aAMA.pop();
                            aAMA.unshift(0);
                            nBarCounter++;
                            }

                            if (nBarCounter<Period) return null;


                            if (bPrimed == false) {
                            aAMA[0] = (open(0)+close(0)) / 2 + ( ( (close(0)-open(0)) / (high(0)-low(0)) ) * Math.abs( (close(0)-open(0)) / 2) );
                            bPrimed = true;
                            return aAMA[0];
                            } else {
                            aAMA[0] = vClose;
                            }

                            nSignal = Math.abs( close(0) - close(-Period) );

                            x=0;
                            nNoise = 0;
                            while(x<Period) {
                            nNoise += Math.abs( close(-x)-close(-(x+1)) );
                            x++;
                            }

                            nSmooth = Math.pow( ( nSignal/nNoise ) * ( 0.6667 - 0.0645 ) + 0.0645, 2 );

                            aAMA[0] = aAMA[1] + nSmooth * ( close(0) - aAMA[1] );

                            return aAMA[0];

                            }
                            //*** END of KAMA ****


                            Thanks for your help.

                            Kani

                            Comment


                            • #15
                              Hi kanirajan,
                              On line 112 you will see function main. After nKAMAPeriods, and before the close parenthesis, add nLength. Hope this helps.
                              Diane

                              Comment

                              Working...
                              X