Announcement

Collapse
No announcement yet.

Can't displapy HH and LL

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

  • Can't displapy HH and LL

    My code cannot display both the HH and LL at the same time.

    If I leave both the

    seriesHH=highest(252,high());
    return seriesHH;

    seriesLL=lowest(252,low());
    return seriesLL;

    statements in the code, it only displays the seriesHH.

    If I comment out the seriesHH part (both lines), it only displays the seriesLL.

    How do I get the code to display both?

    It is frustrating being so miserably new to this.

    Thanks, Perry



    Here is the failing code:

    var seriesHH=0;
    var seriesLL=0;

    function preMain() {
    setStudyTitle("MMD252dH&L");
    setCursorLabelName("MMD252dH&L",0);

    setDefaultBarFgColor(Color.black,0);
    setDefaultBarFgColor(Color.black,1);

    setPriceStudy(true);
    setPlotType( PLOTTYPE_LINE, 0 );
    setPlotType( PLOTTYPE_LINE, 1 );
    }

    function main() {
    seriesHH=highest(252,high());
    return seriesHH;

    seriesLL=lowest(252,low());
    return seriesLL;

    }

  • #2
    Re: Can't displapy HH and LL

    Perry
    To return multiple items to a chart you need to use an array in your return statement eg
    return new Array (item1, item2, etc);
    So in your case you would write the script as shown below
    If - as you seem to indicate - you are unfamiliar with programming in efs and are interested in learning more then you may want to start by reviewing the JavaScript for EFS video series and the Core JavaScript Reference Guide. Those will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and review the Help Guides and Tutorials which will provide you with the specifics of EFS. As you are learning also search the forums where you will find literally thousands between scripts and/or examples that you can use
    Also FWIW in the EFS2 Custom subfolder of the Formula folder [in your eSignal directory] you already have a formula ie customDonchian.efs which essentially does what you are trying to accomplish. Furthermore that formula is enabled for use with external intervals or symbols [ie intervals or symbols that are different from the one being charted] which means, for example, that you could plot it on a daily chart and calculate the 52 week high by using the weekly interval in the efs
    Alex

    PHP Code:
    var seriesHH=0;
    var 
    seriesLL=0;

    function 
    preMain() {
        
    setStudyTitle("MMD252dH&L");
        
    setCursorLabelName("MMD252dH&L",0);

        
    setDefaultBarFgColor(Color.black,0);
        
    setDefaultBarFgColor(Color.black,1);

        
    setPriceStudy(true);
        
    setPlotTypePLOTTYPE_LINE); 
        
    setPlotTypePLOTTYPE_LINE); 
    }

    function 
    main() {
        
    seriesHH=highest(252,high()); 
        
    seriesLL=lowest(252,low()); 
        return new Array (
    seriesHHseriesLL); 


    Originally posted by perrydolia
    My code cannot display both the HH and LL at the same time.

    If I leave both the

    seriesHH=highest(252,high());
    return seriesHH;

    seriesLL=lowest(252,low());
    return seriesLL;

    statements in the code, it only displays the seriesHH.

    If I comment out the seriesHH part (both lines), it only displays the seriesLL.

    How do I get the code to display both?

    It is frustrating being so miserably new to this.

    Thanks, Perry



    Here is the failing code:

    var seriesHH=0;
    var seriesLL=0;

    function preMain() {
    setStudyTitle("MMD252dH&L");
    setCursorLabelName("MMD252dH&L",0);

    setDefaultBarFgColor(Color.black,0);
    setDefaultBarFgColor(Color.black,1);

    setPriceStudy(true);
    setPlotType( PLOTTYPE_LINE, 0 );
    setPlotType( PLOTTYPE_LINE, 1 );
    }

    function main() {
    seriesHH=highest(252,high());
    return seriesHH;

    seriesLL=lowest(252,low());
    return seriesLL;

    }

    Comment


    • #3
      Thank You for the Help

      Alexis,

      Using the

      return Array()

      solved the problem of plotting two indicators on the chart, as I am sure you already knew.

      Thank you for that help, and thank you for the various links to EFS for beginners.

      I am not new to programming, but new to EFS and Java Script. I continue to work my way through the JS reference information, but you can't blame a guy for trying to create a few simple indicators for practice.

      Reading the intro material is a slog, and I do not find the EFS help information to be very well indexed. But, I will perservere. Please expect further bonehead questions.

      Thanks again for your assistance.

      PD

      Comment


      • #4
        Re: Thank You for the Help

        Perry
        You are welcome
        Alex


        Originally posted by perrydolia
        Alexis,

        Using the

        return Array()

        solved the problem of plotting two indicators on the chart, as I am sure you already knew.

        Thank you for that help, and thank you for the various links to EFS for beginners.

        I am not new to programming, but new to EFS and Java Script. I continue to work my way through the JS reference information, but you can't blame a guy for trying to create a few simple indicators for practice.

        Reading the intro material is a slog, and I do not find the EFS help information to be very well indexed. But, I will perservere. Please expect further bonehead questions.

        Thanks again for your assistance.

        PD

        Comment

        Working...
        X