Announcement

Collapse
No announcement yet.

Using Built-In Studies ON Custom Studies

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

  • Using Built-In Studies ON Custom Studies

    I know efs can handle studies on studies .... but I get the impression it can only do that if both studies are 'built-in' type studies. For example, recently this thread showed an example of a MA on a Mom study.

    What I'm trying to do is get a ExpMA of a custom study value. Say I'm trying to get a ExpMa of a 'custom' formula that looks something like:
    CustomFormula = Close() +Highest(17)-Lowest(16);
    where Highest and Lowest are also functions returning a value based on their logic.

    Maybe ingore the fact that CustomFomula is comprised on functions itself ... I'm basically wondering if I can call a built-in study on something other than Open, High, Low, Close, etc ... and something other than another built-in study.

    Thanks so much.
    beaker

  • #2
    Hello beaker,

    To answer your question, no, you can't use a custom input as the price source for the built-in study objects. You can get the result you need but it has to be coded manually. There is a help example of how to code the EMA calculation in our EFS Library (EMAcalc.efs). Store your custom values in an array and pass it to the EMA() function. Also, you'll need to change the "close()" portion of the return statement inside function EMA() to "vCustom." Your main() function will look something like this:

    PHP Code:
    var CustomArray = new Array(10);

    function 
    main() {
        if (
    getBarState() == BARSTATE_NEWBAR && vCustom != null) {
            
    //  removes last array item
            
    CustomArray.pop();
      
            
    // inserts most recent value to the front to maintain a length of 10
            
    CustomArray.unshift(vCustom);   
        }
        
        
    // do calc for "Highest(17)"
        // do calc for "Lowest(16)"
        
        
    vCustom close() + (vHH vLL);
        if (
    vCustom == null) return;
        
    CustomArray[0] = vCustom;
        
        if (
    CustomArray[9] != null) {
            
    vEMA EMA(10CustomArray);
        }
        
        return 
    vEMA;

    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

    Working...
    X