Multi-time Frame Indicators in Esignal EFS

Discussion in 'App Development' started by kmgilroy89, May 11, 2019.

  1. I have an indicator, but only want to use it at a new low for the day. For, example, take the bullish engulfing pattern, where a green bar engulfs a red bar:

    function Find_BullishEngulfing(sFont, nFontSize, cFontColor, cFontBgColor) {
    var nState = getBarState();
    var Open = open(0);
    var Close = close(0);
    var Open1 = open(-1);
    var Close1 = close(-1);
    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 (Open1 > Close1 &&
    Close > Open &&
    Close >= Open1 &&
    Close1 >= Open &&
    (Close - Open) > (Open1 - Close1)) {
    drawTextRelative(0, BelowBar2, "BuEng", 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;
    }



    This will show a bullish engulfing bar for anytime frame (1 min, 5 min, Daily, etc). However, I want to make the indicator show up at only the current low of day. I used a function: low(0, inv("D")). Problem was, this only worked if it ended up being the actual low of day. For example, if the bullish engulfing bar occurred at a new day low at 11:00 and there was another day low at 12:00 it would not show up back-testing. It only shows up if that bar at 11:00 ended up being the day low for the rest of the day. I'm not much of a coder, but I feel like if I can figure out how to do these indicators that depend on multiple time-frames I'll have all the back-testing skills I need for now.