Announcement

Collapse
No announcement yet.

Dahl Trend Indicator

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

  • Dahl Trend Indicator

    In TC 2000 i have a formula of

    (avgc50-avgc50.15)

    This is Dahl's simple Trend Indicator. It takes the stock's 50 day simple moving average and compares it to 15 days ago. if it is positive then the trend is up; if it's negative then the trend is down.

    How would I get these values in esignal?

  • #2
    Hello jnorton,

    With EFS2 code in version 7.9, it looks like this;

    PHP Code:
    function main() {
        return 
    sma(50) - sma(50, -15);

    With EFS1 code in version 7.8 or earlier, it looks like below, which can also be used in 7.9.

    PHP Code:
    var study = new MAStudy(500"Close"MAStudy.SIMPLE);

    function 
    main() {
        var 
    vMA study.getValue(MAStudy.MA);
        var 
    vMA15 study.getValue(MAStudy.MA, -15);
        if (
    vMA == null || vMA15 == null) return;
        
        return 
    vMA vMA15;

    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X