Announcement

Collapse
No announcement yet.

How to remove MACD Histogram from EFS2?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to remove MACD Histogram from EFS2?

    Hello

    I would like to have the ability to remove the histogram from EFS 2 custom study. Here is the code that I have altered but it seems that the histogram has a "blue outline" which I can not remove.

    Do I need to remove line 72 & 82 to only show the MACD and signal line without the histogram?

    Also I can not seem to alter the bar thickness. Can someone suggest what I can do to change the thickness of the lines?

    Any assistance would be greatly appreciated.

    Pogman

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

    var fpArray = new Array();

    function preMain() {

    setStudyTitle("MACD");
    setCursorLabelName("MACD",0);
    setCursorLabelName("MACDSig",1);

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

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

    setDefaultBarThickness(4,8);
    setDefaultBarThickness(4,3);

    askForInput();

    var x=0;
    fpArray[x] = new FunctionParameter("Fast", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setLowerLimit(1);
    setDefault(12);
    }
    fpArray[x] = new FunctionParameter("Slow", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setLowerLimit(1);
    setDefault(26);
    }
    fpArray[x] = new FunctionParameter("Smoothing", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setLowerLimit(1);
    setDefault(9);
    }
    fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
    with(fpArray[x++]){
    addOption("open");
    addOption("high");
    addOption("low");
    addOption("close");
    addOption("hl2");
    addOption("hlc3");
    addOption("ohlc4");
    setDefault("close");
    }
    fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
    with(fpArray[x++]){
    setDefault("");
    }
    fpArray[x] = new FunctionParameter("Interval", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setDefault("");
    }
    fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
    setName("Show Parameters");
    setDefault(false);
    }
    }

    var bInit = false;
    var xMACD = null;
    var xMACDSig = null;
    var xMACDHist = null;

    function main(Fast,Slow,Smoothing,Source,Symbol,Interval,Pa rams){

    if(bInit == false){
    if(Symbol == null) Symbol = getSymbol();
    if(Interval == null) Interval = getInterval();
    var vSymbol = Symbol+","+Interval;
    xMACD = macd(Fast,Slow,Smoothing,eval(Source)(sym(vSymbol) ));
    xMACDSig = macdSignal(Fast,Slow,Smoothing,eval(Source)(sym(vS ymbol)));
    xMACDHist = macdHist(Fast,Slow,Smoothing,eval(Source)(sym(vSym bol)));
    addBand(0,PS_SOLID,3,Color.black,"Centerline");
    setShowTitleParameters(eval(Params));
    bInit = true;
    }

    return new Array (getSeries(xMACD),getSeries(xMACDSig),getSeries(xM ACDHist));

    }

  • #2
    Pogman
    To remove the Histogram replace the return statement with
    return new Array (getSeries(xMACD),getSeries(xMACDSig));
    As to the thickness the first parameter in the setDefaultBarThickness(4,8); command controls the thickness of the plot while the second parameter is the series index in the return statement (always beginning from 0 for the first item). As an example see the two setDefaultBarFgColor(color,series index) in the same efs where the first parameter defines the color and the second represents the series index of the return statement.
    Alex

    PS. When posting code please follow the guidelines suggested in this post

    Comment


    • #3
      Hi Alex

      Excellent! Thanks for the expert advice. I finally got it to work for me by correcting the last line of code as you suggested.

      Pogman

      Comment


      • #4
        Hi,

        Is "getSeries" a valid function, because I did not find it listed in Help/Docs?

        Thank you,
        Mihai
        Mihai Buta

        Comment


        • #5
          Mihai
          It is a valid function and is listed in the updated Help file which is available here. You may want to join that group so as to receive notification when a new Help file is posted
          Alex

          Comment

          Working...
          X