Announcement

Collapse
No announcement yet.

new ema() function not same as old?

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

  • new ema() function not same as old?

    Hi again,

    Is it me with my double-fast bar replaying computer or is there some reason my charts plot these values differently?

    I notice the old style MA study matches the built-in study, but the new ema() function doesn't....


    Thanks!
    Attached Files
    Tex

  • #2
    Tex
    The syntax you are using for the ema() function is incorrect. It should be
    myStudy1 = ema(21,low());
    Alex

    Comment


    • #3
      As Always, you the best ALexis! It works now!

      (thought I tried that... hmmm...)

      THANKS!
      Tex

      Comment


      • #4
        Tex
        My pleasure and thank you for the compliment
        Alex

        Comment


        • #5
          Hate to bug you Alexis, but one more quicky?

          Seems I can't pass an integer variable to setBarxx functions?

          This works

          setBarThickness(5,0);

          This doesn't?

          myVar = 5;

          setBarThickness(myVar,0);

          Even adding myVar1 = myVar.toFixed(0); doesn't work.

          setBarThickness(myVar1,0);

          Is this true for all setBar functions or do I need to spec some specific kind of var to do this?

          I guess it's clear I wish to modify (for instance) bar thickness according to some parameter in my code; the alternative is to paint some object over each bar.


          Thanks!
          Tex

          Comment


          • #6
            Tex
            Seems to be working fine. See image below which is the result of the enclosed code
            Alex

            PHP Code:
            function main(){

                var 
            myVar 5;
                var 
            mySMA sma(5);
                
                if(
            close(0)>mySMA.getValue(0))
                    
            setBarThickness(myVar,0)
                    
                return 
            mySMA.getValue(0);

            Comment


            • #7
              Shortly after posting my last question, eSignal crashed. I started it, reset the Heap and Stack sizes to really high (16384) then restarted it again and now my code works.

              Sheeesh, sorry to bug you Alexis, but tons of thanks!
              Tex

              Comment


              • #8
                Okay, I'm a dummy or something is terribly wrong with my system.

                I figured this would work and it doesn't. It seems the same interval EMA is returned in all cases no matter the interval of the chart.

                I'm trying to have an ema that is always referenced to the Daily chart... so far, no joy.

                HELP!




                function preMain()
                {
                setPriceStudy(true);
                setCursorLabelName("EMA1", 0);
                setCursorLabelName("EMA2", 1);

                setDefaultBarFgColor(Color.red,0);
                setDefaultBarFgColor(Color.green,1);

                }

                var myStudy = null;
                var myStudy1 = null;

                var bInit = false;

                function main() {
                var myVar;
                var myVar1;

                if ( bInit == false ) {

                myStudy = ema(21,hl2());
                myStudy1 = ema(21,hl2(),inv("D"));
                bInit = true;

                }

                //retrieve the current value
                myVar = myStudy.getValue(0);
                myVar1 = myStudy1.getValue(0);

                return new Array( myVar, myVar1 );

                }
                Tex

                Comment


                • #9
                  Tex
                  The syntax you are using for the ema() function is incorrect.
                  myStudy1 should be ema(21,hl2(inv("D")));
                  Alex

                  Comment


                  • #10
                    What would the world do without you Alexis? God Bless!

                    And someone PLEASE fix the HELP files to show this stuff!

                    Thanks!

                    Tex

                    Comment

                    Working...
                    X