Announcement

Collapse
No announcement yet.

getValue bug?

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

  • getValue bug?

    something wierd happening here in the UK 8am ...

    Code:
    function main() {
    
        if (!bInitialized) {
            var nLength = 10;
            var sSI = getSymbol() + ",60";
            var aClose = getValue("close", 0, -nLength, sSI);
            var len = 0; //aClose.length();
            debugPrintln(len);
            bInitialized = true;
        }
    
        return null;
    }
    nLength = 0
    len = 0
    works ok
    Attached Files
    Paul Williams
    Strategy & Applications
    www.futurenets.co.uk

  • #2
    but

    nLength = 10;
    len = aClose.length();

    produces no debug output
    Attached Files
    Paul Williams
    Strategy & Applications
    www.futurenets.co.uk

    Comment


    • #3
      and

      nLength = 300;
      len = 0;

      produces no debug output (but this sometimes resolves itself later in the day)
      Attached Files
      Paul Williams
      Strategy & Applications
      www.futurenets.co.uk

      Comment


      • #4
        problems below exist on ES #F

        but e.g. $VIX is ok
        Paul Williams
        Strategy & Applications
        www.futurenets.co.uk

        Comment


        • #5
          Paul
          FWIW both examples posted by you seem to be working at my end as you can see in the enclosed animations
          Alex






          Originally posted by futurenets
          but

          nLength = 10;
          len = aClose.length();

          produces no debug output
          Originally posted by futurenets
          and

          nLength = 300;
          len = 0;

          produces no debug output (but this sometimes resolves itself later in the day)
          Originally posted by futurenets
          problems below exist on ES #F

          but e.g. $VIX is ok

          Comment


          • #6
            ok Alexis but this is like trying to hit a moving target!

            last week a colleage in the US couldn't get it to work and neither could I.

            Just tried it now (as you have done) and it works.

            However just tried this ..

            Code:
            function main() {
            
                if (!bInitialized) {
                    var nLength = 300;
                    var sSI = getSymbol() + ",60";
                    //var aClose = getValue("close", 0, -nLength, sSI);
                    var aClose = getValue("close", -nLength, nLength, sSI);
                    var len = 0; //aClose.length();
                    debugPrintln(len);
                    bInitialized = true;
                }
            
            	return null;
            }
            and it doesn't work i.e. no debug output is produced.

            this is out of my control, any chance you could get to the bottom of this.

            if we assume there isn't a problem, it will just reoccur.
            Paul Williams
            Strategy & Applications
            www.futurenets.co.uk

            Comment


            • #7
              also

              var len = aClose.length();

              produces no debug output.
              Paul Williams
              Strategy & Applications
              www.futurenets.co.uk

              Comment


              • #8
                Hi,

                I don't know if this is of any use but changing the minus sign for the -nLength- variable in the "getValue(..." statement produces output on an "ES #F" daily chart that loads 300 bars. Both of the next statements output the zero:
                PHP Code:
                var aClose getValue("close"nLength, -nLengthsSI);
                var 
                aClose getValue("close"nLengthnLengthsSI); 
                Yet the statement in your example doesn't output at all:
                PHP Code:
                var aClose getValue("close", -nLengthnLengthsSI); 
                nor does "var aClose = getValue("close", -nLength, -nLength, sSI);" which I tested just to see what happened.

                The [, nOffset] is the bar index so I believe it should be a negative number and the [, nNumBars] is the # of bars to return so it should be a positive number. Yet it seems to work opposite to the above.

                I used this test code:
                PHP Code:
                var bInitialized false;
                function 
                main() {
                    if (!
                bInitialized) {
                        var 
                nLength 300;
                        var 
                sSI getSymbol() + ",60";
                        
                //var aClose = getValue("close",- nLength, nLength, sSI);
                        //var aClose = getValue("close", nLength, nLength, sSI);
                        
                var aClose getValue("close"nLength, -nLengthsSI);
                        var 
                len 0//aClose.length();
                        
                debugPrintln(len);
                        
                bInitialized true;
                    }
                    return 
                null;

                Of course "var Len" is not a condition or result of any code above it so it should output regardless unless the "var aClose" condition is somehow stopping the execution of the code.

                Wayne
                Last edited by waynecd; 05-23-2010, 04:09 PM.

                Comment


                • #9
                  ok thanks.

                  just tried it this morning and ...

                  var aClose = getValue("close", 0, -nLength, sSI);
                  produced debug output

                  var aClose = getValue("close", -nLength, nLength, sSI);
                  produces debug output

                  var len = aClose.length();
                  does not produce debug output
                  Paul Williams
                  Strategy & Applications
                  www.futurenets.co.uk

                  Comment


                  • #10
                    Hi,

                    Using the test code below on a 60 min ES #F chart, “aClose” cycles as many times as there are loaded bars and outputs line 14 (debugPrintln(“14…” each time fully populated with all the close prices yet once it gets to the current bar (bar 0 or Cntr = 598) it returns null. That is why “aClose.length” returns null at the end. I have no clue if that is how it should behave.

                    I have no answers just the behavior I found so hopefully someone who knows what is going on can add an explanation.

                    PHP Code:
                     debugClear();
                    var 
                    Cntr 0;
                    var 
                    Cntr1 0;
                    var 
                    bInitialized false;
                    var 
                    aClose null;

                    function 
                    main() {

                        if (
                    bInitialized == false) {
                            
                    Cntr++
                            var 
                    nLength 300;
                            var 
                    sSI getSymbol() + ",60";
                            
                    aClose getValue("Close"nLength, -nLengthsSI);
                            
                    debugPrintln("14: aClose = "+aClose+"\n");
                            if(
                    aClose != nulldebugPrintln("aClose.length(); = "+aClose.length()+"\n");//output is that aclose has no Properties
                            
                    var len 0//aClose.length();
                            
                    debugPrintln("len = "+len+"\n");
                            
                    Cntr1++
                            
                    debugPrintln("19: !!!!!!!!!!!!!!!!!!"+Cntr+", "+Cntr1);
                            
                    bInitialized true;
                        }
                        return 
                    null;

                    Below, line 14 shows the counter (I omitted all output prior to bar 595 to save space since it just repeats the same data except for the “Cntr” value which is the bar it is processing. The last bar loaded on the chart is bar # 598. Note that when it reaches it “aClose” reverts to null.
                    19: !!!!!!!!!!!!!!!!!!598, 1
                    len = 0

                    14: Cntr = 598, aClose = null

                    14: Cntr = 597, aClose = 1065.75,1066.25,1066.25,1068.25,1072,1080.5,1083,1 087.5,1085.5,1083.75,
                    1078.5,1079.75,1074.5,1072.5,1076.25,1078.5,1082,1 083.75,1080,1080.5,
                    1079.25,1083.5,1079.25,1077,1081.75,1082,1084.5,10 84.5,1085.75,1075.25,
                    1082.25,1080.5,1085.25,1072.25,1072.25,1062.25,106 3.5,1066.25,1072.75,
                    1074,1074.25,1077.5,1077,1074.75,1074.5,1072.5,107 0.75,1067.25,1067,1064,
                    1065,1065.25,1070.25,1086,1082,1072,1083.25,1082.7 5,1090.5,1088.5,1093.5,
                    1103.5,1107.5,1111.5,1112.75,1109.5,1107.5,1110.25 ,1110.75,1112.75,1112.25,
                    1113,1115.25,1113.5,1114.5,1115,1113,1112.75,1114. 25,1113.25,1104.25,1111,
                    1118.5,1116.25,1111.25,1108.5,1105.75,1108.5,1114. 25,1116.5,1114.75,1112,
                    1112.5,1111.25,1110.25,1107.5,1108.25,1112,1111.75 ,1115.5,1119.25,1118.5,
                    1123.25,1132,1132,1136.25,1143.25,1143.5,1142,1140 .5,1138,1137,1139,1139.25,
                    1134,1132.5,1133.25,1130.75,1132.75,1132.5,1136.5, 1137,1136.25,1136.75,
                    1134.5,1129.25,1122.5,1117.5,1121.5,1130.5,1132,11 34,1138,1136.25,1134.75,
                    1132.5,1128.5,1127.75,1123,1124,1121,1122.25,1128. 25,1_´÷O
                    14: Cntr = 596, aClose = 1066.25,1066.25,1068.25,1072,1080.5,1083,1087.5,10 85.5,1083.75,1078.5,1079.75
                    ,1074.5,1072.5,1076.25,1078.5,1082,1083.75,1080,10 80.5,1079.25,1083.5,1079.25
                    ,1077,1081.75,1082,1084.5,1084.5,1085.75,1075.25,1 082.25,1080.5,1085.25,
                    1072.25,1072.25,1062.25,1063.5,1066.25,1072.75,107 4,1074.25,1077.5,1077,
                    1074.75,1074.5,1072.5,1070.75,1067.25,1067,1064,10 65,1065.25,1070.25,1086,
                    1082,1072,1083.25,1082.75,1090.5,1088.5,1093.5,110 3.5,1107.5,1111.5,1112.75,
                    1109.5,1107.5,1110.25,1110.75,1112.75,1112.25,1113 ,1115.25,1113.5,1114.5,
                    1115,1113,1112.75,1114.25,1113.25,1104.25,1111,111 8.5,1116.25,1111.25,1108.5,
                    1105.75,1108.5,1114.25,1116.5,1114.75,1112,1112.5, 1111.25,1110.25,1107.5,
                    1108.25,1112,1111.75,1115.5,1119.25,1118.5,1123.25 ,1132,1132,1136.25,1143.25,
                    1143.5,1142,1140.5,1138,1137,1139,1139.25,1134,113 2.5,1133.25,1130.75,
                    1132.75,1132.5,1136.5,1137,1136.25,1136.75,1134.5, 1129.25,1122.5,1117.5,
                    1121.5,1130.5,1132,1134,1138,1136.25,1134.75,1132. 5,1128.5,1127.75,1123,
                    1124,1121,1122.25,1128.25,1133,1133_´÷O
                    14: Cntr = 595, aClose = 1066.25,1068.25,1072,1080.5,1083,1087.5,1085.5,108 3.75,1078.5,1079.75,1074.5,
                    1072.5,1076.25,1078.5,1082,1083.75,1080,1080.5,107 9.25,1083.5,1079.25,1077,
                    1081.75,1082,1084.5,1084.5,1085.75,1075.25,1082.25 ,1080.5,1085.25,1072.25,
                    1072.25,1062.25,1063.5,1066.25,1072.75,1074,1074.2 5,1077.5,1077,1074.75,
                    1074.5,1072.5,1070.75,1067.25,1067,1064,1065,1065. 25,1070.25,1086,1082,1072,
                    1083.25,1082.75,1090.5,1088.5,1093.5,1103.5,1107.5 ,1111.5,1112.75,1109.5,
                    1107.5,1110.25,1110.75,1112.75,1112.25,1113,1115.2 5,1113.5,1114.5,1115,1113,
                    1112.75,1114.25,1113.25,1104.25,1111,1118.5,1116.2 5,1111.25,1108.5,1105.75,
                    1108.5,1114.25,1116.5,1114.75,1112,1112.5,1111.25, 1110.25,1107.5,1108.25,
                    1112,1111.75,1115.5,1119.25,1118.5,1123.25,1132,11 32,1136.25,1143.25,1143.5,
                    1142,1140.5,1138,1137,1139,1139.25,1134,1132.5,113 3.25,1130.75,1132.75,
                    1132.5,1136.5,1137,1136.25,1136.75,1134.5,1129.25, 1122.5,1117.5,1121.5,
                    1130.5,1132,1134,1138,1136.25,1134.75,1132.5,1128. 5,1127.75,1123,1124,1121,
                    1122.25,1128.25,1133,1133.5,1132._´÷O
                    Wayne
                    Last edited by waynecd; 05-25-2010, 12:10 AM.

                    Comment


                    • #11
                      thanks Wayne, very much appreciated. will eSignal take a look at this?
                      Paul Williams
                      Strategy & Applications
                      www.futurenets.co.uk

                      Comment


                      • #12
                        All you can do is ask.

                        On first load, on a daily chart (ES #F loads 301 bars) it outputs "aClose" only once.


                        19: !!!!!!!!!!!!!!!!!!2, 1
                        len = 0

                        14: Cntr = 2, aClose = null

                        14: Cntr = 1, aClose = 1049.5,1052.25,1053.25,1053,1057.25,1058.5,1059.25 ,
                        1064.75,1066.25,1066.25,1068.25,1072,1080.5,1083,
                        1087.5,1085.5,1083.75,1078.5,1079.75,1074.5,1072.5 ,
                        1076.25,1078.5,1082,1083.75,1080,1080.5,1079.25,
                        1083.5,1079.25,1077,1081.75,1084,1084.5,1084.5,
                        1085.75,1075.25,1082.25,1080.5,1085.25,1072.25,
                        1072.25,1062.25,1063.5,1066.25,1072.75,1074,
                        1074.25,1077.5,1077,1074.75,1074.5,1072.5,
                        1070.75,1067.25,1067,1064,1065,1065.25,1070,
                        1086,1082,1072,1083.25,1082.75,1090.5,1088.5,
                        1093.5,1103.5,1107.5,1111.5,1112.75,1109.5,
                        1107.5,1110.25,1110.75,1112.75,1112.25,1113,
                        1115.25,1113.5,1114.5,1115,1113,1112.75,
                        1114.25,1113.25,1104.25,1111,1118.5,1116.25,
                        1111.25,1108.5,1105.75,1108.5,1114.25,1116.5,
                        1114.75,1112,1112.5,1111.25,1110.25,1107.5,
                        1108.25,1112,1111.75,1115.5,1119.25,1118.5,
                        1123.25,1132,1132,1136.25,1143.25,1143.5,1142,
                        1140.5,1138,1137,1139,1139.25,1134,1132.5,
                        1133.25,1130.75,1132.75,1132.5,1136.5,1137,
                        1136.25,1136.75,1134.5,1129.25,1122.5,1117.5,
                        1121.5,1130.5,1132,1134,1138,1136.25,1134.75,
                        1132.5,1´÷O
                        On first load (ES #F 60 min chart with 300 bars loaded) it only outputs:
                        19: !!!!!!!!!!!!!!!!!!1, 1
                        len = 0

                        14: Cntr = 1, aClose = null
                        But once I move the 60 min chart backwards (it then loads 599 bars) and reload the study, I then get the repetition I posted below of "aClose" up to bar count 299 with "aClose = null" at bar count 300 (odd since it now has 599 bars loaded).

                        When I continue to move backwards on the chart so it loads more bars, 898 bars now) it now repeats "aClose" data to bar 598 with bar 599 = null.

                        Wayne
                        Last edited by waynecd; 05-25-2010, 12:31 AM.

                        Comment


                        • #13
                          Going back to the basics, a code example at: http://kb.esignalcentral.com/display...27705001831055 states:
                          //retrieve?the?most?recent?20?high?values?into?an?ar ray
                          //where the [0] element of myArray contains the high at bar -19.
                          var myArray?=?getValue(?"high",?-19,?20?); // less common method
                          So the test code I used should retrieve the most recent 300 closes starting with index bar -300. But it loads 300 bars less than the total bars loaded whether "aClose" is set as a global variable or a local one. So upon moving back to load 899 bars it outputs "aClose" 598 times not 300 times. And still the last output of "aClose" is null.

                          Thanks

                          Wayne

                          Note: the question marks are as they are displayed in the web page. They are not my typos.
                          Last edited by waynecd; 05-25-2010, 01:09 AM.

                          Comment


                          • #14
                            ok thanks Wayne.

                            I wanted to find out why the script ended prematurely when I try and find the length of the array ...

                            var len = aClose.length();
                            Paul Williams
                            Strategy & Applications
                            www.futurenets.co.uk

                            Comment


                            • #15
                              I wasn't much help to either of us on this one.

                              I don't know. But I would really like to.

                              Wayne

                              Comment

                              Working...
                              X