Announcement

Collapse
No announcement yet.

Changing code in Efs

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

  • Changing code in Efs

    Hello,

    Alexis or anyone else who can help me remove the moving average numbers from the EMA50day volume script. I find them bothersome because they prevent me from seeing the volume for current bar on 5min chart. It would be great if in was fixed in a certain spot or removed completely.

    Can this be done?



    Thanks,
    Brian

    /************************************************** *******
    Alexis C. Montenegro © July 2003
    Use and/or modify this code freely. If you redistribute it
    please include this and/or any other comment blocks and a
    description of any changes you make.
    ************************************************** ********/

    var vMA = null;

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("Volume-MA");
    setCursorLabelName("Volume", 0);
    setCursorLabelName("MAofVol", 1);
    setCursorLabelName("%ofMA", 2);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.black, 1);
    setDefaultBarFgColor(Color.black, 2);
    setDefaultBarThickness(5,0);
    setDefaultBarThickness(2,1);
    setDefaultBarThickness(1,2);
    setPlotType(PLOTTYPE_HISTOGRAM,0);


    var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
    fp1.setLowerLimit(1);
    fp1.setDefault(50); //Edit this value to set a new default

    var fp2 = new FunctionParameter("Type", FunctionParameter.STRING);
    fp2.setName("Type");
    fp2.addOption("MAStudy.SIMPLE");
    fp2.addOption("MAStudy.EXPONENTIAL");
    fp2.setDefault("MAStudy.EXPONENTIAL"); //Edit this value to set a new default

    var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
    fp3.addOption("Price");
    fp3.addOption("Volume");
    fp3.setDefault("Price"); //Edit this value to set a new default

    }

    function main(Length,Type,Source) {

    if (vMA == null) vMA = new MAStudy(Length, 0, "Volume", eval(Type));

    /*****************************************
    Insert your code following this text block
    Use vMA.getValue(MAStudy.MA) for your code
    ******************************************/

    if(Source=="Price"){
    if (close() < close(-1))
    setBarFgColor(Color.RGB(255,0,0));
    else if (close() > close(-1))
    setBarFgColor(Color.RGB(0,0,255));
    else if (close() == close(-1))
    setBarFgColor(Color.RGB(0,0,0));
    }
    if(Source=="Volume"){
    if (volume() < volume(-1))
    setBarFgColor(Color.RGB(255,0,0));
    else if (volume() > volume(-1))
    setBarFgColor(Color.RGB(0,0,255));
    else if (volume() == volume(-1))
    setBarFgColor(Color.RGB(0,0,0));
    }

    var PercVol = (volume()/vMA.getValue(MAStudy.MA))*100;
    if (PercVol<100)
    setBarFgColor(Color.brown,2);
    if(PercVol>100)
    setBarFgColor(Color.blue,2);


    return new Array (volume(),vMA.getValue(MAStudy.MA),PercVol.toFixed (2)+"");
    }
    Last edited by Co|dStee|; 03-25-2004, 03:47 PM.

  • #2
    Brian
    I don't think you can remove (or move) them.
    What you can do though is reverse the order of the elements in the return array so that the Volume ends up on top. You will also need to reverse some of the statements in preMain.
    Alex

    Comment


    • #3
      Ok thanks Alexis I'll give it a shot.

      Comment


      • #4
        Alexis,

        I tried and failed. I dont no where to start in the return new array section.

        return new Array (volume(),vMA.getValue(MAStudy.MA),PercVol.toFixed (2)+"");

        I tried changing it to this

        return new Array (vMA.getValue(MAStudy.MA),PercVol.toFixed(2)+"",vo lume());

        and the outcome wasnt pretty.

        I'm totally lost and need your help.

        Comment


        • #5
          Brian
          Here enclosed is the revised code
          Alex


          PHP Code:
          /*********************************************************
          Alexis C. Montenegro © July 2003 
          Use and/or modify this code freely. If you redistribute it
          please include this and/or any other comment blocks and a 
          description of any changes you make. 
          **********************************************************/

          var vMA null;

          function 
          preMain() {
          setPriceStudy(false);
          setStudyTitle("Volume-MA");
          setCursorLabelName("MAofVol"0);
          setCursorLabelName("%ofMA"1);
          setCursorLabelName("Volume"2);
          setDefaultBarFgColor(Color.black0);
          setDefaultBarFgColor(Color.black1);
          setDefaultBarFgColor(Color.blue2); 
          setDefaultBarThickness(2,0);
          setDefaultBarThickness(1,1);
          setDefaultBarThickness(5,2);
          setPlotType(PLOTTYPE_HISTOGRAM,2);


          var 
          fp1 = new FunctionParameter("Length"FunctionParameter.NUMBER);
          fp1.setLowerLimit(1); 
          fp1.setDefault(50); //Edit this value to set a new default

          var fp2 = new FunctionParameter("Type"FunctionParameter.STRING);
          fp2.setName("Type");
          fp2.addOption("MAStudy.SIMPLE");
          fp2.addOption("MAStudy.EXPONENTIAL");
          fp2.setDefault("MAStudy.EXPONENTIAL"); //Edit this value to set a new default

          var fp3 = new FunctionParameter("Source"FunctionParameter.STRING);
          fp3.addOption("Price"); 
          fp3.addOption("Volume");
          fp3.setDefault("Price"); //Edit this value to set a new default

          }

          function 
          main(Length,Type,Source) {

          if (
          vMA == nullvMA = new MAStudy(Length0"Volume", eval(Type));

          /*****************************************
          Insert your code following this text block
          Use vMA.getValue(MAStudy.MA) for your code
          ******************************************/

          if(Source=="Price"){
          if (
          close() < close(-1))
          setBarFgColor(Color.RGB(255,0,0),2);
          else if (
          close() > close(-1))
          setBarFgColor(Color.RGB(0,0,255),2);
          else if (
          close() == close(-1))
          setBarFgColor(Color.RGB(0,0,0),2); 
          }
          if(
          Source=="Volume"){
          if (
          volume() < volume(-1))
          setBarFgColor(Color.RGB(255,0,0),2);
          else if (
          volume() > volume(-1))
          setBarFgColor(Color.RGB(0,0,255),2);
          else if (
          volume() == volume(-1))
          setBarFgColor(Color.RGB(0,0,0),2);


          var 
          PercVol = (volume()/vMA.getValue(MAStudy.MA))*100;
          if (
          PercVol<100)
          setBarFgColor(Color.brown,1);
          if(
          PercVol>100)
          setBarFgColor(Color.blue,1);


          return new Array (
          vMA.getValue(MAStudy.MA),PercVol.toFixed(2)+"",volume());

          Comment


          • #6
            Alexis thanks agian your the best it works perfect.

            Comment

            Working...
            X