Announcement

Collapse
No announcement yet.

Indicator keeps going back to 0

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

  • Indicator keeps going back to 0

    I am using an indicator that contains the following piece of code The following refers to the close of the Japanese Market at 3:30pm tokyo time. I intend to reference the close of the most recent completed bar. However as the clock ticks over midnight, it changes to the most current bar.
    PHP Code:
    TCL = (close(0,sym("TCL 6!-TCM")) - close(0,sym("TCL 6!-TCM,D"))) ; 
    How can I write the code so it keeps referencing the most recent COMPLETED daily close?

    Thanks
    Last edited by maninjapan; 12-14-2011, 08:55 AM.

  • #2
    Actually I think I have just figured it out. I was using the combined data which also included the overnight data. I seem to be getting the correct data by using TCL 6!-TCM=2,D . However only returns the data for the previous day. The indicator is just blank before that. How can I have it continuosly returning the close for the previous day compared the intraday chart?

    Iam actually specifically after the previous days settlement price. Is there another way to code this?
    PHP Code:
    close(0,sym("TCL 6!-TCM=2,D")) 
    Last edited by maninjapan; 12-14-2011, 09:30 AM.

    Comment


    • #3
      Using the following (using PreviousDayDailyBars.efs as a reference) I have been able to get the continuity I was looking for. However, I have specified a product using the day contract which closes at 15:30 each day,. If I apply this to that specific products chart it shows correctly, changing at 15:30, however If I apply it to any other product instead of changing close prices at 1530, it changes at midnight the previous day, which is incorrect.
      How do I keep the data changing at the correct time of 15:30 regardless of the chart it is applied to?

      PHP Code:




      function preMain() {

          
      setPriceStudy(false);
          
      setStudyTitle("test");
          
      setCursorLabelName("TCL"0);
          
      setDefaultBarStyle(PS_SOLID0);
          
      setDefaultBarFgColor(Color.red0);
          
      setDefaultBarThickness(10);
          
      setPlotType(PLOTTYPE_LINE0);

      }

      var 
      bInit false;
      var 
      xClose null

      function 
      main() {


          if(
      isMonthly() || isWeekly() || isDaily())
          return;
          
            if(
      bInit == false){
              
      xClose close(sym("TCL K2-TCM=2,D")); ; 
              
      bInit true;
          }
          
          var 
      vClose xClose.getValue(-1); 
          if(
      vClose == null )
          return;

          return 
      vClose


      Comment

      Working...
      X