Announcement

Collapse
No announcement yet.

mulitple trend EFS issues

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

  • mulitple trend EFS issues

    Having problems getting this to pass the first step of "red face" test upon uploading this to the EFS screener. I copied this, I think, word tick scratch and itch, from STocks Commodity magazine , Sept. Issue.

    However, it says I have issues with ";" 's in the first line of program?

    Also, the program automatically starts in January of 2008 and seems not to give any options for starting the lines at any other dates?

    I surmise that since Esignal hasn't listed this yet in the Stocks/Commodities library that they are also having issues getting this formulae to work?

    lost cause? Help? If the file is not readable please let me know and i will post the entire thing here via cut and paste.

    Thanks ahead of time.
    Attached Files

  • #2
    Re: mulitple trend EFS issues

    virgiliodi
    There are several errors in the script you posted. Attached is the same script with comments explaining these errors and suggesting how to correct them. Once you implement the suggested changes the formula should work fine
    Alex


    Originally posted by virgiliodi
    Having problems getting this to pass the first step of "red face" test upon uploading this to the EFS screener. I copied this, I think, word tick scratch and itch, from STocks Commodity magazine , Sept. Issue.

    However, it says I have issues with ";" 's in the first line of program?

    Also, the program automatically starts in January of 2008 and seems not to give any options for starting the lines at any other dates?

    I surmise that since Esignal hasn't listed this yet in the Stocks/Commodities library that they are also having issues getting this formulae to work?

    lost cause? Help? If the file is not readable please let me know and i will post the entire thing here via cut and paste.

    Thanks ahead of time.
    Attached Files

    Comment


    • #3
      still getting all sorts of check errors, i.e. line four error
      with " around MIDAS not registering. quotes around
      / on dates not registering, missing ; all over the place,
      and missing (

      when i made the changes , I think I made the changes suggested.

      thanks again, don't know why default is listed as January 2008, should be no default date as you want to pick the high or low point , which is different for each chart?

      thanks
      VID




      function preMain(){
      setPriceStudy(true);
      setStudyTitle("MIDAS");
      setCursorLabelName("MIDAS");
      setDefaultBarFgColor(Color.blue);
      setDefaultBarThickness(1);

      var fp1 = new FunctionParameter("StartDate",
      FunctionParameter.STRING);
      fp1.setName("Start Date (mm.dd.yyyy)");
      fp1.setDefault("1/2/2008");
      var fp2 = new FunctionParameter("StartTime",
      FunctionParameter.STRING);
      fp2.setName("Start Time hh:mm (use 00.00 if Daily)");
      fp2.setDefault("00:00");
      }

      var bVersion =null;
      var bInit = false;
      var xDay;
      var xMonth;
      var xYear;
      var xHour;
      var xMinute;
      var xMP= null;
      var xVolume = null;
      var Cumvol = 0;
      var CumVol_1=0;
      var CumPriceVol=0;
      var cumPriceVol_1=0;
      var CumVolAtStart=0;
      var CumPriceVolAtStart=0;
      var BarCounter=0;
      var Start=false;

      function main(StartDate,StartTime){
      if (bVersion==null) bVersion = verify();
      if (bVersion==false) return;
      if(bInit==false){
      var xStartDate = StartDate.split("/");
      var xStartTime = StartTime.split(":")
      xMonth = xStartDate[0];
      xDay = xStartDate[1];
      xYear = xStartDate[2];
      xHour = xStartTime[0];
      xMinute = xStartTime[1];
      xMP = hl2();
      xVolume = volume();
      bInit = true;
      }
      var nBarState = getBarState();
      if(nBarState==BARSTATE_NEWBAR){
      CumVol_1=CumVol;
      CumPriceVol_1=CumPriceVol;
      if(Start==true) BarCounter++;
      }
      var nVolume = xVolume.getValue(0);
      var nMP = xMP.getValue(0);
      if(nVolume==null || nMP==null) return;
      if(getCurrentBarCount()==1){
      CumVol = nVolume;
      CumPriceVol = nMP*nVolume;
      }else{
      CumVol = CumVol_1+nVolume;
      CumPriceVol = CumPriceVol_1+(nMP*nVolume);
      }
      if(Start==false && month(0)==xMonth && day(0)==xDay &&
      year(0)==xYear && hour(0)==xHour && minute(0)==xMinute) {
      CumVolAtStart = CumVol-nVolume;
      CumPriceVolAtStart = CumPriceVol-(nMP*nVolume);
      Barcounter=1;
      Start = true;
      }
      if(BarCounter==0){
      return;
      }else if(BarCounter==1){
      var MIDAS = nMP;
      }else if(BarCounter>1){
      var Denom = CumVol-CumVolAtStart;
      if(Denom==0) Denom = 1;
      var MIDAS = (CumPriceVol-CumPriceVolAtStart)/Denom
      }
      return MIDAS;
      }

      function verify() {
      var b = false;
      if (getBuildNumber()<779 {
      drawTextAbsolute(5,35,"This study requires version 8.0 or
      later.",
      Color.white,Color.blue,
      Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
      Null, 13, "error");
      DrawTextAbsolute(5,20,”Click HERE to
      Upgrade.@URL=http://www.esignal.com/download/default.asp”,
      Color.white, Color.blue,
      Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
      Null, 13, "upgrade");
      return b;
      } else {
      b = true;
      }
      return b;
      }

      Comment


      • #4
        VID
        Enclosed is your script with comments on the lines causing the errors and suggestions on how to fix them
        The default date is just so that the formula will return a plot when you load it in the chart. Through Edit Studies you can change the date at any time while the script is running
        Alex

        PHP Code:
        function preMain(){
           
        setPriceStudy(true);
           
        setStudyTitle("MIDAS");
           
        setCursorLabelName("MIDAS");
           
        setDefaultBarFgColor(Color.blue);
           
        setDefaultBarThickness(1);

                      var    
        fp1    =   new   FunctionParameter("StartDate",
        FunctionParameter.STRING);
                
        fp1.setName("Start Date (mm.dd.yyyy)");
                
        fp1.setDefault("1/2/2008");
                      var 
        fp2       =   new   FunctionParameter("StartTime",
        FunctionParameter.STRING);
                
        fp2.setName("Start Time hh:mm (use 00.00 if Daily)");
                
        fp2.setDefault("00:00");
        }

        var 
        bVersion    =null;
        var 
        bInit false;
        var 
        xDay;
        var 
        xMonth;
        var 
        xYear;
        var 
        xHour;
        var 
        xMinute;
        var 
        xMPnull;
        var 
        xVolume null;
        var 
        Cumvol 0;
        var 
        CumVol_1=0;
        var 
        CumPriceVol=0;
        var 
        cumPriceVol_1=0;
        var 
        CumVolAtStart=0;
        var 
        CumPriceVolAtStart=0;
        var 
        BarCounter=0;
        var 
        Start=false;

        function 
        main(StartDate,StartTime){
            if (
        bVersion==nullbVersion verify();
            if (
        bVersion==false) return;
            if(
        bInit==false){
                  var 
        xStartDate StartDate.split("/");
                  var 
        xStartTime StartTime.split(":")
                 
        xMonth xStartDate[0];
                 
        xDay xStartDate[1];
                 
        xYear xStartDate[2];
                 
        xHour xStartTime[0];
                 
        xMinute xStartTime[1];
                 
        xMP hl2();
                 
        xVolume volume();
                 
        bInit true;
        }
         var 
        nBarState getBarState();
         if(
        nBarState==BARSTATE_NEWBAR){
              
        CumVol_1=CumVol;
              
        CumPriceVol_1=CumPriceVol;
              if(
        Start==trueBarCounter++;
        }
         var 
        nVolume xVolume.getValue(0);
         var 
        nMP xMP.getValue(0);
         if(
        nVolume==null  ||  nMP==null) return;
         if(
        getCurrentBarCount()==1){
            
        CumVol nVolume;
            
        CumPriceVol nMP*nVolume;
           }else{
             
        CumVol CumVol_1+nVolume;
             
        CumPriceVol CumPriceVol_1+(nMP*nVolume);
         }
          if(
        Start==false && month(0)==xMonth && day(0)==xDay &&
        year(0)==xYear && hour(0)==xHour && minute(0)==xMinute) {
            
        CumVolAtStart CumVol-nVolume;
            
        CumPriceVolAtStart CumPriceVol-(nMP*nVolume);
             
        Barcounter=1;
             
        Start true;
         }
          if(
        BarCounter==0){
             return;
         }else if(
        BarCounter==1){
             var 
        MIDAS nMP;
         }else if(
        BarCounter>1){
             var 
        Denom CumVol-CumVolAtStart;
             if(
        Denom==0Denom 1;
             var 
        MIDAS = (CumPriceVol-CumPriceVolAtStart)/Denom
         
        }
           return 
        MIDAS;
        }

         function 
        verify() {
              var 
        false;
            if (
        getBuildNumber()<779 {//missing close parenthesis ie if (getBuildNumber()<779) {
                
        drawTextAbsolute(5,35,"This study requires version 8.0 or later."Color.white,Color.blue,
                                  
        Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                                  
        Null13"error");
                
        DrawTextAbsolute(5,20,//this should be drawTextAbsolute and not DrawTextAbsolute
                                
        "Click HERE to Upgrade.@URL=http://www.esignal.com/download/default.asp",
                                 
        Color.whiteColor.blue,
                                 
        Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                                 
        Null13"upgrade");
                return 
        b;
            } else {
                
        true;
            }
              return 
        b;

        Originally posted by virgiliodi
        still getting all sorts of check errors, i.e. line four error
        with " around MIDAS not registering. quotes around
        / on dates not registering, missing ; all over the place,
        and missing (

        when i made the changes , I think I made the changes suggested.

        thanks again, don't know why default is listed as January 2008, should be no default date as you want to pick the high or low point , which is different for each chart?

        thanks
        VID




        function preMain(){
        setPriceStudy(true);
        setStudyTitle("MIDAS");
        setCursorLabelName("MIDAS");
        setDefaultBarFgColor(Color.blue);
        setDefaultBarThickness(1);

        var fp1 = new FunctionParameter("StartDate",
        FunctionParameter.STRING);
        fp1.setName("Start Date (mm.dd.yyyy)");
        fp1.setDefault("1/2/2008");
        var fp2 = new FunctionParameter("StartTime",
        FunctionParameter.STRING);
        fp2.setName("Start Time hh:mm (use 00.00 if Daily)");
        fp2.setDefault("00:00");
        }

        var bVersion =null;
        var bInit = false;
        var xDay;
        var xMonth;
        var xYear;
        var xHour;
        var xMinute;
        var xMP= null;
        var xVolume = null;
        var Cumvol = 0;
        var CumVol_1=0;
        var CumPriceVol=0;
        var cumPriceVol_1=0;
        var CumVolAtStart=0;
        var CumPriceVolAtStart=0;
        var BarCounter=0;
        var Start=false;

        function main(StartDate,StartTime){
        if (bVersion==null) bVersion = verify();
        if (bVersion==false) return;
        if(bInit==false){
        var xStartDate = StartDate.split("/");
        var xStartTime = StartTime.split(":")
        xMonth = xStartDate[0];
        xDay = xStartDate[1];
        xYear = xStartDate[2];
        xHour = xStartTime[0];
        xMinute = xStartTime[1];
        xMP = hl2();
        xVolume = volume();
        bInit = true;
        }
        var nBarState = getBarState();
        if(nBarState==BARSTATE_NEWBAR){
        CumVol_1=CumVol;
        CumPriceVol_1=CumPriceVol;
        if(Start==true) BarCounter++;
        }
        var nVolume = xVolume.getValue(0);
        var nMP = xMP.getValue(0);
        if(nVolume==null || nMP==null) return;
        if(getCurrentBarCount()==1){
        CumVol = nVolume;
        CumPriceVol = nMP*nVolume;
        }else{
        CumVol = CumVol_1+nVolume;
        CumPriceVol = CumPriceVol_1+(nMP*nVolume);
        }
        if(Start==false && month(0)==xMonth && day(0)==xDay &&
        year(0)==xYear && hour(0)==xHour && minute(0)==xMinute) {
        CumVolAtStart = CumVol-nVolume;
        CumPriceVolAtStart = CumPriceVol-(nMP*nVolume);
        Barcounter=1;
        Start = true;
        }
        if(BarCounter==0){
        return;
        }else if(BarCounter==1){
        var MIDAS = nMP;
        }else if(BarCounter>1){
        var Denom = CumVol-CumVolAtStart;
        if(Denom==0) Denom = 1;
        var MIDAS = (CumPriceVol-CumPriceVolAtStart)/Denom
        }
        return MIDAS;
        }

        function verify() {
        var b = false;
        if (getBuildNumber()<779 {
        drawTextAbsolute(5,35,"This study requires version 8.0 or
        later.",
        Color.white,Color.blue,
        Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
        Null, 13, "error");
        DrawTextAbsolute(5,20,”Click HERE to
        Upgrade.@URL=http://www.esignal.com/download/default.asp”,
        Color.white, Color.blue,
        Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOL D|Text.LEFT,
        Null, 13, "upgrade");
        return b;
        } else {
        b = true;
        }
        return b;
        }

        Comment

        Working...
        X