Announcement

Collapse
No announcement yet.

Question on Lines & Labels efs modification

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

  • Question on Lines & Labels efs modification

    I'm currently modifying the lines labels script. I am just adding a massive amount of S&R lines. Very simple see below. Now I'd have to make a separate script for each individual stock which I don't want to do (i.e lines&labels APPL.efs; lines&lablesSPY.efs; etc...) BUTTT Is there a way to add into the script to recognize what ticker symbol is loaded and then have it only read from that ticker symbols list of S&R lines in the script itself. Script recognizes stock & only reads from a select part of the script which has the list of S&R lines specific to that ticker.

    Example of what I am looking for: This would all be in one script. If i change from SPY to AAPL chart, Script will only loads the AAPL lines. If someone could point me in the right direction that be awesome.

    SPY
    // ADD BANDS
    addBand( 43, PS_SOLID, 1, Color.RGB(255,59,56), 90002 );
    addBand( 42.9, PS_SOLID, 1, Color.RGB(255,59,56), 90003 );
    addBand( 43.93, PS_SOLID, 1, Color.RGB(255,59,56), 90005 );
    addBand( 42.5, PS_SOLID, 1, Color.RGB(255,59,56), 90007 );
    addBand( 44.55, PS_SOLID, 1, Color.RGB(255,59,56), 90009 );

    AAPL
    //ADD BANDS
    addBand( 39.5, PS_SOLID, 1, Color.RGB(0,255,0), 80004 );
    addBand( 38.61, PS_SOLID, 1, Color.RGB(0,255,0), 80006 );
    addBand( 39.21, PS_SOLID, 1, Color.RGB(0,255,0), 80008 );
    addBand( 38.4, PS_SOLID, 1, Color.RGB(0,255,0), 80010 );

  • #2
    here is a quick way:
    PHP Code:
    //http://forum.esignal.com/showthread.php?39928-Question-on-Lines-amp-Labels-efs-modification
    function preMain(){
        
    setPriceStudy(true);
    }

    var 
    bInit=false;
    function 
    main(){
        if(!
    bInit){
            var 
    vSymbol=getSymbol();
            if(
    vSymbol.indexOf("SPY")== 0){
                 
    // ADD SPY BANDS
                 
    addBand220PS_SOLID2Color.RGB(255,59,56), 90002 );
                 
    addBand217PS_SOLID2Color.RGB(255,59,56), 90003 );
                 
    addBand214PS_SOLID2Color.RGB(255,59,56), 90005 );
                 
    addBand207.50PS_SOLID2Color.RGB(255,59,56), 90007 );
                 
    addBand204PS_SOLID2Color.RGB(255,59,56), 90009 );
            }else if(
    vSymbol.indexOf("AAPL")== 0){
                 
    //ADD AAPLBANDS
                 
    addBand140PS_SOLID2Color.RGB(0,255,0), 80004 );
                 
    addBand130PS_SOLID2Color.RGB(0,255,0), 80006 );
                 
    addBand125PS_SOLID2Color.RGB(0,255,0), 80008 );
                 
    addBand120PS_SOLID2Color.RGB(0,255,0), 80010 ); 
            }
            
    bInit=true;
        }

    wayne

    Comment


    • #3
      A little more complete efs is attached:

      Lines_n_Labels_setGBL_Array.efs

      Wayne
      Last edited by waynecd; 05-27-2015, 10:02 PM.

      Comment


      • #4
        fixed bug with "removeGlobalValue()"

        Lines_n_Labels_setGBL_Array.efs

        Wayne

        Comment


        • #5
          Modified lines labels script

          Both attachments above("Lines_n_Labels_setGBL_Array.efs") have a major bug so I WOULND'T USE THEM!

          Here I just added a symbol field to the original lines labels script.
          The second script is the same except that in the menu I added a separator between lines to make it easier to identify.

          LinesLabels_w_Symbol.efs
          LinesLabels_w_Symbol_Separator.efs

          wayne
          Last edited by waynecd; 05-29-2015, 10:41 AM.

          Comment


          • #6
            Decided to debug the buggy efs. FWIW here is a working copy:

            Lines_n_Labels_setGBL_Array_X6.efs

            Wayne

            Comment


            • #7
              Final version.

              Lines_n_Labels_setGBL_Array_X6.efs

              Wayne

              Comment


              • #8
                Just realized I posted the wrong study so here is the correct one.

                Lines_n_Labels_setGBL_Array_X8.efs

                Wayne
                Last edited by waynecd; 06-19-2015, 02:00 AM.

                Comment


                • #9
                  A few improvements.

                  Lines_n_Labels_setGBL_Array_X10.efs

                  Wayne

                  Comment

                  Working...
                  X