Announcement

Collapse
No announcement yet.

need assistance w/simple formula

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

  • need assistance w/simple formula

    I need a formula that gives me alarms each time the price of a stock reaches a point near the bottom of the bollinger bands during the day with live data using esignal. Also I don't know how to put the formula in esignal to get it to work. Please advise. I can pay or trade services ( I am a cpa who helps people with IRS problems)
    The formula will take the high and the low of the bollinger bands. When the price is approx. 15% of the distance off the bottom toward the top the alarm will ring. The variables I can change need to be the 15% and the number of periods in the BB.
    You can email me at [email protected] with questions.
    Thanks - Joe Mastriano

  • #2
    55 views and no help?an I doing something wrong. I switched from qcharts to esignal because of the ability to do formulas for alerts. Can someone please direct me since no one seems to have the answer. Thanks

    Comment


    • #3
      Joe,

      It seems I already have almost what you need. I've modified my script and now you can use it for your trading! Please let me know if this helps.

      Yours EMET

      PHP Code:

      //Developed by EMET
      //Bollinger Bands Alert

      /*
      I need a formula that gives me alarms each time the price of a stock reaches a
      point near the bottom of the bollinger bands during the day with live data using
      esignal. Also I don't know how to put the formula in esignal to get it to work.
      Please advise. I can pay or trade services ( I am a cpa who helps people with IRS
      problems)
      The formula will take the high and the low of the bollinger bands. When the price
      is approx. 15% of the distance off the bottom toward the top the alarm will ring.
      The variables I can change need to be the 15% and the number of periods in the BB.
      */

      var fpArray = new Array();
      var 
      bInit false;
      var 
      BBUp null;
      var 
      BBDn null;
      var 
      BBMid null;
      var 
      SignalFlag true;

      function 
      preMain() {

          
      setPriceStudy(true);
          
      setStudyTitle("Bollinger Bands Alert");    
      //Lines Parametr
          
      setCursorLabelName("Up"0);
          
      setCursorLabelName("Down"1);
          
      setCursorLabelName("Middle"2);

          
      setDefaultBarFgColor(Color.green0);
          
      setDefaultBarFgColor(Color.green1);
          
      setDefaultBarFgColor(Color.blue2);
              
          
      setPlotType(PLOTTYPE_LINE0); 
          
      setPlotType(PLOTTYPE_LINE1); 
          
      setPlotType(PLOTTYPE_LINE2); 
          
          
      setDefaultBarThickness(20);
          
      setDefaultBarThickness(21);
          
      setDefaultBarThickness(12);
          
      //Other parametr
          
      askForInput();
          
          var 
      x=0;
          
      fpArray[x] = new FunctionParameter("Length_BB"FunctionParameter.NUMBER);
          
      with(fpArray[x++]){
              
      setLowerLimit(1);        
              
      setDefault(20);
          }

          
      fpArray[x] = new FunctionParameter("Standard_deviations"FunctionParameter.NUMBER);
          
      with(fpArray[x++]){
              
      setLowerLimit(1);        
              
      setDefault(2);
          }

          
      fpArray[x] = new FunctionParameter("Percent"FunctionParameter.NUMBER);
          
      with(fpArray[x++]){
              
      setLowerLimit(1);        
              
      setDefault(15);
          }

          
      fpArray[x] = new FunctionParameter("SignalSoundUP"FunctionParameter.STRING);
          
      with(fpArray[x++]){
              
      setDefault("signal.wav");
          }    
          
      fpArray[x] = new FunctionParameter("SignalSoundDOWN"FunctionParameter.STRING);
          
      with(fpArray[x++]){
              
      setDefault("signal.wav");
          }    
          
      fpArray[x] = new FunctionParameter("Sound_ON_OFF"FunctionParameter.BOOLEAN);
          
      with(fpArray[x++]){
              
      setDefault(false);
          }    

         
      }

      function 
      main(Length_BBPercentStandard_deviationsSignalSoundUPSignalSoundDOWNSound_ON_OFF) {
      var 
      nBBUpnBBDnnBBMid;
      var 
      Percent_100Percent_realPercent_tmp;
      var 
      Color_ Color.grey;

         
      //Initialization
         
      if ( bInit == false ) { 
              
      debugPrintln("Im start");
              
      BBUp  upperBB(Length_BBStandard_deviations);
              
      BBDn  lowerBB(Length_BBStandard_deviations);
              
      BBMid middleBB(Length_BBStandard_deviations);
            
      bInit true
          } 

         
      nBBUp  BBUp.getValue(0);
         
      nBBDn  BBDn.getValue(0);
         
      nBBMid BBMid.getValue(0);
        
         if (
      nBBUp == null || nBBDn == null || nBBMid == null) return;
        
         
      Percent_tmp 0;
         
      Percent_100  nBBUp nBBDn;
       
         if (
      close(0) > nBBDn && close(0) < nBBUp) {
           
      Percent_real nBBUp-close(0);
         }

         
      Percent_tmp = (Percent_real 100) / Percent_100;
       
         
         if (
      Percent_tmp 100 Percent) {
           if (
      SignalFlag == true) {
             
      Alert.addToList(getSymbol(), Percent "% from Lower BB"Color.whiteColor_ );     
             if(
      SignalSoundUP != null && Sound_ON_OFF == true) {
               
      Alert.playSound(SignalSoundUP);
             }
             
      SignalFlag false;
           } 
         }

         if (
      Percent_tmp Percent) {
           if (
      SignalFlag == true) {
             
      Alert.addToList(getSymbol(), Percent "% from Upper BB"Color.whiteColor_ );     
             if(
      SignalSoundDOWN != null && Sound_ON_OFF == true) {
               
      Alert.playSound(SignalSoundDOWN);
             }
             
      SignalFlag false;
           } 
         }

         if (
      Percent_tmp 100 Percent && Percent_tmp Percent)
          
      SignalFlag true;

         return new Array (
      nBBUpnBBDnnBBMid);
          

      Comment


      • #4
        Hello,

        I downloaded this EFS and used it on a few of my charts....however on the Alert Window it does not show the symbol, it only shows the condition that was met.

        Does anyone have the code to fix it so that it shows the symbol as well?

        Comment

        Working...
        X