Announcement

Collapse
No announcement yet.

6-4 channel R/T

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

  • 6-4 channel R/T

    Is there a way to make this efs real time.
    It seems to give the signal a day late?
    Thanks for your time...Greg
    /************************************************** *******
    Alexis C. Montenegro © May 2003
    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.
    ************************************************** ********/

    /************************************************** *********************
    This script plots the 6/4 Moving Average Channel proposed by AdvancedGET
    The script will signal a setup bar by placing a blue or red dot at the
    high or low of the setup bar and writing the entry price and suggested
    stop for the trade. An alert will also be generated
    ************************************************** **********************/

    var vMA1 = null;
    var vMA2 = null;
    var vLastAlert = -1;

    function preMain() {

    setPriceStudy(true);
    setStudyTitle("GET 6-4 channel");
    setCursorLabelName("6/4H", 0);
    setCursorLabelName("6/4L", 1);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarStyle(PS_SOLID, 1);
    setDefaultBarFgColor(Color.blue, 0);
    setDefaultBarFgColor(Color.red, 1);
    setDefaultBarThickness(1, 0);
    setDefaultBarThickness(1, 1);
    setPlotType(PLOTTYPE_LINE, 0);
    setPlotType(PLOTTYPE_LINE, 1);
    setDefaultPriceBarColor(Color.black);
    setComputeOnClose();
    checkVersion(2,"http://share.esignal.com/ContentRoot/ACM%20Test/Formulas/GET6-4channel.efs"); //Comment this line out if modifying the code

    var fp1 = new FunctionParameter("MA1Length", FunctionParameter.NUMBER);
    fp1.setLowerLimit(1);
    fp1.setDefault(6); //Edit this value to set a new default

    var fp2 = new FunctionParameter("MA1Offset", FunctionParameter.NUMBER);
    fp2.setLowerLimit(0);
    fp2.setDefault(4); //Edit this value to set a new default

    var fp3 = new FunctionParameter("MA1Source", FunctionParameter.STRING);
    fp3.setName("MA1Source");
    fp3.addOption("Close");
    fp3.addOption("High");
    fp3.addOption("Low");
    fp3.addOption("HL/2");
    fp3.addOption("HLC/3");
    fp3.setDefault("High"); //Edit this value to set a new default

    var fp4 = new FunctionParameter("MA2Length", FunctionParameter.NUMBER);
    fp4.setLowerLimit(1);
    fp4.setDefault(6); //Edit this value to set a new default

    var fp5 = new FunctionParameter("MA2Offset", FunctionParameter.NUMBER);
    fp5.setLowerLimit(0);
    fp5.setDefault(4); //Edit this value to set a new default

    var fp6 = new FunctionParameter("MA2Source", FunctionParameter.STRING);
    fp6.setName("MA1Source");
    fp6.addOption("Close");
    fp6.addOption("High");
    fp6.addOption("Low");
    fp6.addOption("HL/2");
    fp6.addOption("HLC/3");
    fp6.setDefault("Low"); //Edit this value to set a new default

    }

    function main(MA1Length,MA1Offset,MA1Source,MA2Length,MA2Of fset,MA2Source) {

    if (vMA1 == null) vMA1 = new MAStudy(MA1Length, MA1Offset, MA1Source, MAStudy.SIMPLE);
    if (vMA2 == null) vMA2 = new MAStudy(MA2Length, MA2Offset, MA2Source, MAStudy.SIMPLE);

    /******************************************
    Insert your code following this text block
    Use vMA1.getValue(MAStudy.MA) and
    vMA1.getValue(MAStudy.MA)for your code
    *******************************************/

    if (close(-1) < vMA1.getValue(MAStudy.MA, -1) &&
    close() > vMA1.getValue(MAStudy.MA))
    onAction1()

    if (close(-1) > vMA2.getValue(MAStudy.MA, -1) &&
    close() <vMA2.getValue(MAStudy.MA))
    onAction2();

    return new Array(vMA1.getValue(MAStudy.MA),vMA2.getValue(MASt udy.MA));

    }

    function onAction1() {
    var vL = formatPriceNumber(vMA2.getValue(MAStudy.MA));
    drawTextRelative(0, high(), "·",Color.blue, null, Text.BOLD|Text.CENTER|Text.ONTOP|Text.BOTTOM, "Symbol", 12);
    drawTextRelative(0, 0, "Buy Above "+formatPriceNumber(high()), Color.white, Color.blue, Text.BOLD|Text.CENTER|Text.RELATIVETOTOP, "MS Sans Serif", 10, 1);
    drawTextRelative(0, 1, "Stop Below "+vL, Color.white, Color.black, Text.BOLD|Text.CENTER|Text.RELATIVETOBOTTOM, "MS Sans Serif", 10, 2);
    Alert.addToList(getSymbol(),"Close above 6/4 channel "+"Buy above "+formatPriceNumber(high()),Color.black,Color.blue );
    vLastAlert = 1;
    }

    function onAction2() {
    var vH = formatPriceNumber(vMA1.getValue(MAStudy.MA));
    drawTextRelative(0, low(), "·",Color.red, null, Text.BOLD|Text.CENTER|Text.ONTOP|Text.TOP, "Symbol", 12);
    drawTextRelative(0, 1, "Sell Below "+formatPriceNumber(low()), Color.white, Color.red, Text.BOLD|Text.CENTER|Text.RELATIVETOBOTTOM, "MS Sans Serif", 10, 1);
    drawTextRelative(0, 0, "Stop Above "+vH, Color.white, Color.black, Text.BOLD|Text.CENTER|Text.RELATIVETOTOP, "MS Sans Serif", 10, 2);
    Alert.addToList(getSymbol(),"Close below 6/4 channel "+"Sell below "+formatPriceNumber(low()),Color.black,Color.r ed);
    vLastAlert = 2;
    }

  • #2
    yes. Simply "comment out" the setComputeOnClose(); statement in preMain... Like this.


    // setComputeOnClose();

    The "//" in front of the statement causes the efs scripting engine to ignore that statement.

    The setComputeOnClose() function is designed to prevent the script from running in realtime and only executes the efs script at the END OF THE BAR.

    This should take care of your issue (I hope).
    Last edited by Doji3333; 09-20-2010, 05:57 AM.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thanks works just like I wanted. Have a great week!!

      Comment

      Working...
      X