Announcement

Collapse
No announcement yet.

Parameters for Hammer patterns and Shooting Star patterns

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

  • Parameters for Hammer patterns and Shooting Star patterns

    To whom it may concern,

    I am interested in the EFS code for various candlestick patterns as shown in the Patterns forum. I have tested these patterns and it would appear a number of valid signals or candles are missed. Thus, what are the parameters that have been used to define:

    i) Hammer
    ii) Shooting star

    As per the attached charts of the $XJO-ASX and $SPXClick image for larger version

Name:	Shooting Star.jpg
Views:	1
Size:	98.5 KB
ID:	246926Click image for larger version

Name:	Hammer.jpg
Views:	1
Size:	97.5 KB
ID:	246927Click image for larger version

Name:	Hammer 2.jpg
Views:	1
Size:	102.5 KB
ID:	246928Click image for larger version

Name:	Hammer 3.jpg
Views:	1
Size:	100.8 KB
ID:	246929, I seem to be missing a number of candles that I would define as hammers/candlesticks etc. How have you defined these candles and how could i amend this pls?

    I am a novice to the EFS code and I appreciate your help
    Thanks
    Austin

    Code for Hammer

    "/*********************************
    Provided By:
    eSignal (Copyright c eSignal), a division of Interactive Data
    Corporation. 2009. All rights reserved. This sample eSignal
    Formula Script (EFS) is for educational purposes only and may be
    modified and saved under a new file name. eSignal is not responsible
    for the functionality once modified. eSignal reserves the right
    to modify and overwrite this EFS file with each new release.


    Description:
    Hammer

    Version: 1.0 12/24/2009

    Formula Parameters: Default:
    Font Arial Narrow
    Font Size 11
    Font and Shape Color Green
    Font BgColor White

    Notes:
    This is a bullish reversal candlestick which occurs in a downtrend.
    It has a small real body at the top of the candlestick and a long lower shadow.
    **********************************/

    var fpArray = new Array();

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Hammer");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    var x=0;
    fpArray[x] = new FunctionParameter("nFontSize", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Font Size")
    setLowerLimit(6);
    setDefault(11);
    }
    fpArray[x] = new FunctionParameter("cFontColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Font and Shape Color");
    setDefault(Color.green);
    }
    fpArray[x] = new FunctionParameter("cFontBgColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Font BgColor");
    setDefault(Color.white);
    }
    fpArray[x] = new FunctionParameter("sFont", FunctionParameter.STRING);
    with(fpArray[x++]){
    setName("Font");
    setDefault("Arial Narrow");
    }
    }

    function main(sFont, nFontSize, cFontColor, cFontBgColor) {
    Find_Hammer(sFont, nFontSize, cFontColor, cFontBgColor);
    return;
    }

    function Find_Hammer(sFont, nFontSize, cFontColor, cFontBgColor) {
    var nState = getBarState();
    var Open = open(0);
    var Close = close(0);
    var Open1 = open(-1);
    var Close1 = close(-1);
    var High = high(0);
    var Low = low(0);
    var nID = getCurrentBarCount();
    if (nState == BARSTATE_ALLBARS) {
    if (sFont == null) sFont = "Arial Narrow";
    if (nFontSize == null) nFontSize = 11;
    if (cFontColor == null) cFontColor = Color.green;
    if (cFontBgColor == null) cFontBgColor = Color.white;
    }
    if (High < Math.min(Open1, Close1) &&
    Math.abs(Open - Close) * 3 < (Math.min(Open, Close) - Low) &&
    (High - Math.max(Open, Close)) < 0.05 * (Math.abs(Open - Close))) {
    drawTextRelative(0, BelowBar2, "Hmr", cFontColor, cFontBgColor, Text.PRESET | Text.CENTER, sFont, nFontSize, "T"+nID);
    drawShapeRelative(0, BelowBar1, Shape.UPARROW, null, cFontColor, Shape.PRESET, "S"+nID);
    } else {
    removeText("T"+nID);
    removeShape("S"+nID);
    }
    return;
    }

  • #2
    Austin
    In the formula you posted the definition of the Hammer is contained in the following lines of code

    PHP Code:
    if (High Math.min(Open1Close1) && 
    Math.abs(Open Close) * < (Math.min(OpenClose) - Low) && 
    (
    High Math.max(OpenClose)) < 0.05 * (Math.abs(Open Close))) { 
    which in plain language mean
    IF the current High is less than the lowest between the previous Open or previous Close AND
    the absolute value of the current Open minus the current Close multiplied by 3 is less than the lowest between the current Open and current Close minus the current Low AND
    the current High minus the highest between the current Open and current Close is less than 0.05 multiplied by the absolute value of the current Open minus the current Close

    As to the Shooting Start the definition is in the following lines of code of that formula

    PHP Code:
    if (Open1 Close1 &&
            
    Open Close1 &&
            
    High Math.max(OpenClose) >= Math.abs(Open Close) * &&
            
    Math.min(CloseOpen) - Low Math.abs(Open Close)) { 
    which in plain language mean
    IF the previous Open is less than the previous Close AND
    the current High minus the highest between the ciurrent Open and the current Close is greater than or equal to the absolute value of the current Open minus the current Close multiplied by 3 AND
    the lowest between the curreent Close and the current Open minus the current Low is less than the absolute value of the current Open minus the current Close


    Keep in mind that all the formulas provided by eSignal in the EFS library are essentially code examples that provide you with a base upon which you can expand or that you can modify in whatever way suits you best.
    As to how you would need to modify this depends on your definition of the Hammer or Shooting Star patterns which may be different from those given above.
    If - as you indicate - you are unfamiliar with programming in EFS then you may want to review the JavaScript for EFS video series and the Core JavaScript Reference Guide. These will provide you with a thorough introduction to programming in JavaScript which is at the foundation of EFS. Then go through the EFS KnowledgeBase and study the Help Guides and Tutorials which will provide you with the specifics of EFS.
    Alex


    Originally posted by texas1 View Post
    To whom it may concern,

    I am interested in the EFS code for various candlestick patterns as shown in the Patterns forum. I have tested these patterns and it would appear a number of valid signals or candles are missed. Thus, what are the parameters that have been used to define:

    i) Hammer
    ii) Shooting star

    As per the attached charts of the $XJO-ASX and $SPX[ATTACH=CONFIG]16618[/ATTACH][ATTACH=CONFIG]16619[/ATTACH][ATTACH=CONFIG]16620[/ATTACH][ATTACH=CONFIG]16621[/ATTACH], I seem to be missing a number of candles that I would define as hammers/candlesticks etc. How have you defined these candles and how could i amend this pls?

    I am a novice to the EFS code and I appreciate your help
    Thanks
    Austin

    Code for Hammer

    "/*********************************
    Provided By:
    eSignal (Copyright c eSignal), a division of Interactive Data
    Corporation. 2009. All rights reserved. This sample eSignal
    Formula Script (EFS) is for educational purposes only and may be
    modified and saved under a new file name. eSignal is not responsible
    for the functionality once modified. eSignal reserves the right
    to modify and overwrite this EFS file with each new release.


    Description:
    Hammer

    Version: 1.0 12/24/2009

    Formula Parameters: Default:
    Font Arial Narrow
    Font Size 11
    Font and Shape Color Green
    Font BgColor White

    Notes:
    This is a bullish reversal candlestick which occurs in a downtrend.
    It has a small real body at the top of the candlestick and a long lower shadow.
    **********************************/

    var fpArray = new Array();

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Hammer");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    var x=0;
    fpArray[x] = new FunctionParameter("nFontSize", FunctionParameter.NUMBER);
    with(fpArray[x++]){
    setName("Font Size")
    setLowerLimit(6);
    setDefault(11);
    }
    fpArray[x] = new FunctionParameter("cFontColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Font and Shape Color");
    setDefault(Color.green);
    }
    fpArray[x] = new FunctionParameter("cFontBgColor", FunctionParameter.COLOR);
    with(fpArray[x++]){
    setName("Font BgColor");
    setDefault(Color.white);
    }
    fpArray[x] = new FunctionParameter("sFont", FunctionParameter.STRING);
    with(fpArray[x++]){
    setName("Font");
    setDefault("Arial Narrow");
    }
    }

    function main(sFont, nFontSize, cFontColor, cFontBgColor) {
    Find_Hammer(sFont, nFontSize, cFontColor, cFontBgColor);
    return;
    }

    function Find_Hammer(sFont, nFontSize, cFontColor, cFontBgColor) {
    var nState = getBarState();
    var Open = open(0);
    var Close = close(0);
    var Open1 = open(-1);
    var Close1 = close(-1);
    var High = high(0);
    var Low = low(0);
    var nID = getCurrentBarCount();
    if (nState == BARSTATE_ALLBARS) {
    if (sFont == null) sFont = "Arial Narrow";
    if (nFontSize == null) nFontSize = 11;
    if (cFontColor == null) cFontColor = Color.green;
    if (cFontBgColor == null) cFontBgColor = Color.white;
    }
    if (High < Math.min(Open1, Close1) &&
    Math.abs(Open - Close) * 3 < (Math.min(Open, Close) - Low) &&
    (High - Math.max(Open, Close)) < 0.05 * (Math.abs(Open - Close))) {
    drawTextRelative(0, BelowBar2, "Hmr", cFontColor, cFontBgColor, Text.PRESET | Text.CENTER, sFont, nFontSize, "T"+nID);
    drawShapeRelative(0, BelowBar1, Shape.UPARROW, null, cFontColor, Shape.PRESET, "S"+nID);
    } else {
    removeText("T"+nID);
    removeShape("S"+nID);
    }
    return;
    }

    Comment

    Working...
    X