Announcement

Collapse
No announcement yet.

Problem with sym() inv()

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

  • Problem with sym() inv()

    I don't understand why the following code hangs with:
    "Loading Data..."

    Am I using this incorrectly somehow?

    if ( bInit == false ) {

    myStudy3 = macdHist( 12, 26, 9 , sym("$SPX")|inv("1"),0);

    bInit = true;

    }

    myVar3 = myStudy3.getValue(0);

  • #2
    Re: Problem with sym() inv()

    Simone
    The syntax is incorrect and should be
    myStudy3 = macdHist( 12, 26, 9 , sym("$SPX, 1"));
    For a complete set of examples on how to use the sym() and inv() functions see this thread
    Alex


    Originally posted by SimWein
    I don't understand why the following code hangs with:
    "Loading Data..."

    Am I using this incorrectly somehow?

    if ( bInit == false ) {

    myStudy3 = macdHist( 12, 26, 9 , sym("$SPX")|inv("1"),0);

    bInit = true;

    }

    myVar3 = myStudy3.getValue(0);

    Comment


    • #3
      thanks heaps Alex,
      that is working fine now...

      but I seem to be having a different problem now...

      I am using myVar3 to display the cash SPX on an ES price pane... but by watching a graph of SPX and watching the text field update in my ES price pane I can see that they are no in step and don't often match.

      I thought that everytime there is a new tick in the ES pane that this line:

      myVar3 = myStudy3.getValue(0);

      would execute and so the cash SPX display in my ES pane would be updated every tick... is there a reason for the discrepency or is it something I am doing wrong...?

      Comment


      • #4
        Simone
        I ran a few tests using several scripts that call external symbols and as far as I can see at my end they appear to be returning the corrects values. As an example see the enclosed animation where I used a very baisc script (also enclosed)
        You may want to post the script that you are using and provide details as to how your chart is set up so that someone can try to replicate the issue you are seeing
        Alex

        PHP Code:
        function main(){
            return 
        close(0sym("$spx"));




        Originally posted by SimWein
        thanks heaps Alex,
        that is working fine now...

        but I seem to be having a different problem now...

        I am using myVar3 to display the cash SPX on an ES price pane... but by watching a graph of SPX and watching the text field update in my ES price pane I can see that they are no in step and don't often match.

        I thought that everytime there is a new tick in the ES pane that this line:

        myVar3 = myStudy3.getValue(0);

        would execute and so the cash SPX display in my ES pane would be updated every tick... is there a reason for the discrepency or is it something I am doing wrong...?

        Comment


        • #5
          Hi Alex,
          could you please try your test with the following changes to replicate my setup:

          Set the ES graph to a TICK interval, but leave SPX reference minute interval.

          Do use the cursor window display but use a "drawText" command to display SPX in actual ES price pane.

          I have been watching it all day today and it definitely sometimes hangs with an old close value?? [But mist of the time is fine... strange?]

          Thanks for your help,
          Simone.

          Comment


          • #6
            Simone
            In the tests I have been running the values returned by the scripts I have been using (an example is enclosed) appear to be in sync as you can see in the enclosed animation
            Alex

            PHP Code:
            function preMain(){
                
            setPriceStudy(true)
            }

            function 
            main(){
                var 
            extSym close(0,sym("$spx,1"));
                if(
            extSym==null) return;
                
            drawTextRelative(0,0,extSym.toFixed(2),Color.blue,null,Text.RIGHT|Text.RELATIVETOBOTTOM,
                                
            "Arial",12,"text2");




            Originally posted by SimWein
            Hi Alex,
            could you please try your test with the following changes to replicate my setup:

            Set the ES graph to a TICK interval, but leave SPX reference minute interval.

            Do use the cursor window display but use a "drawText" command to display SPX in actual ES price pane.

            I have been watching it all day today and it definitely sometimes hangs with an old close value?? [But mist of the time is fine... strange?]

            Thanks for your help,
            Simone.

            Comment


            • #7
              Alex,

              thanks for your input.
              I have the exact script you posted running with $TICK and get some weird lag between the screen display and a separate chart display sometimes...

              Could you please try TICK and check against an external (separate chart to track the values) please?

              Unexplainable?

              Thanks anyway...

              Simone

              Comment


              • #8
                attached image
                Attached Files

                Comment


                • #9
                  this shows the failure (after an ES tick occurs of course)
                  Attached Files

                  Comment


                  • #10
                    Alex please see my attachments below for proof of my issue

                    Comment


                    • #11
                      Simone
                      I just ran a test using $TICK as the main symbol and $SPX as the external symbol and as you can see in the enclosed animation the values appear to be in sync
                      Alex




                      Originally posted by SimWein
                      Alex,

                      thanks for your input.
                      I have the exact script you posted running with $TICK and get some weird lag between the screen display and a separate chart display sometimes...

                      Could you please try TICK and check against an external (separate chart to track the values) please?

                      Unexplainable?

                      Thanks anyway...

                      Simone

                      Comment


                      • #12
                        Simone
                        Enclosed is another animation captured using ES M8 as the main symbol and $TICK as the external symbol and again the values appear to be in sync at my end
                        Alex

                        Comment

                        Working...
                        X