Announcement

Collapse
No announcement yet.

MACD from another timeframe

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

  • MACD from another timeframe

    I am trying to create an indicator that will plot a 30 minute MACD under a 5 minute chart. Is the code below correct? I am only able to plot MACD, and not the signal.

    function main(){
    var ema12_30 = ema(12, inv(30));
    var ema26_30 = ema(26, inv(30));
    var macd_30 = ema12_30 - ema26_30;
    var sig_30 = ema(9, macd_30(inv(30)));

    return new Array(macd_30, sig_30);
    }


    thanks,
    Jeremy

  • #2
    Jeremy
    See this thread for a reply to a similar question [the difference being that you are subtracting one series from another instead of dividing them].
    You may also want to look at the dsFunctions library which I mention in that thread as it contains a function called dsDiffSeries which subtracts one series from another and returns a series.
    FWIW in the EFS2 Custom folder in Formulas you already have a MACD study (ie customMACD.efs) that is enabled for use with multiple intervals and/or external symbols
    Alex

    Comment

    Working...
    X