Announcement

Collapse
No announcement yet.

trying to set up a pivot based on a specific time

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

  • trying to set up a pivot based on a specific time

    I am trying to set up a study to draw a pivot line based on the price a specific time, specifically, at the opening price of RTH for the e-mini. I have browsed through the posts and a lot of the code deal with setting up pivots based on relative, not absolute, bars, e.g last bar or 3rd from last bar, etc. I need help trying to code in an absolute time for a price - 08:30:01 (CST) price.

    I have tried to modify the variable-pivots.efs, but cannot get it to look a specific time. Suggestions, please ....

  • #2
    Try This....

    PHP Code:
    // user variables.
    var eministarttime 830;

    // system variables
    var starttimebar null;
    var 
    starttimeprice null;
    var 
    vHour;
    var 
    vMin;
    var 
    vSec;
    var 
    vDay;
    var 
    vMonth;
    var 
    vYear;
    var 
    vTime = new Date();
    var 
    nLastRawTime 0;
    var 
    BLBarOffset 0;


    function 
    preMain() {
        
    setStudyTitle("Timr/price");
        
    setShowCursorLabel(false);
        
    setCursorLabelName("Sto");
                    
    setPriceStudy(true);
    }

    function 
    main() {

    if (
    getValue("rawtime"0) != nLastRawTime) {
         
    nLastRawTime getValue("rawtime"0);
         
    BLBarOffset += 1;
    }

    //  Get Time Variables
      
    vTime getValue("Time"0);
      
    vHour vTime.getHours();
      
    vMin vTime.getMinutes();
      
    vSec vTime.getSeconds();
      
    vDay vTime.getDate();
      
    vMonth vTime.getMonth() +1;
      
    vYear vTime.getYear();

    //  identify the opening price values for the current day.
      
    if (((vHour*100)+vMin) == eministarttime) {
        
    starttimebar BLBarOffset;
        
    starttimeprice open();
      }

    //  draw the line if the values are established.
      
    if ((starttimebar != null) && (starttimeprice != null)) {
       
    drawLineRelative( (starttimebar BLBarOffset), starttimeprice0starttimepricePS_SOLID2Color.blue, ("830"+vDay);
      }


    B
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks, this works very well

      Comment

      Working...
      X