Announcement

Collapse
No announcement yet.

PassInputsToStudy.efs

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PassInputsToStudy.efs

    File Name: PassInputsToStudy.efs

    Description:
    This help formula outlines a method for passing user inputs from the “Edit Studies” option to change the parameters of a Moving Average study.

    Formula Parameters:
    Input Parameter: Default value

    nLength: 21

    nOffset: 0

    nPriceSorce: C
    valid iputs: O, H, L and C

    nType: MAStudy.SIMPLE
    valid inputs: MAStudy.SIMPLE, MAStudy.EXPONENTIAL,
    MAStudy.WEIGHTED and MAStudy.VOLUMEWEIGHTED

    Notes:

    Download File:
    PassInputsToStudy.efs



    EFS Code:
    PHP Code:
    /*******************************
    Provided By : eSignal. (c) Copyright 2003
    *******************************/
    function preMain() {
        
    setPriceStudy(true);
    }

    var 
    study null;

    function 
    main(nLengthnOffsetnPriceSourcenType) {
        if (
    study == null) {
            
    //check for valid inputs
            
    if (nLength == null)
                
    nLength 21;
            if (
    nOffset == null) {
                
    nOffset 0;
            } else {
                
    nOffset Math.round(nOffset);
            }
            if (
    nPriceSource == null) {
                
    nPriceSource "C";
            } else if(
    nPriceSource == "C" || nPriceSource == "O" || nPriceSource == "H" || nPriceSource == "L") {
                
    nPriceSource nPriceSource;
            } else {
                
    nPriceSource "C";
            }
            if (
    nType == null) {
                
    nType "MAStudy.SIMPLE";
            } else if(
    nType == "MAStudy.EXPONENTIAL" || nType == "MAStudy.SIMPLE" || nType == "MAStudy.WEIGHTED" || nType == "MAStudy.VOLUMEWEIGHTED") {
                
    nType nType;
            } else {
                
    nType "MAStudy.SIMPLE";
            }
            
    study = new MAStudy(nLengthnOffsetnPriceSource, eval(nType));
        }
        
        var 
    vValue study.getValue(MAStudy.MA);
        if (
    vValue == null)
            return;
        
        return 
    vValue;

    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
Working...
X