Announcement

Collapse
No announcement yet.

Thrust Oscillator. I need some help......

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

  • Thrust Oscillator. I need some help......

    I got the code from Stock and Commodities Magazine and I need help getting it to work. Here is the code as they have it:

    }

    var EMA_1 = 0.0;

    function main(Length)
    {
    if(Length == null)
    Length = 22
    var K = 2 / (Length + 1);
    var TO = 0;
    var EMA = 0;
    if( getValue("close","$adv") * getValue("volume","$ADV") +
    getValue("close","$DECL") * getValue("volume","$DECL")!=0)
    TO = (getValue("close","$ADV") *
    getValue("volume","$ADV") - getValue("close","$DECL") *
    getValue("volume","DECL")) / (getValue("close","$ADV") *
    getValue("volume","$ADV") + getValue("close","DECL") *
    getValue("volume","$DECL"));
    EMA = K * TO +(1-K) * EMA_1;
    if (getBarState() ==BARSTATE_NEWBAR)
    EMA_1 = EMA;


    return new Array(TO,EMA);
    }

    I have no prgramming experience so I don't know where to start. If someone could get this thing to work that would be great. Many thanks in advance.

    Dave

  • #2
    The recent S&C edition for July did not publish the entire formula. Please find the completed formula below as developed by TS Support.

    PHP Code:
    /***************************************************
    Description    : This Indicator plots the THRUST OSCILLATOR
    Provided By    : TS Support, LLC for eSignal
    ***************************************************/


    function preMain()
    {
        
    setStudyTitle("TO");
        
    setCursorLabelName("TO",0);
        
    setCursorLabelName("MA",1);
        
    setDefaultBarFgColor(Color.red,0);
        
    setDefaultBarFgColor(Color.blue,1);
    }

    var 
    EMA_1 0.0;

    function 
    main(Length)
    {
        if (
    Length == null)
            
    Length 22;
        var 
    / (Length 1);
        var 
    TO 0;
        var 
    EMA 0;
        if( 
    getValue("close","$ADV") * getValue("volume","$ADV") + getValue("close","$DECL") * getValue("volume","$DECL") != 0)
            
    TO = (getValue("close","$ADV") * getValue("volume","$ADV") - getValue("close","$DECL") * getValue("volume","$DECL")) / (getValue("close","$ADV") * getValue("volume","$ADV") + getValue("close","$DECL") * getValue("volume","$DECL"));
        
    EMA TO  + (K) * EMA_1;
        if (
    getBarState() == BARSTATE_NEWBAR)
            
    EMA_1 EMA;
        
        return new Array(
    TO,EMA);

    Attached Files
    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


    • #3
      Thanks Jason! I loaded the.......

      Jason,

      I loaded the attachment and tried it out but the study did not work. Is there something that I need to change on this end? Thanks for your help!!

      Dave

      Comment


      • #4
        Hello Dave,

        Are you using an intra-day interval?

        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


        • #5
          Thanks Jaosn, I got it too work Intra day. Is it possible to use it with a daily interval?

          Comment


          • #6
            Doesn't look like it. getValue("volume","$ADV") returns 0 on a daily interval, which causes the formula to flat line. There's no daily data on volume for $ADV.
            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