Announcement

Collapse
No announcement yet.

Object Series

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

  • Object Series

    Hi!

    I am using the following basic formula to display the close of the previous day and the current days close after the first 15 min. The lines are displaying accurately, but I have 2 questions:

    1- When I try to retrieve the Day2 values, it only returns 'object series', even though the lines are printed at the correct values. I cannot figure out what 'object series' means?

    2- The efs displays the correct line values on every time frame that is 15 min. or less, but fails if it is used on time frames greater then 15 min?

    Thanks, Charley

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Opening Range");
        
    setShowCursorLabel(false);
        
    setShowTitleParameters(false);

    function 
    main() {
        
    var 
    nID getCurrentBarCount();
    var 
    startTime 630;
    var 
    barTime = (hour(0) * 100) + minute(0);
    var 
    Int15 = (inv("15"));
    var 
    vClose close(Int15);    
        
        if (
    barTime == startTime) {
        
            
    Day1 close(-1);
            
    Day2 vClose;    
        
            
    drawLineRelative(0Day177Day1PS_DOT1Color.blue"C1" nID);
            
    drawLineRelative(0Day277Day2PS_DOT1Color.red"C2" nID);
            
         var 
    retArray = new Array(4);
        
        
    retArray[0] = Day1;     debugPrintln(retArray[0]);
        
    retArray[1] = Day2;     debugPrintln(retArray[1]);
        }    


  • #2
    charley
    Search the forum (preferably using Google) for the keywords "object series" and you will find that the topic has been covered before
    Regarding the second issue that is because with those other intervals you do not have a bar time stamped as per the condition. Again search the forum as there are many threads (complete with formulas or examples) on "opening range" or similar topic
    Alex


    Originally posted by charley View Post
    Hi!

    I am using the following basic formula to display the close of the previous day and the current days close after the first 15 min. The lines are displaying accurately, but I have 2 questions:

    1- When I try to retrieve the Day2 values, it only returns 'object series', even though the lines are printed at the correct values. I cannot figure out what 'object series' means?

    2- The efs displays the correct line values on every time frame that is 15 min. or less, but fails if it is used on time frames greater then 15 min?

    Thanks, Charley

    PHP Code:
    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Opening Range");
        
    setShowCursorLabel(false);
        
    setShowTitleParameters(false);

    function 
    main() {
        
    var 
    nID getCurrentBarCount();
    var 
    startTime 630;
    var 
    barTime = (hour(0) * 100) + minute(0);
    var 
    Int15 = (inv("15"));
    var 
    vClose close(Int15);    
        
        if (
    barTime == startTime) {
        
            
    Day1 close(-1);
            
    Day2 vClose;    
        
            
    drawLineRelative(0Day177Day1PS_DOT1Color.blue"C1" nID);
            
    drawLineRelative(0Day277Day2PS_DOT1Color.red"C2" nID);
            
         var 
    retArray = new Array(4);
        
        
    retArray[0] = Day1;     debugPrintln(retArray[0]);
        
    retArray[1] = Day2;     debugPrintln(retArray[1]);
        }    

    Comment


    • #3
      Thank you for your help Alex!

      I think I almost figured it out, but I have one more problem. The array is populating with the correct values, but when I try to extract the next to last value with the following efs, myRef1 is null?

      Thanks, Charley

      PHP Code:
      function preMain() {
          
      setPriceStudy(true);
          
      setStudyTitle("Opening Range");
          
      setShowCursorLabel(false);
          
      setShowTitleParameters(false);
      }
      var 
      BarCntr 0;

      function 
      main() {
          
      var 
      nState getBarState();    
      var 
      nID getCurrentBarCount();
      var 
      startTime 630;
      var 
      barTime = (hour(0) * 100) + minute(0);
      var 
      Int15 = (inv("15"));
      var 
      vClose close(Int15);

          if (
      nState == BARSTATE_NEWBAR) {
              
      BarCntr += 1;
          }    
          if (
      barTime == startTime) {
          
              
      Day2 vClose.getValue(0);    
          
                  
      drawLineRelative(0Day2, +25Day2PS_DOT1Color.red"L" nID);
              
          var 
      retArray = new Array(1);

          
      retArray[0] = vClose.getValue(0);   debugPrintln(retArray[0]);
          }
          if (
      BarCntr 3) {
              var 
      myRef1 ref(-1);
              var 
      Close1 myRef1 [0];        debugPrintln(Close1); 
          }

      Comment


      • #4
        I changed the BarCntr statement to if (BarCntr > 300), and am no longer getting the null error. But I still cannot extract the array objects. Thanks

        Comment


        • #5
          charley
          Your script is not returning anything hence ref() will not work as it only references values that are returned
          Alex


          Originally posted by charley View Post
          I changed the BarCntr statement to if (BarCntr > 300), and am no longer getting the null error. But I still cannot extract the array objects. Thanks

          Comment

          Working...
          X