Announcement

Collapse
No announcement yet.

Please help EFS study crashes esignal

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

  • Please help EFS study crashes esignal

    Hello i'm relatively new to these forums although I've been using eSignal for some time.

    I've written an EFS indicator for charting, and my goal was to show a correlation (number displayed between 0 and 1) between individual stocks and an index (SP500) over the first hour of the last 20 opens.

    Please review my code, all comments and suggestions are welcome. TIA for the help. I'm wondering if my problems could be due to calling multiple symbols on multiple intervals for comparison? Or any other obvious errors you can spot

    PHP Code:
    function computeCorrelsSymbnDays ) {
    var 
    x,y;
    var 
    countspCashspFuturespIntspDivRatespDaysExpspFVFVfvDiffPercentfvMult 0;
    var 
    nTmpnTmp2=0;
    var 
    nTmpStr;
    spInt 0.074;
    spDivRate 2.03;
    spDaysLeft 90;
    var 
    symbDay sSymb ",D";
    var 
    symb5min sSymb ",5";
        for (
    x=1x=nDaysx++) {
            
    spCash close(-xsym("IN A0,D"));
            
    spFuture close(-xsym("ES U8,D"));
            
    spFV spCash*(+ (spInt spDivRate)*(spDaysExp/360));
            
    fvMult = (spFuture spCash*(spFV spCash))/spCash;
            
    FV close(-xsym(symbDay))*fvMult;
            
    fvDiffPercent = (open(-x+1sym(symbDay))-FV)/FV;
            if (
    Math.abs(fvDiffPercent) > 0.005 && Math.abs(fvDiffPercent) < 0.015) {
                if (
    fvDiffPercent 0) {
                    for (
    y=1y=12y++) {
                        
    count = -78*x+y;
                        if (
    high(countsym(symb5min)) > high(count-1sym(symb5min)) && low(countsym(symb5min)) > low(count-1sym(symb5min))) {
                            
    nTmp2 += 1;                        
                        }
                    }
                }
                if (
    fvDiffPercent 0) {
                    for (
    y=1y=12y++) {
                        
    count = -78*x+y;
                        if (
    high(countsym(symb5min)) < high(count-1sym(symb5min)) && low(countsym(symb5min)) < low(count-1sym(symb5min))) {
                            
    nTmp2 += 1;
                        }
                    }
                }                
                if (
    nTmp2 10)
                    
    nTmp += 1;
                if (
    nTmp == 0)
                    
    nTmpStr == "NotWithin";
            }
        }
        
    nTmp /= nDays;
        return( 
    nTmp );

    Thanx for your help

  • #2
    Hello redphone,

    The crash is occurring because your for loops have a syntax error.

    for (x=1; x=nDays; x++) {

    Should be:

    for (x=1; x==nDays; x++) {

    And,

    for (y=1; y=12; y++) {

    Should be:

    for (y=1; y==12; y++) {
    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
      Excellent ty for the help and for fixing my post as well, i'll know to quote it PHP in the future.

      I'll try that out right away.

      Comment

      Working...
      X