Announcement

Collapse
No announcement yet.

2 Histograms

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

  • 2 Histograms

    Here is what i need.


    I think that the 2nd histogram is : first histogram (osc) minus 5 simple MA of the value of the first histogram.

    But i don't know how make this efs, likely as line and not as a histogram.

    Will youl help me please?

  • #2
    i've tried so, but there is something wrong.





    /************************************************** ***************
    Provided By : eSignal. (c) Copyright 2003
    ************************************************** ***************/


    function preMain() {
    setStudyTitle("MA Histograms");
    setCursorLabelName("Hist1", 0);
    setCursorLabelName("Hist2", 1);

    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);

    setPlotType(PLOTTYPE_HISTOGRAM, 0);
    setPlotType(PLOTTYPE_LINE, 1);

    setDefaultBarThickness(5, 0);
    setDefaultBarThickness(3, 1);
    }

    var MAstudy1 = new MAStudy(34, 0, "Close", MAStudy.SIMPLE);
    var MAstudy2 = new MAStudy(5, 0, "Close", MAStudy.SIMPLE);
    var aMA = new Array(5);
    var vHist1 = null;
    var vHist2 = null;

    function main() {
    var nState = getBarState();

    if (nState == BARSTATE_NEWBAR && vHist1 != null) {
    aMA.pop();
    aMA.unshift(vHist1);
    }

    var vMA1 = MAstudy1.getValue(MAStudy.MA);
    if (vMA1 == null) return;
    var vMA2 = MAstudy2.getValue(MAStudy.MA);
    if (vMA2 == null) return;
    vHist1 = (vMA2 - vMA1);

    vHist2 = ((vMA2 - vMA1) - (MAStudy(5, 0, (vMA2 - vMA1), MAStudy.SIMPLE)));


    return new Array(vHist1, vHist2);
    }


    help me!

    Comment

    Working...
    X