Announcement

Collapse
No announcement yet.

Help? Converting TdStation indicator to esignal

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

  • Help? Converting TdStation indicator to esignal

    Here's the TS formula for ElderRayAverage

    BullPower Average(High - Average(Price,Length),6)
    BearPower Average(Low - Average(Price,Length),6)
    Plot3 2
    Plot4 -2

    Price Close
    Length 20


    Does anyone know how to write this indicator using esignals programming language?

    Thanks.

  • #2
    esignal would be something like...

    vHavg=study.MAstudy(High() - study.MAstudy(close(),20),6)

    vLavg=study.MAstudy(Low() - study.MAstudy(close(),20),6)

    maybe someone else could figure out the rest of the efs

    Comment


    • #3
      Here you go...

      I hope this is what you want. I have also uploaded it into my eSignal file share group - Matheny Enterprises


      PHP Code:
      /*******************************************************************
      Description    : Elder Ray Average
      Provided By    : Developed by Matheny Enterprises. (c) Copyright 2003 
      ********************************************************************/
      var vMovAvg null;

      function 
      preMain()
      {
          
      setStudyTitle("ElderRayAvg"); 
          
      setCursorLabelName("Bull"0);
          
      setDefaultBarFgColor(Color.red0);
          
      setCursorLabelName("Bear"1);
          
      setDefaultBarFgColor(Color.blue1);
          
        
      /* Add Bands to appear in the study window */
        
      addBand(0.09PS_SOLID1Color.RGB(0,0,0));


      function 
      main(MALengthMAPrice)
      {
        if (
      MALength == null) {MALength 20;}
        if (
      MAPrice == null) {MAPrice 4;}
       
        if ((
      MAPrice == 1) && (vMovAvg == null)) {  //  Simple MA Open
          
      vMovAvg = new MAStudy(MALength0"Open"MAStudy.SIMPLE);
        }
        if ((
      MAPrice == 2) && (vMovAvg == null)) {  //  Simple MA Open
          
      vMovAvg = new MAStudy(MALength0"High"MAStudy.SIMPLE);
        }
        if ((
      MAPrice == 3) && (vMovAvg == null)) {  //  Simple MA Open
          
      vMovAvg = new MAStudy(MALength0"Low"MAStudy.SIMPLE);
        }
        if ((
      MAPrice == 4) && (vMovAvg == null)) {  //  Simple MA Open
          
      vMovAvg = new MAStudy(MALength0"Close"MAStudy.SIMPLE);
        }

          var 
      i;
                  var 
      BullSum 0;
                  var 
      BearSum 0;
                  for (
      06; ++i) {
                      
      BullSum += (high(0-i)-vMovAvg.getValue(MAStudy.MA,0-i-1));
                      
      BearSum += (low(0-i)-vMovAvg.getValue(MAStudy.MA,0-i-1));
                  }

        return new Array((
      BullSum/6), (BearSum/6));

      Brad Matheny
      eSignal Solution Provider since 2000

      Comment

      Working...
      X