Announcement

Collapse
No announcement yet.

RT_OutsideBarAlert

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

  • RT_OutsideBarAlert

    Hi
    Need some help with Insert Study/Formula/Pattern/RT_OutsideBarAlert

    I'd like 2 little changes in this script.
    1. I would only prefer to see the arrow on top of outside bar rather than colour change of whole bar.
    2. Current script changes the thin wick of all candles to thick and I prefer to see the candles with thin wicks.

    Either of these 2 changes will make me very happy.

    Regards

    /*********************************
    Provided By:
    Interactive Data Corporation (Copyright © eSignal) 2010.
    All rights reserved. This sample eSignal Formula Script (EFS)
    is for educational purposes only. Interactive Data Corporation
    reserves the right to modify and overwrite this EFS file with
    each new release.

    Description:
    Real Time Outside Bar

    Version: 1.0 06/16/2009

    Formula Parameters: Default:
    Enable Alerts True
    Outside Bar Color Blue
    Up Bar Color Green
    Down Bar Color Red

    Notes:

    **********************************/
    var bNewBar = false;
    var bAlert = false;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Real Time Outside Bar");
    setShowCursorLabel(false);
    setShowTitleParameters(false);
    setColorPriceBars(true);
    setDefaultPriceBarColor(Color.black);

    var fp1 = new FunctionParameter("cColor", FunctionParameter.COLOR);
    fp1.setName("Outside Bar Color");
    fp1.setDefault(Color.RGB(0x00,0x94,0xFF));

    var fp2 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
    fp2.setName("Enable Alerts");
    fp2.setDefault(true);

    var fp3 = new FunctionParameter("cUpColor", FunctionParameter.COLOR);
    fp3.setName("Up Bar Color");
    fp3.setDefault(Color.green);

    var fp4 = new FunctionParameter("cDownColor", FunctionParameter.COLOR);
    fp4.setName("Down Bar Color");
    fp4.setDefault(Color.RGB(0xFE,0x00,0x6D));
    }

    var xOpen = null;
    var xHigh = null;
    var xLow = null;
    var xClose = null;
    var bInit = false;

    function main(bEnable, cColor, cUpColor, cDownColor) {
    if (getBarState() == BARSTATE_NEWBAR) bNewBar = true;

    if(!bInit){
    xOpen = open();
    xHigh = high();
    xLow = low();
    xClose = close();
    bInit = true;
    }

    var nOpen = xOpen.getValue(0);
    var nHigh = xHigh.getValue(0);
    var nHigh_1 = xHigh.getValue(-1);
    var nLow = xLow.getValue(0);
    var nLow_1 = xLow.getValue(-1);
    var nClose = xClose.getValue(0);

    if(nHigh_1 == null || nLow_1 == null) return;

    if (nHigh > nHigh_1 && nLow < nLow_1 ) bAlert = true;


    if (bAlert == true) {
    setPriceBarColor(cColor);
    if (bEnable == true && bNewBar == true) {
    Alert.playSound("pop.wav");
    Alert.addToList(getSymbol(), "Outside Bar", cColor, Color.white);
    bNewBar = false;
    }
    bAlert = false;
    } else {
    if (nClose >= nOpen)
    setPriceBarColor(cUpColor)
    else
    setPriceBarColor(cDownColor)
    }

    return;
    }

  • #2
    Try the following script.
    It uses color arrows instead of changing the bar color.



    var bNewBar = false;
    var bAlert = false;

    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Real Time Outside Bar");
    setShowCursorLabel(false);
    setShowTitleParameters(false);

    var fp2 = new FunctionParameter("bEnable", FunctionParameter.BOOLEAN);
    fp2.setName("Enable Alerts");
    fp2.setDefault(true);


    }

    var xOpen = null;
    var xHigh = null;
    var xLow = null;
    var xClose = null;
    var bInit = false;

    function main(bEnable, cColor, cUpColor, cDownColor) {
    if (getBarState() == BARSTATE_NEWBAR) bNewBar = true;

    if(!bInit){
    xOpen = open();
    xHigh = high();
    xLow = low();
    xClose = close();
    bInit = true;
    }

    var nOpen = xOpen.getValue(0);
    var nHigh = xHigh.getValue(0);
    var nHigh_1 = xHigh.getValue(-1);
    var nLow = xLow.getValue(0);
    var nLow_1 = xLow.getValue(-1);
    var nClose = xClose.getValue(0);

    if(nHigh_1 == null || nLow_1 == null) return;

    if (nHigh > nHigh_1 && nLow < nLow_1 ) bAlert = true;


    if (bAlert == true) {
    drawShapeRelative(0, high()+(0.005*high()), Shape.RIGHTARROW, "", Color.RGB(0,0,255), Shape.TOP)
    if (bEnable == true && bNewBar == true) {
    Alert.playSound("pop.wav");
    Alert.addToList(getSymbol(), "Outside Bar", cColor, Color.white);
    bNewBar = false;
    }
    bAlert = false;
    } else {
    if (nClose >= nOpen)
    drawShapeRelative(0, high()+(0.005*high()), Shape.UPARROW, "", Color.RGB(0,255,0), Shape.TOP)
    else
    drawShapeRelative(0, low()-(0.005*low()), Shape.DOWNARROW, "", Color.RGB(255,0,0), Shape.TOP)
    }

    return;
    }

    Comment


    • #3
      Thank you so much for this. With some effort I also managed to only see the Blue arrows (No red and Green arrows for up and down bars) and this perfectly solved my problem.

      Cheers

      Comment

      Working...
      X