Announcement

Collapse
No announcement yet.

MAofROC.efs

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

  • MAofROC.efs

    File Name: MAofROC.efs

    Description:
    Moving Average of Rate of Change oscillator.

    Formula Parameters:
    rocLength: Default is 21

    rocPriceSource: Default is “Close”
    valid inputs: Open, High, Low, Close, HL/2, HLC/3 and OHLC/4

    Notes:


    Download File:
    MAofROC.efs




    EFS Code:
    PHP Code:
    /*********************************
    Provided By : eSignal. (c) Copyright 2003
    *********************************/


    function preMain() {
        
    setStudyTitle("Moving Average of ROC");
        
    setCursorLabelName("MA"0);
        
    setCursorLabelName("ROC"1);
        
    setDefaultBarFgColor(Color.red0);
        
    setDefaultBarFgColor(Color.blue1);
        
    setPlotType(PLOTTYPE_HISTOGRAM1);
        
    setDefaultBarThickness(31);
    }

    var 
    MAstudy null;
    var 
    ROCstudy null;

    function 
    main(rocLengthrocPriceSourcemaLengthmaOffsetmaType) {
        if (
    MAstudy == null || ROCstudy == null) {
            
    //check for valid inputs
            
    if (rocLength == null)
                
    rocLength 21;
            if (
    rocPriceSource == null) {
                
    rocPriceSource "Close";
            } else if(
    rocPriceSource == "C" || rocPriceSource == "O" || rocPriceSource == "H" || rocPriceSource == "L") {
                
    rocPriceSource rocPriceSource;
            } else if(
    rocPriceSource == "Close" || rocPriceSource == "Open" || rocPriceSource == "High" || rocPriceSource == "Low") {
                
    rocPriceSource rocPriceSource;
            } else if(
    rocPriceSource == "HL/2" || rocPriceSource == "HLC/3" || rocPriceSource == "OHLC/4") {
                
    rocPriceSource rocPriceSource;
            } else {
                
    rocPriceSource "Close";
            }
            
    ROCstudy = new ROCStudy(rocLengthrocPriceSource);

            if (
    maLength == null)
                
    maLength 18;
            if (
    maOffset == null) {
                
    maOffset 0;
            } else {
                
    maOffset Math.round(maOffset);
            }
            if (
    maType == null) {
                
    maType "MAStudy.SIMPLE";
            } else if(
    maType == "MAStudy.EXPONENTIAL" || maType == "MAStudy.SIMPLE" || maType == "MAStudy.WEIGHTED" || maType == "MAStudy.VOLUMEWEIGHTED") {
                
    maType maType;
            } else {
                
    maType "MAStudy.SIMPLE";
            }
            
    MAstudy = new MAStudy(maLengthmaOffsetROCstudyROCStudy.ROC, eval(maType));
        }
        
        var 
    vMA MAstudy.getValue(MAStudy.MA);
        var 
    vROC ROCstudy.getValue(ROCStudy.ROC);
        return new Array (
    vMAvROC);

    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