Announcement

Collapse
No announcement yet.

heikin-ashi bar help

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

  • heikin-ashi bar help

    Iam trying put the heikin-ashi bar study on my chart...When I put it on a new Advanced Default chart...it simply forms a color area on the existing bars...How do I get it to plot as a bar itself? It doesnt create its own subgraph...or change the bars itself...
    I am using the eSignal_HeikinAshi.efs. thank you

  • #2
    Re: heikin-ashi bar help

    I think this does the trick:

    PHP Code:

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

    Notes:
    * Non-price study
    * Draws most recent 200 bars
    * Formula Parameters 
        - Bullish Color     Default: Green
        - Bearish Color     Default: Red

    ****************************************/
    /*********************************
    TRO_Heikin-Ashi 20060728 PLOT Heikin-Ashi in its own pane

    Programmer:  Avery T. Horton, Jr.  aka *************

                     
    *****************************/
    function preMain() {
        
    setPriceStudy(false);
        
    setStudyTitle("TRO_HA");
        
    setCursorLabelName("HA-High"0);
        
    setCursorLabelName("HA-Low"1);
        
    setCursorLabelName("HA-Open"2);
        
    setCursorLabelName("HA-Close"3);
        
    setDefaultBarFgColor(Color.black0);
        
    setDefaultBarFgColor(Color.black1);
        
    setDefaultBarFgColor(Color.black2);
        
    setDefaultBarFgColor(Color.black3);
        
    setPlotType(PLOTTYPE_DOT0);
        
    setPlotType(PLOTTYPE_DOT1);
        
    setPlotType(PLOTTYPE_DOT2);
        
    setPlotType(PLOTTYPE_DOT3);
        
    setDefaultBarThickness(00);
        
    setDefaultBarThickness(01);
        
    setDefaultBarThickness(02);
        
    setDefaultBarThickness(03);

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

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

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


    askForInput();

    function 
    main(cBullcBear) {
        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 200iCntr 0;
        }

        if (
    haClose1 == null || haOpen1 == null) return;
        
        
    haOpen = (haOpen1 haClose1) / 2;
        
    haClose = (open() + high() + low() + close()) / 4;
        var 
    haHigh Math.max(high(), haOpenhaClose);
        var 
    haLow Math.min(low(), haOpenhaClose);
        
        
    //candlesticks
        
    var vColor Color.black;
        if (
    haClose haOpenvColor cBull;
        if (
    haClose haOpenvColor cBear;
        
    setBarFgColor(vColor2);
        
    setBarFgColor(vColor3);
        
        var 
    retArray = new Array(4);

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


        
    drawLineRelative(0retArray[0], 0retArray[1], PS_SOLID1Color.black"Shadow"+iCntr);
        
    drawLineRelative(0retArray[2], 0retArray[3], PS_SOLID9vColor"Body"+iCntr);

        return 
    retArray
    // End of Heikin-Ashi code 

    Originally posted by lorend
    Iam trying put the heikin-ashi bar study on my chart...When I put it on a new Advanced Default chart...it simply forms a color area on the existing bars...How do I get it to plot as a bar itself? It doesnt create its own subgraph...or change the bars itself...
    I am using the eSignal_HeikinAshi.efs. thank you
    Attached Files

    Comment

    Working...
    X