Announcement

Collapse
No announcement yet.

Question about MACD

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

  • Question about MACD

    Is there a way to alarm for MACD when the fast line crosses the slow????

  • #2
    Mark
    That can be easily accomplished with the Formula Wizard.
    If instead you have a formula that was done outside of FW and would like to add the function then post it and someone can modify it.
    Alex

    Comment


    • #3
      Still problems

      I used the wizard and actually seemed to get what I needed setting the MACD to hist. However for some reason the Criteria I set up will give me the down alerts (Hist less then zero CCI5 > 100....but not the up alerts Hist greater then zero CCI5 <= to -100 //{{EFSWizard_Description
      //
      // This formula was generated by the Alert Wizard
      //
      //}}EFSWizard_Description 7532


      //{{EFSWizard_Declarations

      var vMACD12_26 = new MACDStudy(12, 26, 9, "Close", false);
      var vCCI5 = new CCIStudy(5, "Close");
      var vLastAlert = -1;

      //}}EFSWizard_Declarations 13516


      function preMain() {
      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      //{{EFSWizard_PreMain
      setPriceStudy(false);
      setStudyTitle("MACD");
      setCursorLabelName("MACD", 0);
      setDefaultBarStyle(PS_SOLID, 0);
      setDefaultBarFgColor(Color.red, 0);
      setDefaultBarThickness(1, 0);
      setPlotType(PLOTTYPE_LINE, 0);
      //}}EFSWizard_PreMain 28921

      }

      function main() {
      /**
      * The main() function is called once per bar on all previous bars, once per
      * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
      * in your preMain(), it is also called on every tick.
      */

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      if (
      vMACD12_26.getValue(MACDStudy.HIST) >= 0 &&
      vCCI5.getValue(CCIStudy.CCI) <= -100
      ) onAction1()
      //}}EFSWizard_Expression_1 14858

      //{{EFSWizard_Expression_2
      else if (
      vMACD12_26.getValue(MACDStudy.HIST) <= 0 &&
      vCCI5.getValue(CCIStudy.CCI) >= 100
      ) onAction2();
      //}}EFSWizard_Expression_2 17792

      //}}EFSWizard_Expressions 51631


      //{{EFSWizard_Return
      return vCCI5.getValue(CCIStudy.CCI);
      //}}EFSWizard_Return 4858

      }

      function postMain() {
      /**
      * The postMain() function is called only once, when the EFS is no longer used for
      * the current symbol (ie, symbol change, chart closing, or application shutdown).
      */
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      setBarFgColor(Color.RGB(0,255,0));
      Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Chime Down.wav");
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1 19797

      //{{EFSWizard_Action_2
      function onAction2() {
      setBarBgColor(Color.RGB(255,0,0));
      Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Chime Down.wav");
      vLastAlert = 2;
      }
      //}}EFSWizard_Action_2 18635

      //}}EFSWizard_Actions 58639


      Thanks MK

      Comment


      • #4
        Mark
        As far as I can see it is sounding an alert both ways. The only difference between the conditions is that in one you paint the bar foreground and in the other the background.
        That aside it appears to be working.
        Alex

        Comment


        • #5
          Reply

          Alex.....thanks...I missed the fact that I accidentally put that in the back ground...MK

          Comment

          Working...
          X