Announcement

Collapse
No announcement yet.

EMA on Percent Change?

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

  • EMA on Percent Change?

    Can ESignal do this?

    Have a percent change or returns calculation like the code below:

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("PVT");
    setCursorLabelName("PVT");
    }

    var PVT = null;
    var PVT_1 = null;

    function main() {

    if(getBarState()==BARSTATE_NEWBAR){
    PVT_1 = PVT;
    }

    PVT = (((close()-close(-1))/close(-1))*100;


    return PVT;
    }

    Then call a EMA study, which is based on price, and have the an EMA of the PVT above based on n periods?

    Help is greatly appreciated, William

  • #2
    Re: EMA on Percent Change?

    William
    You can call another efs using the efsExternal() function which creates a series of the values returned by that efs which you can then use as the source for the ema() or any other function. For the description and syntax of the efsExternal() function see this article in the EFS KnowledgeBase.
    You may also want to review this and this thread which provide additional explanations and examples of the use of this function. If you also run a search using efsExternal* as the keyword you will find more examples.
    Alex


    Originally posted by WilliamV
    Can ESignal do this?

    Have a percent change or returns calculation like the code below:

    function preMain() {
    setPriceStudy(false);
    setStudyTitle("PVT");
    setCursorLabelName("PVT");
    }

    var PVT = null;
    var PVT_1 = null;

    function main() {

    if(getBarState()==BARSTATE_NEWBAR){
    PVT_1 = PVT;
    }

    PVT = (((close()-close(-1))/close(-1))*100;


    return PVT;
    }

    Then call a EMA study, which is based on price, and have the an EMA of the PVT above based on n periods?

    Help is greatly appreciated, William

    Comment


    • #3
      Extremely Helpful and the links on the money.

      Thank you very much Alexis for pointing the way.

      Comment


      • #4
        William
        You are most welcome and thank you for letting me know the links were helpful
        Alex


        Originally posted by WilliamV
        Extremely Helpful and the links on the money.

        Thank you very much Alexis for pointing the way.

        Comment

        Working...
        X