Announcement

Collapse
No announcement yet.

setting alerts thru an efs

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

  • setting alerts thru an efs

    Hi

    I have a simple efs that colours price bars according to macd status. Does anyone know if you can set an alert so that when the colour changes from one state to another an alarm goes off?
    I can't seem to work this one out.
    Russell
    0
    .
    0%
    0
    .
    0%
    0

  • #2
    Russell
    Apply the alarm to the same conditions that change the color of the price bars and set it to go off only on the first instance of that condition.
    Alex

    Comment


    • #3
      RE: Reply to post 'setting alerts thru an efs'

      Thanks Alexis

      I am new to efs and don't know Java so this is all quite slow for me but I
      am getting there. I have now put an alert in my efs but it only works by
      itself ie I can't color the bars as well.
      What I am trying to do to the following efs is this

      var vHist1 = study.getValue(MACDStudy.HIST,-1); ie a second macd histogram
      value 1 bar ago

      then condition =

      if (vhist>0 && vHist<0);
      Alert.playSound(new.wav)

      I can get sounds or coloured bars but not both - any help would be
      appreciated.

      Russell

      /************************************************** *************************
      *************************
      produces green and red bars above and below zero line in real time.
      ************************************************** **************************
      *************************/
      var study = new MACDStudy(5, 35, 8, "Close", false);

      function preMain() {
      setStudyTitle ("5,35,8");

      setDefaultBarFgColor(Color.magenta, 1);
      addBand(3,PS_SOLID,2,Color.red);
      addBand(-2.7,PS_SOLID,2,Color.lime);
      setPlotType(PLOTTYPE_HISTOGRAM,0);
      }

      function main() {

      var vHist = study.getValue(MACDStudy.HIST);


      if (vHist > 0){
      setBarFgColor(Color.lime);
      setBarThickness(2);
      } else if (vHist <=0 ){
      setBarFgColor(Color.red);
      setBarThickness(2);
      }

      return (vHist);

      }

      -----Original Message-----
      From: [email protected] [mailto:[email protected]]
      Sent: 06 March 2003 11:14
      To: [email protected]
      Subject: Reply to post 'setting alerts thru an efs'


      Hello Russell,

      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      Comment


      • #4
        setColorPriceBars(true);

        may need to be in your preMain(); section

        Comment


        • #5
          Russell
          I believe the attached modification of your efs does what you want.
          As an aside you may want to try using the Formula Wizard.
          Alex
          Attached Files
          Last edited by ACM; 03-06-2003, 06:21 AM.

          Comment


          • #6
            test macd efs

            Hi

            That was a definite improvement
            Why set the var vLastalert to -1 and not 0?

            Comment


            • #7
              RE: Reply to post 'setting alerts thru an efs'

              Hmm...

              The efs doesn't seem to be reading the right sound wave - if I change it it
              still produces a "dunk" sound. Also it produces the signal repeatedly as
              the macd crosses the zero line (ie not computing on close)

              Russ


              -----Original Message-----
              From: [email protected] [mailto:[email protected]]
              Sent: 06 March 2003 13:16
              To: [email protected]
              Subject: Reply to post 'setting alerts thru an efs'


              Hello Russell,

              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

              Comment


              • #8
                RE: Reply to post 'setting alerts thru an efs'

                ER ....

                Just sorted out the wave file thing - didn't realise you had double slashes
                in the file on first look

                Russ

                -----Original Message-----
                From: [email protected] [mailto:[email protected]]
                Sent: 06 March 2003 13:16
                To: [email protected]
                Subject: Reply to post 'setting alerts thru an efs'


                Hello Russell,

                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                Comment


                • #9
                  Re: Reply to post 'RE: Reply to post 'setting alerts thru an efs''

                  Russell
                  Add this to function preMain()
                  setComputeOnClose(true)
                  and it will sound only once the bars is completed
                  Alex

                  Comment


                  • #10
                    RE: Reply to post 'Re: Reply to post 'RE: Reply to post 'setting alerts thru an efs'''

                    Alexis
                    Thanks but I find compute on close stops it working!!

                    Also why is there an exclamation mark in line. What does this mean.

                    if (vLastAlert != 2) Alet.playSound (ding.wav)
                    Russ
                    -----Original Message-----
                    From: [email protected] [mailto:[email protected]]
                    Sent: 06 March 2003 15:38
                    To: [email protected]
                    Subject: Reply to post 'Re: Reply to post 'RE: Reply to post 'setting
                    alerts thru an efs'''


                    Hello Russell,

                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                    Comment


                    • #11
                      The != means not equal to.

                      Did you get any errors on the formula output window when you loaded the modified formula?

                      Garth
                      Garth

                      Comment


                      • #12
                        Russell

                        Thanks but I find compute on close stops it working!!

                        Where did you put that statement?
                        It should be in preMain (see below)

                        function preMain() {
                        setStudyTitle ("5,35,8");
                        setDefaultBarFgColor(Color.magenta, 1);
                        addBand(3,PS_SOLID,2,Color.red);
                        addBand(-2.7,PS_SOLID,2,Color.lime);
                        setPlotType(PLOTTYPE_HISTOGRAM,0);
                        setComputeOnClose(true);
                        }

                        What it should do is plot the histogram for the current bar only when that bar is closed thus avoiding the multiple alerts when the indicator is crossing over on the same bar.

                        Also why is there an exclamation mark in line. What does this mean.

                        It means "not equal to"

                        Why set the var vLastalert to -1 and not 0?

                        I really don't know the answer except that is how the Formula Wizard does it and that is how I do it.

                        Alex
                        Last edited by ACM; 03-06-2003, 12:01 PM.

                        Comment


                        • #13
                          RE: Reply to post 'setting alerts thru an efs'

                          Yes it is in pre main and I don;t get any errors from the compiler but I
                          have noticed it is coloured black rather than blue like all the other
                          statements - is this significant?

                          -----Original Message-----
                          From: [email protected] [mailto:[email protected]]
                          Sent: 06 March 2003 16:56
                          To: [email protected]
                          Subject: Reply to post 'setting alerts thru an efs'


                          Hello Russell,

                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                          Comment


                          • #14
                            Russell
                            I don't know the reason but yes it is printed in black rather than in blue like some other statements.
                            Alex

                            Comment

                            Working...
                            X