Announcement

Collapse
No announcement yet.

Price Alert Common Window

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

  • Price Alert Common Window

    Is there a common window where I can view price alerts, other than the debug window?

    What I'd like to do is at the end of the day, see if any of the 20+ charts have met a condition. I'd like to view them in one window. Is there a way to do that?

    I guess I can try to write to a file... but I wonder if there will be any file access conflict when more than 1 chart tries to do this at almost the same time?

  • #2
    Hello philtong,

    Yes there is such a way. What you will need to add to your formulas is Alert.addToList(). This function will add an Alert to the Alert List window. Any alerts from your charts will all be populated in this window. Make sure you have Pop Up Alerts enabled in the "Set Alerts" option under the "View" menu if you want the window to appear as alerts are triggered. You can also open the Alert List window manually by selecting "Alert List" under the "View" menu. If you open the Alert List window, you can also right-click on it to view the window's menu choices. This window is set to display a maximum of 50 alerts. If you anticipate receiving more than that, you can increase that number in the properties option from the right-click menu.

    PHP Code:
        // Alert.addToList(Symbol, Description, FG, BG)
        
    Alert.addToList(getSymbol(), "Buy"Color.blackColor.green); 
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Is there a way to log alerts without the Alert List window 1) popping up, and 2) taking active window focus?

      For example, writing to a DateAlertLog.txt file?

      Comment


      • #4
        Hello Lancer,

        You certainly can write to a file. Here's how:

        PHP Code:
        function preMain() {
            
        setPriceStudy(true);
        }

        function 
        main() {
            var 
        = new File("myfile.txt");  //the file will be created in:  eSignal/FormulaOutput/
            
        var myData 25;  //  example data
         
            
        a.open("w");   // Opens and overwrites the file
            //a.open("w+"); // Opens and appends to the file
            
        if(!a.isOpen()) {
                
        debugPrintln("Could not open file!");
            } else {
                
        a.writeln(" build a text string, " myData " more text etc. ");
            }
            
        a.close();

        Please note: If a formula tries to open the file when it is currently open by another process, the alert will not get recorded. I'm sure it would be a very rare occurrence, but it's something to consider. To ensure that all alerts get recorded, one could have each formula write to its own file.
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Hi Lancer:

          Here is a self-contained function that will create and update log files. It will initially create a log file with the symbol name + date (e.g., IBM02-23-2003.txt). Each line will be time stamped and you can pass as many parameters as you want to this function

          Example:

          logEntry( "hello" );

          will write 16:23:03 : hello

          to the log file

          logEntry( close(), high(), x+10/3, "Stop Hit" );

          will write something like:

          16:24:17 : 89.34, 90.23, 15.6, Stop Hit

          Here is the function, just place all of this at the end of your EFS file (after main() ). The log files will be written to your formulatoutput directory. Click on "Tools" and then "EFS Settings" to find out where that is. In case it is hard to read in this message, I will also post it up to the Specialty Groups - Miscellaneous section.

          Chris

          PHP Code:
          function logEntrys1 ) {
          var 
          x;
          var 
          _d = new Date();
          var 
          sTmp;
          var 
          fStamp;
          var 
          fName;

                          
          //zero-pad any number to length and return to caller
              
          function _pad_sVal_nSize ) {
                  var 
          sTmp="";
                  var 
          len = new String_sVal ).length;
                  
          _nSize = (_nSize==null) ? _nSize ;
                  if (
          len>=_nSize) return(_sVal);
                  for(
          x=0x<(_nSize-len); x++) {
                      
          sTmp += "0";
                  }
                  return( 
          sTmp +=_sVal );
              }
              
              
          //==format date/time and return string to caller
              
          function _formatDate_Date_Type ) {
                  
          with (_Date) {
                      try {
                          var 
          mo _padgetMonth()+1);
                          var 
          da _padgetDate(), );
                          var 
          yr getYear()+1900;
                          var 
          hr _padgetHours(), 2);
                          var 
          mn _padgetMinutes(), );
                          var 
          sc _padgetSeconds(), );
                      }
                      catch(
          e) {
                          return( 
          "BAD DATE" );
                      }
                  }
                  
          //==return date, date/time or just time
                  
          switch( _Type ) {
                      case 
          1: return (mo+"-"+da+"-"+yr+" "+hr+":"+mn+":"+sc);
                      case 
          3: return (hr+":"+mn+":"+sc); 
                      default: return (
          mo+"-"+da+"-"+yr);
                  }
              }
                  
              
          //*** logEntry code begins here *****         
                  
              //Build our file name (Symbol+Date+".txt");
              
          fName getSymbol().toUpperCase() + _formatDate_d) + ".txt";
              
          //get TimeStamp 
              
          fStamp _formatDate_d);

              
          //gather all of our arguments and format them into a string
              
          sTmp logEntry.arguments[0];
              for (
          x=1x<logEntry.arguments.lengthx++) {
                  
          sTmp += ", " logEntry.arguments[x];
              }

              
          //open or re-open our file and write the line of text
              //each line is time-stamped
              
          _f = new FilefName );
              try {
                  
          with_f ) {
                      
          open"at+" );
                      try {
                          
          writelnfStamp " : " sTmp );
                      }
                      finally {
                          
          close();
                      }
                  }
              }
              catch( 
          ) {
                  
          debugPrint("File Error: " fStamp "\n" );
                  return;
              }


          Last edited by ckryza; 02-22-2003, 05:57 PM.

          Comment


          • #6
            Any reason


            Alert.addToList(getSymbol(), "ShortEntrySignal", Color.RGB(0,0,0), Color.RGB(195,0,0))

            wont show up in the Triggered ALert List?

            I am very sure the line of code was executed.

            Comment


            • #7
              David
              I just ran a test and it shows up in the Triggered Alert List when the conditions are met.
              Alex

              Comment


              • #8
                I added a debugPrintln before and after the alert line. The debug line prints ok, but not the alert.

                if(bar=="red" && barOld!="red"&&arrow!="short"){
                setPriceBarColor(Color.yellow);
                //Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ding.wav")
                Alert.addToList(getSymbol(), "ShortEntrySignal", Color.RGB(0,0,0), Color.RGB(195,0,0))
                barr=barr+1;
                arrow="short";
                bar="yellow";
                //if(getCurrentBarIndex()==0)
                debugPrintln("ShortEntrySignal");
                drawShapeRelative(0, low()-0.25, Shape.RIGHTARROW, "", Color.RGB(255,251,240), Shape.LEFT, barr)
                }

                Comment

                Working...
                X