Announcement

Collapse
No announcement yet.

Symbol with Ma as NPS

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

  • Symbol with Ma as NPS

    I have been using the SymbolCompareasNPS efs to plot other symbols as indicators. However I would like to add a moving average to it.

    Searching around I have found the RelativeStrengthratiowithMA is virtually identical to what I want. The only problem with using that one is that I don't want to compare the symbol with the symbol in the Price window. Thus it would seem that all I have to do is remove the divide by function and tweak the code that does the Title and Cursor label.

    However, I can't seem to get it to work.

    If anyone can point me in the right direction it would be most appreciated.

    Here is the forum with the starting code



    Thanks,

    bigtee

  • #2
    bigtee,

    I'm working on this now... what did you want the default MA Length to be?
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Re: Reply to post 'Symbol with Ma as NPS'

      20 periods is fine

      ----- Original Message -----
      From: <[email protected]>
      To: <[email protected]>
      Sent: Friday, June 13, 2003 1:29 PM
      Subject: Reply to post 'Symbol with Ma as NPS'


      > Hello bigtee,
      >
      > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      >

      Comment


      • #4
        This seems to do the trick. Enjoy!

        PHP Code:
        /************************
        Copyright © eSignal, 2003
        *************************/

        var vLoaded false;
        var 
        cSym "";
        var 
        vSym null;
        var 
        vMAArray = new Array();

        function 
        preMain() {
            if (
        vLoaded == false) {    
                
        setStudyTitle(" ... Add Symbol");
                
        setCursorLabelName("Add Symbol");
                
        setDefaultBarFgColor(Color.blue,0);
                
        setDefaultBarFgColor(Color.red,1);
            } else {
                if (
        vSym != null) {
                    
        setStudyTitle(cSym " vs. ");
                    
        setCursorLabelName(vSym,0);
                    
        setCursorLabelName("MA of "+vSym,1);
                } else {
                    
        setStudyTitle(" ... Add Symbol");        
                    
        setCursorLabelName("Add Symbol");
                }
            }
        }

        function 
        main(Symbol1,nMALength) {
            if (
        vLoaded == false) {
                
        cSym getSymbol();
                
                if (
        Symbol1 == null) {
                    
        vSym null;
                } else {
                    
        vSym Symbol1;
                }
                
        vLoaded true;
                
                
        preMain();
            }

            if (
        nMALength == null) {
                
        nMALength 20;
            } else {
                
        nMALength Math.round(nMALength);
            }

            if (
        vSym != null) {
                var 
        close(vSym);

                var 
        nBarState getBarState();
            
                if (
        nBarState == BARSTATE_NEWBARvMAArray.unshift(b);   //inserts array element to the front of the array
            
                
        vMAArray[0] = b;

                if (
        vMAArray[nMALength-1] != null) {
                
                    var 
        vSum 0;
                
                    for (
        i=0<= nMALength-1i++) {
                        
        vSum += vMAArray[i];
                    }
                    
                    var 
        vMA vSum nMALength;
                    
                }
                
                return new Array (
        b,vMA);
                
            } else {
                return;
            }

        Attached Files
        Regards,
        Jay F.
        Product Manager
        _____________________________________
        Have a suggestion to improve our products?
        Click Support --> Request a Feature in eSignal 11

        Comment


        • #5
          Re: Reply to post 'Symbol with Ma as NPS'

          JayF, thanks. It works

          Now, a couple questions.

          1. Why did you choose to eliminate the Average subroutine and just calculate
          directly?

          2. Just for grins and my learning experience, tell me in words what I would
          do to add a second Ma?

          3. A suggestion for you and the EFS Learning Center. How about putting a
          lesson in there on how to add an Ma to another indicator? Much like this
          one. It seems it requires changing to an array and doing other things that
          are not quite so simple. If the lesson were heavily commented it might help
          a lot of folks.

          bigtee
          ----- Original Message -----
          From: <[email protected]>
          To: <[email protected]>
          Sent: Friday, June 13, 2003 1:49 PM
          Subject: Reply to post 'Symbol with Ma as NPS'


          > Hello bigtee,
          >
          > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          >

          Comment

          Working...
          X