Announcement

Collapse
No announcement yet.

SyntaxError: missing ; before statement (??)...

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

  • SyntaxError: missing ; before statement (??)...

    this code serves no purpose yet, but i can't figure out why i'm getting the error...



    preMain() {

    setStudyTitle("AID_PAIR_TRADER");
    setCursorLabelName("AID_PAIR_TRADER");

    }



    main(s1, s2) {
    var BOLLY = new BollingerStudy(20, "Close", 2);
    var UPPER = BOLLY.getValue(BollingerStudy.UPPER);
    var LOWER = BOLLY.getValue(BollingerStudy.LOWER);
    var BASIS = BOLLY.getValue(BollingerStudy.BASIS);

    if ((UPPER == null) || (LOWER == null) || (BASIS == null)) {

    return; }


    if (s1 == null) {

    s1 = "SPY";

    }

    if (s2 == null) {

    s2 = "QQQ";

    }





    return;

    }

  • #2
    asherisaac
    You are missing the word function before preMain() and main(s1,s2).
    Alex

    PHP Code:
    function preMain() {  

    setStudyTitle("AID_PAIR_TRADER");
    setCursorLabelName("AID_PAIR_TRADER");

    }



    function 
    main(s1s2) {
    var 
    BOLLY = new BollingerStudy(20"Close"2); 
    var 
    UPPER BOLLY.getValue(BollingerStudy.UPPER);
    var 
    LOWER BOLLY.getValue(BollingerStudy.LOWER);
    var 
    BASIS BOLLY.getValue(BollingerStudy.BASIS);

    if  ((
    UPPER == null) || (LOWER == null) || (BASIS == null)) {

                return; }


    if (
    s1 == null) {

         
    s1 "SPY";
         
         }

    if (
    s2 == null) {

         
    s2 "QQQ";
         
         }
       




    return;


    Comment


    • #3
      Hello asherisaac,

      I'd also recommend moving your code for initializing the Bollinger study outside of main. You only need to establish a study object once. Your formula will still work if you leave it inside main. However, it's a less efficient process.

      PHP Code:
      var BOLLY = new BollingerStudy(20"Close"2); 

      function 
      main(s1s2) {
      var 
      UPPER BOLLY.getValue(BollingerStudy.UPPER);
      var 
      LOWER BOLLY.getValue(BollingerStudy.LOWER);
      var 
      BASIS BOLLY.getValue(BollingerStudy.BASIS);

      if  ((
      UPPER == null) || (LOWER == null) || (BASIS == null)) {

                  return; } 
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment

      Working...
      X