Announcement

Collapse
No announcement yet.

Narural Log spread

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

  • Narural Log spread

    Hi, I am not familiar with EFS, but could someone point out a EFS Study that takes the natural log of one symbol by another: LN (6E M0/6A M0).
    I have gone through all the spread overlay but nothing like this.
    Thank you

  • #2
    Hi ectrader,

    I'm not a mathematician nor an expert efs programer but try this.
    The efs is also attached.

    PHP Code:
    debugClear();
    function 
    main(){
        
    vLog efsInternal("getLog");
        return 
    vLog;
    }
    function 
    getLog() {
        var 
    C6E close(0,sym("6E #F"));
        var 
    C6A close(0,sym("6A #F"));
        var 
    xDiv C6E/C6A;
        return 
    Math.log(xDiv);

    Note definition of -Math.log(x)- "Returns the natural logarithm (base E) of a number."

    Wayne
    Attached Files
    Last edited by waynecd; 04-01-2010, 11:09 AM.

    Comment


    • #3
      Thank you very much Wayne!!!

      Comment


      • #4
        Hi Wayne,
        just one last questions. If i wanted to see an RSI on this Log spread, would I be able to simply replace the 'close' on the RSI function by 'geLog'?
        Thanks and apologies for asking such basic coding queries....

        Comment


        • #5
          Here is an efs that gives you the menu choice of plotting either the Log or the RSI of the Log. Plotting them both at the same time doesn't work because the RSI is orders of magnitude less than the Log so it appears as a horizontal line at the bottom of the study pane.

          If you want to see them both, each in it's own pane then load the study twice and select "Log" for one pane and "RSI of Log" for the other.

          Wayne

          PHP Code:
          debugClear();
          var 
          aFPArray = new Array();
          function 
          preMain() {
              
          setPriceStudy(false);
              var 
          x=0;
              
          aFPArray[x] = new FunctionParameter"Display_What"FunctionParameter.STRING); 
              
          withaFPArray[x++] ) { 
                  
          setName"Display What" ); 
                  
          addOption"Log" ); 
                  
          addOption"RSI of Log" ); 
                  
          setDefault"RSI of Log" ); 
              }   
          }
          var 
          bInit false;
          var 
          vLog null;
          var 
          vRSI null;

          function 
          main(Display_What){
              if(
          bInit == false){
                  
          vLog efsInternal("getLog");
                  
          vRSI rsi(14,vLog);
              }
              
          //uncomment the next line if you want to see generated values in the -Formula Output- window
              //debugPrintln("vRSI = "+vRSI.getValue(0)+" - vLog = "+vLog);
              
          if(Display_What == "Log") return vLog;
              else if(
          Display_What == "RSI of Log") return vRSI;
          }
          function 
          getLog() {
              var 
          C6E close(0,sym("6E #F"));
              var 
          C6A close(0,sym("6A #F"));
              var 
          xDiv C6E/C6A;
              return 
          Math.log(xDiv);
          }
          /*
          debugPrint() output
          vRSI = 44.193056814580615 - vLog = 0.3979090438410414
          vRSI = 44.10791466967953 - vLog = 0.3977994247672128
          vRSI = 44.10791466967953 - vLog = 0.3977994247672128
          vRSI = 44.10791466967953 - vLog = 0.3977994247672128*/ 
          Attached Files

          Comment


          • #6
            Wow, thanks a milion Wayne....very kind of you!

            Comment

            Working...
            X