Announcement

Collapse
No announcement yet.

Syntax error

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

  • Syntax error

    /Can someone help me to find this fomula/correct the synyax error on line 48. See Attached file.
    ************************************************** *************************************************
    Copyright © eSignal, a division of Interactive Data Corporation. 2003. All rights reserved.
    This sample eSignal Formula Script (EFS) may be modified and saved under a new
    filename; however, eSignal is no longer responsible for the functionality once modified.
    eSignal reserves the right to modify and overwrite this EFS file with each new release.
    ************************************************** ************************************************** */
    var study = new MAStudy(10, 0, "Close", MAStudy.SIMPLE);

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Draw Lines, Text, Shapes and Images.");
    }

    var vHigh;
    var vLow;
    var BarCntr = 0;
    function main() {
    var v = study.getValue(MAStudy.MA);

    if(v == null)
    return;

    if (getBarState() == BARSTATE_NEWBAR)
    BarCntr +=1;

    vHigh = high();
    vLow = low();
    for (i = 0; i < 20; ++i) {
    vHigh = Math.max(high(-i), vHigh);
    vLow = Math.min(low(-i), vLow);
    }

    drawLineRelative(-20, vHigh, 0, vHigh, PS_SOLID, 2, Color.red, "High");
    drawLineRelative(-20, vLow, 0, vLow, PS_SOLID, 2, Color.green, "Low");

    var space = 1;
    if (getInterval() != "D")
    space = high() - low();

    if(close() >= v) {
    if(!Strategy.isLong()) {
    drawShapeRelative(0, low(), Shape.UPARROW, null, Color.lime, Image.ONTOP, "Buy" + BarCntr);
    drawTextRelative(0, low() - (space * 1.75), "B", Color.black, Color.lime, Text.FRAME | Text.ONTOP | Text.BOLD, null, 9, "text buy" + BarCntr );
    drawImageRelative(0, low() - (space * 3), "SystemHappyFace", null, Image.ONTOP, "buy image" + BarCntr);
    Strategy.doLong("Crossing Up", Strategy.MARKET, Strategy.THISBAR);
    }
    } else if(!Strategy.isShort()) {
    drawShapeRelative(0, high() + space, Shape.DOWNARROW, null, Color.Yellow, Image.ONTOP, "Sell" + BarCntr);
    drawTextRelative(0, high() + (space * 1.75), "S", Color.Yellow, Color.red, Text.FRAME | Text.BOTTOM | Text.BOLD, null, 9, "text sell" + BarCntr );
    drawImageRelative(0, high() + (space * 3), "SystemHappyFace", null, Image.BOTTOM, "short image" + BarCntr);
    Strategy.doShort("Crossing Down", Strategy.MARKET, Strategy.THISBAR);
    }

    return v;
    }
    Attached Files

  • #2
    aleshi
    Both Line 48 and 49 contain the same error ie Color.Yellow should be Color.yellow
    Alex

    Comment


    • #3
      aleshi
      If I may, there is one thing I would suggest changing in your efs and that is the entry price used for the trades.
      As is the efs is set to Buy/Sell on the Open of the bar that generates the signal (ie Strategy.MARKET,Strategy.THISBAR) which is unrealistic.
      I would suggest to change it to use either the Close of the bar that generates the signal (Strategy.CLOSE,Strategy.THISBAR) or the Open of the bar that follows the one that generates the signal (Strategy.MARKET,Strategy.NEXTBAR).
      Alex

      Comment

      Working...
      X