Announcement

Collapse
No announcement yet.

MACD MTF Indicator

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

  • MACD MTF Indicator

    I am trying to create a MTF MACD indicator, and to start with I've defined the following variables:

    var vMACD_15 =macd(12, 26, 9, "Close", false, inv(5));
    var vMACD_S_15 =macdSignal(12, 26, 9, "Close", false, inv(5));
    var vMACD_60 =macd(12, 26, 9, "Close", false, inv(15));
    var vMACD_S_60 =macdSignal(12, 26, 9, "Close", false, inv(15));

    But when I goto plot the signal to verify its working, it only Displays the time frame that I am on...

    So that leads to my question... Is it possible to build a MACD study that will look at Multiple Time Frames?

  • #2
    Re: MACD MTF Indicator

    cv989
    The reason your calls to those functions are not working when passing external intervals is that you have the incorrect syntax.
    For the syntax and examples on the use of the MACD functions see this article in the EFS KnowledgeBase
    Also FWIW you already have a complete working example of a MACD study that is enabled for external symbols and/or intervals in the EFS2 Custom folder of Formulas which is in your eSignal directory
    Alex


    Originally posted by cv989
    I am trying to create a MTF MACD indicator, and to start with I've defined the following variables:

    var vMACD_15 =macd(12, 26, 9, "Close", false, inv(5));
    var vMACD_S_15 =macdSignal(12, 26, 9, "Close", false, inv(5));
    var vMACD_60 =macd(12, 26, 9, "Close", false, inv(15));
    var vMACD_S_60 =macdSignal(12, 26, 9, "Close", false, inv(15));

    But when I goto plot the signal to verify its working, it only Displays the time frame that I am on...

    So that leads to my question... Is it possible to build a MACD study that will look at Multiple Time Frames?

    Comment


    • #3
      thanks for the response, I was able to get it to work!

      One question though.. Here is part of my EFS:
      var vMACD_15 =macd(12, 26, 9, inv(15));
      var vMACD_S_15 =macdSignal(12, 26, 9, inv(15));
      var vMACD_60 =macd(12, 26, 9, inv(60));
      var vMACD_S_60 =macdSignal(12, 26, 9, inv(60));


      if (
      vMACD_15.getValue(macd) > vMACD_S_15.getValue(macdSignal) &&
      vMACD_60.getValue(macd) > vMACD_S_60.getValue(macdSignal)
      ) onAction1()

      else if (
      vMACD_15.getValue(macd) < vMACD_S_15.getValue(macdSignal) &&
      vMACD_60.getValue(macd) < vMACD_S_60.getValue(macdSignal)
      ) onAction2();

      And what I can't figure out is how would I write this so that If the 60 is still Greater or Less than to keep the color.

      What it is doing is only coloring if BOTH, are in the same direction.

      I am sorry my EFS skills aren't that good, but I am still learning..
      Attached Files
      Last edited by cv989; 10-01-2010, 07:17 AM.

      Comment


      • #4
        cv989
        The syntax used in your conditions to retrieve the values of those series [eg vMACD_15.getValue(macd)] is incorrect. The value inside the brackets should be the index of the bar whose values you want to retrieve ie 0, -1, etc
        Again you may want to review the examples provided in the article I linked in my previous reply
        Alex


        Originally posted by cv989
        thanks for the response, I was able to get it to work!

        One question though.. Here is part of my EFS:
        var vMACD_15 =macd(12, 26, 9, inv(15));
        var vMACD_S_15 =macdSignal(12, 26, 9, inv(15));
        var vMACD_60 =macd(12, 26, 9, inv(60));
        var vMACD_S_60 =macdSignal(12, 26, 9, inv(60));


        if (
        vMACD_15.getValue(macd) > vMACD_S_15.getValue(macdSignal) &&
        vMACD_60.getValue(macd) > vMACD_S_60.getValue(macdSignal)
        ) onAction1()

        else if (
        vMACD_15.getValue(macd) < vMACD_S_15.getValue(macdSignal) &&
        vMACD_60.getValue(macd) < vMACD_S_60.getValue(macdSignal)
        ) onAction2();

        And what I can't figure out is how would I write this so that If the 60 is still Greater or Less than to keep the color.

        What it is doing is only coloring if BOTH, are in the same direction.

        I am sorry my EFS skills aren't that good, but I am still learning..

        Comment

        Working...
        X