Announcement

Collapse
No announcement yet.

EMA Indicator

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

  • EMA Indicator

    I want to use current price bar's high minus a 13-bar EMA of closing prices and plot it as a green bar.

    In Metastock the formula is (H-Mov(C,13,E)/1.

    This is my first attempt at writting an EFS Indicator

    Thanks
    Mike
    Last edited by mstuhr; 06-19-2008, 04:31 PM.

  • #2
    Mike,

    It should be something like this, please let me know how it works.

    PHP Code:


    var fpArray = new Array();

    function 
    preMain() {

        
    setPriceStudy(false);
        
    setStudyTitle("Hight and 13 EMA");
        
    setCursorLabelName("H13EMA",0);
        
    setDefaultBarFgColor(Color.lime,0);
        
    setPlotType(PLOTTYPE_HISTOGRAM,0); 
        
    setDefaultBarThickness(1,0);
        
    askForInput();
        
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("Length_EMA"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setLowerLimit(1);        
            
    setDefault(13);
        }
       
    }

    function 
    main(Length_EMA) {

       return 
    high(0) - ema(Length_EMA);
        

    EMET

    Comment

    Working...
    X