Announcement

Collapse
No announcement yet.

MaofMom

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

  • MaofMom

    buongiorno

    utilizzando l'efs che riporto sotto su 11.2 ottengo questo risultato




    qualcuno sa dirmi che cosa non va per piacere?

    grazie


    Alexis C. Montenegro © December 2004
    Use and/or modify this code freely. If you redistribute it
    please include this and/or any other comment blocks and a
    description of any changes you make.
    ************************************************** ********/

    var fpArray = new Array();

    function preMain() {
    setStudyTitle("MAofMOM");
    setCursorLabelName("MOM", 0);
    setCursorLabelName("MAofMOM", 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarThickness(1,0);
    setDefaultBarThickness(1,1);
    var x=0;
    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setLowerLimit(1);
    setDefault(10);
    }
    fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
    with(fpArray[x++]){
    addOption("open");
    addOption("high");
    addOption("low");
    addOption("close");
    addOption("hl2");
    addOption("hlc3");
    addOption("ohlc4");
    setDefault("close");
    }
    fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
    with(fpArray[x++]){
    setDefault();
    }
    fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
    with(fpArray[x++]){
    setDefault();
    }
    fpArray[x] = new FunctionParameter("MAType", FunctionParameter.STRING);
    with(fpArray[x++]){
    addOption("sma");
    addOption("ema");
    addOption("wma");
    setDefault("sma");
    }
    fpArray[x] = new FunctionParameter("MALength", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setLowerLimit(1);
    setDefault(10);
    }
    fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Color1");
    setDefault(Color.blue);
    }
    fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Color2");
    setDefault(Color.red);
    }
    fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
    with(fpArray[x++]){
    setName("Show Parameters");
    setDefault(false);
    }
    }

    var bInit = false;
    var xMOM = null;
    var xMAofMOM = null;

    function main(Length,Source,Symbol,Interval,MAType,MALength ,LineColor1,LineColor2,Params) {
    if(bInit == false){
    if(Symbol == null) Symbol = getSymbol();
    if(Interval == null) Interval = getInterval();
    var vSymbol = Symbol+","+Interval;
    xMOM = getSeries(mom(Length,eval(Source)(sym(vSymbol))));
    xMAofMOM = getSeries(eval(MAType)(MALength,mom(Length,eval(So urce)(sym(vSymbol)))));
    setDefaultBarFgColor(LineColor1,0);
    setDefaultBarFgColor(LineColor2,1);
    setShowTitleParameters(eval(Params));
    bInit = true;
    }
    return new Array (xMOM,xMAofMOM);
    }
    Last edited by brigitrader; 04-21-2011, 04:13 AM.
Working...
X