Announcement

Collapse
No announcement yet.

alerts

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

  • alerts

    i would like to have an alert [popup and cowbell]
    when a sma crosses a candlestick. buy or sell signal.
    how do i set this up?
    thank you
    david7

  • #2
    Hi David,

    The functionality that you are looking for already exists as a default EFS within eSignal. In the Alerts folder under Formulas, there exists an EFS named AlertMA.efs. There are a couple of minor changes that you will want to make to this EFS. The first will be the length of the moving average. The second change is the sound that is played when the alert parameters are met. The pop up functionality is already coded in this EFS so you won't have to worry about that. I've attached the EFS as well as noted some the code that you will want to change to meet your needs. Hope this helps.

    var study = new MAStudy(10, 0, "Close", MAStudy.SIMPLE);

    function preMain() {
    setPriceStudy(true);
    }

    var bIsLong = false;
    var bIsShort = false;

    function main() {
    var v = study.getValue(MAStudy.MA);

    if(v == null)
    return;


    if(close() >= v) {
    if(!bIsLong) {
    Alert.addToList(getSymbol(), "Price is >= 10 Bar MA", Color.black, Color.green);
    Alert.playSound("swoosh.wav");
    bIsLong = true;
    bIsShort = false;
    }
    } else {
    if(!bIsShort) {
    Alert.addToList(getSymbol(), "Price is <10 Bar MA", Color.white, Color.red);
    Alert.playSound("train.wav");
    bIsLong = false;
    bIsShort = true;
    }
    }

    return v;
    }
    Attached Files

    Comment

    Working...
    X