Announcement

Collapse
No announcement yet.

Text Notificaction Via Time

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

  • Text Notificaction Via Time

    Hello,

    Looking for some help on creating an efs study that displays user defined text messages on the chart at 14 different user defined times throughout the day on top of the current candle.

    Can someone point me in the right direction? Or if there is something similar (haven't found it so far), I'll try an edit it accordingly.

    Thank you for your time.
    SB

  • #2
    I would use two arrays for this...

    var vTimeArray = new Array(1000, 1100, 1200, 1300, 1400, 1500, 1600);
    var vText4Time = new Array("Text 1",
    "Text 2",
    "Text 3",
    "Text 4",
    "Text 5",
    "Text 6",
    "Text 7");

    This sets up your times and your text values to be displayed. Then I would use a simple lookup routine to determine which text needs to be drawn on the chart (again, this is time based so we need to setup some additional date/time variables to simplify this).

    PHP Code:

    //  Global Variables

    var vTimeArray = new Array(1000110012001300140015001600);
    var 
    vText4Time = new Array("Text 1",
    "Text 2",
    "Text 3",
    "Text 4",
    "Text 5",
    "Text 6",
    "Text 7");

    var 
    vTimeArrayPtr = -1;

    var 
    vRTHour;
    var 
    vRTMin;
    var 
    vRTSec;
    var 
    vHour;
    var 
    vMin;
    var 
    vSec;
    var 
    vDay;
    var 
    vMonth
    var 
    vDOW;
    var 
    nTime 0;
    var 
    vRTTimeMin 0;
    var 
    nRTTimeMin 0;


    function 
    main() {

    //---------------------------------------------------
    //  Get RT Time Variables 
       
    var vTime = new Date();
      
    vRTHour vTime.getHours();
      
    vRTMin vTime.getMinutes();
      
    vRTSec vTime.getSeconds();
    //---------------------------------------------------
    //  Get Bar Time Variables 
      
    vTime getValue("Time"0);
      
    vHour vTime.getHours();
      
    vMin vTime.getMinutes();
      
    vSec vTime.getSeconds();
      
    vDay vTime.getDate();
      
    vMonth vTime.getMonth() +1
      
    vDOW vTime.getDay();
      var 
    vYear vTime.getYear();
      var 
    nTimeMin = (vHour*60)+vMin;
      
    nTime = (vHour*100)+vMin;
      
    vRTTimeMin = (vRTHour*60)+vRTMin;
      
    nRTTimeMin = (vRTHour*100)+vRTMin;


      if (
    fCheck4TimeText(nRTTimeMin)) {
        
    drawTextRelative(0,high(), vText4Time[vTimeArrayPtr], Color.bluenullText.ONTOP Text.CENTER Text.FRAMEnull9"output1"); 
      }


    //  end of main


    function fCheck4TimeText(vnRT_TimeMin) {
      var 
    = (vTimeArray.length-1);
      var 
    vTimeFoundInArray false;

       
    //  This is a reverse look routine for an array.  We start looking at the LAST value in the array, then step backward to the first.
      
    while ( (>= 0) && (vTimeFoundInArray ) ) {
         if (
    vnRT_TimeMin >= vTimeArray[x]) {
           
    //  this tests to see if the vnRT_TimeMin value is greater than the time stored in our array.
            
    vTimeArrayPtr x;
            
    vTimeFoundInArray true;
         }  
    // end if
        
    x--;
      } 
    // end while
      
    return vTimeFoundInArray;
    }  
    // end function 
    Last edited by Doji3333; 02-19-2008, 09:51 AM.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Doji3333,

      Thank you for your knowledge and reply!

      Looks like I'll have to do some searching for to figure out those time variables and lookup routine to get this rolling along.

      Thanks again,
      Steve

      Comment


      • #4
        Steve,

        I gave you a complete example. Just spend some time looking and reviewing my example and you should be fine. Let me know if you have any questions.
        Brad Matheny
        eSignal Solution Provider since 2000

        Comment

        Working...
        X