Announcement

Collapse
No announcement yet.

Alex, quick fix needed

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

  • Alex, quick fix needed

    Alex,

    On the the ma1divma2.efs it is sometimes quite hard to tell when it has changed direction.

    Could it be made to turn "Lime" when it moves up and "Red" when it moves down? (or tell me how I would do that?)

    Thanks in advance.

    BTW it is a very nice trend indicator. I hope others take advantage of it. Nice work as always!

    John

  • #2
    Himalaya

    Post the file here and someone will take a look at it. A picture always helps too.

    Fibbgann
    Excellent book on JavaScript for beginners

    Comment


    • #3
      ma1divma2.efs

      /************************************************** *******
      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 vMA1 = null;
      var vMA2 = null;

      function preMain() {

      setPriceStudy(false);
      setStudyTitle("ma1divma2");
      setCursorLabelName("MA1/MA2", 0);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarFgColor(Color.yellow, 0);
      setDefaultBarThickness(1, 0);
      setPlotType(PLOTTYPE_LINE, 0);

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

      var fp2 = new FunctionParameter("MA1Offset", FunctionParameter.NUMBER);
      fp2.setDefault(0); //Edit this value to set a new default

      var fp3 = new FunctionParameter("MA1Source", FunctionParameter.STRING);
      fp3.setName("MA1Source");
      fp3.addOption("Close");
      fp3.addOption("High");
      fp3.addOption("Low");
      fp3.addOption("Open");
      fp3.addOption("HL/2");
      fp3.addOption("HLC/3");
      fp3.addOption("OHLC/4");
      fp3.setDefault("Close"); //Edit this value to set a new default

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

      var fp5 = new FunctionParameter("MA2Length", FunctionParameter.NUMBER);
      fp5.setLowerLimit(1);
      fp5.setDefault(10); //Edit this value to set a new default

      var fp6 = new FunctionParameter("MA2Offset", FunctionParameter.NUMBER);
      fp6.setDefault(0); //Edit this value to set a new default

      var fp7 = new FunctionParameter("MA2Source", FunctionParameter.STRING);
      fp7.setName("MA1Source");
      fp7.addOption("Close");
      fp7.addOption("High");
      fp7.addOption("Low");
      fp7.addOption("Open");
      fp7.addOption("HL/2");
      fp7.addOption("HLC/3");
      fp7.addOption("OHLC/4");
      fp7.setDefault("Close"); //Edit this value to set a new default

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

      }

      function main(MA1Length,MA1Offset,MA1Source,MA1Type,MA2Leng th,MA2Offset,MA2Source,MA2Type) {

      if (vMA1 == null) vMA1 = new MAStudy(MA1Length, MA1Offset, MA1Source, eval(MA1Type));
      if (vMA2 == null) vMA2 = new MAStudy(MA2Length, MA2Offset, MA2Source, eval(MA2Type));

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


      return vMA1.getValue(MAStudy.MA)/vMA2.getValue(MAStudy.MA);

      }

      Comment


      • #4
        Himalaya
        The attached efs should do what you asked
        Alex

        Attached Files

        Comment


        • #5
          Thanks Alex

          That's exactly what I was loooking for :-)

          Comment

          Working...
          X