Announcement

Collapse
No announcement yet.

Does this create a series?

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

  • Does this create a series?

    Does this create a series?



    PHP Code:
        if(bInit==false){
            if(
    Symbol == null || Symbol == undefined Symbol getSymbol();

     
              
    xAvgr1c1  = eval( iParm01 );
              
    xAvgr1c2  = eval( iParm02 );

            
    bInit=true; } 
    If not, what's the reason it doesn't and is there a way to make it create a series?

    THANKING YOU IN ADVANCE.

  • #2
    What's the reason this doesn't create a series or does it?

    What's the reason this doesn't create a series or does it?

    Am I missing something?

    PHP Code:

    function main () {

    // CREATE SERIES
     
    if(bInit == false) {

    var 
    xStudy efsInternal("fEval"iParm01 ) ;

        
    bInit true ; }


    zStudy =  xStudy.getValue(0) ;

    return (
    zStudy)  ; 
    }


    function 
    fEval(xFunction) {

    rEval = eval( xFunction) ;

    return( 
    rEval );

    Last edited by buzzhorton; 08-08-2006, 01:31 PM.

    Comment


    • #3
      Hello Avery,

      It could if the iParm variables contain strings that represent the correct syntax that would result in a series, such as "ema(10)".
      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


      • #4
        Thanks Jason.

        I figured this out in another thread.

        Step 1: pass the input parameter functions (iParm01, iParm02) as parameters to the main function.

        Step 2: call the internal function fEVAL to evaluate the input parameters.

        Step3: fEVAL runs eval to evaluate the input parameter functions and returns the value.

        This creates a series!

        All of the eSignal internal functions are available in the dropdown menu.

        You can use inv() and sym() in the functions - this gives you total flexibility and eliminates coding.

        If only I could pass a parameter to setPriceStudy!!

        In the screenshot, I am plotting mom(10) and mom(20)

        PHP Code:
        var xStudy2 null;
        var 
        xStudy1 null

        var 
        fpArray = new Array();


            var 
        x=0;
                
        fpArray[x] = new FunctionParameter("iParm01"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        addOption("accDist()");   
                
        addOption("adx(10,5)");  
                
        addOption("pdi(10,5)");
                
        addOption("ndi(10,5)");
                
        addOption("cci(10)");
                
        addOption("chop(10)");
                
        addOption("ema(10)");
                
        addOption("sma(10)");
                
        addOption("wma(10)");
                
        addOption("hhv( 50, high() )");
                
        addOption("hl2()");    
                
        addOption("hl3()");  
                
        addOption("ohlc4() ");
                
        addOption("llv( 50, low() )");
                
        addOption("macd( 12, 26, 9 )");  
                
        addOption("macdSignal( 12, 26, 9 )");  
                
        addOption("macdHist( 12, 26, 9 )");  
                
        addOption("upperBB( 20, 2 )");  
                
        addOption("middleBB( 20, 2 )");  
                
        addOption("lowerBB( 20, 2 )");  
                
        addOption("upperDonchian( 20 )");  
                
        addOption("middleDonchian( 20 )");  
                
        addOption("lowerDonchian( 20 )");  
                
        addOption("upperEnv( 20, false, 10 )");  
                
        addOption("middleEnv( 20, false, 10 )");  
                
        addOption("upperEnv( 20, false, 10 )");  
                
        addOption("upperLinearReg( 20, 2 ) ");  
                
        addOption("middleLinearReg( 20, 2 ) ");  
                
        addOption("lowerLinearReg( 20, 2 ) "); 
                
        addOption("midpoint( 50, close() )");  
                
        addOption("moneyFlow( 20 )");
                
        addOption("mom( 20 ) ");
                
        addOption("oi(0)");
                
        addOption("osc( 10, 21, false )");
                
        addOption("percentR( 10 )");
                
        addOption("roc( 20 )");
                
        addOption("rsi( 14 )");
                
        addOption("sar( 0.02, 0.02, 0.2 )");
                
        addOption("stochK( 14, 1, 3 )");
                
        addOption("stochD( 14, 1, 3 ) ");
                
        addOption("volume(0)");
                
        setDefault("close(0)"  );
            }
            
        fpArray[x] = new FunctionParameter("iParm02"FunctionParameter.STRING);
            
        with(fpArray[x++]){
                
        addOption("accDist()");   
                
        addOption("adx(10,5)");  
                
        addOption("pdi(10,5)");
                
        addOption("ndi(10,5)");
                
        addOption("cci(10)");
                
        addOption("chop(10)");
                
        addOption("ema(10)");
                
        addOption("sma(10)");
                
        addOption("wma(10)");
                
        addOption("hhv( 50, high() )");
                
        addOption("hl2()");    
                
        addOption("hl3()");  
                
        addOption("ohlc4() ");
                
        addOption("llv( 50, low() )");
                
        addOption("macd( 12, 26, 9 )");  
                
        addOption("macdSignal( 12, 26, 9 )");  
                
        addOption("macdHist( 12, 26, 9 )");  
                
        addOption("upperBB( 20, 2 )");  
                
        addOption("middleBB( 20, 2 )");  
                
        addOption("lowerBB( 20, 2 )");  
                
        addOption("upperDonchian( 20 )");  
                
        addOption("middleDonchian( 20 )");  
                
        addOption("lowerDonchian( 20 )");  
                
        addOption("upperEnv( 20, false, 10 )");  
                
        addOption("middleEnv( 20, false, 10 )");  
                
        addOption("upperEnv( 20, false, 10 )");  
                
        addOption("upperLinearReg( 20, 2 ) ");  
                
        addOption("middleLinearReg( 20, 2 ) ");  
                
        addOption("lowerLinearReg( 20, 2 ) "); 
                
        addOption("midpoint( 50, close() )");  
                
        addOption("moneyFlow( 20 )");
                
        addOption("mom( 20 ) ");
                
        addOption("oi(0)");
                
        addOption("osc( 10, 21, false )");
                
        addOption("percentR( 10 )");
                
        addOption("roc( 20 )");
                
        addOption("rsi( 14 )");
                
        addOption("sar( 0.02, 0.02, 0.2 )");
                
        addOption("stochK( 14, 1, 3 )");
                
        addOption("stochD( 14, 1, 3 ) ");
                
        addOption("volume(0)");
                
        setDefault("ema(20)"  );
            }

        var 
        bInit false

        function 
        preMain(){
            
        setPriceStudy(false);
            
        setStudyTitle("TRO_Eval");
        }

        askForInput();

        function 
        main(  iParm01iParm02 ){

            if ( 
        bInit == false ) { 
                
           
        xStudy2 efsInternal"fEVAL"iParm02 ); 

           
        xStudy1  efsInternal"fEVAL"iParm01  ); 
         
           
        bInit true

           } 

            
        setCursorLabelName(iParm010);
            
        setCursorLabelName(iParm021);

             
        setBarFgColor(Color.red0);
             
        setBarFgColor(Color.green1);

            return new Array( 
        xStudy1.getValue(0)  , xStudy2.getValue(0)   );
        }

        function 
        fEVALx) { 
           return( eval(
        x) ); 

        Attached Files

        Comment

        Working...
        X