Announcement

Collapse
No announcement yet.

$EPREM Program Trades

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

  • $EPREM Program Trades

    I would like to create a study for EPREM that allows me to:

    1. Do a study edit and put in a daily high value and a low value.

    2. When these values are breached, the study would trigger a sound AND draw a symbol or letter above the triggering bar in green (or some selectable color) for the high range and below the triggering bar in red for the low range.

    I'm new to EFS programming and my forays into trying to figure out the requisite code made my head hurt.

    Pointers in the right direction and/or tips appreciated.

    Thanks,
    TBerwick
    tcberwick

  • #2
    EFX Modifications

    Did some additional research and found an EFS from 2003 that could probably be modified to handle this request.

    The file I located is called Alert_at_x . Unfortunately, it is apparently written in old format and will not open in version 8.0 Formula wizard.

    I've set this in place with 2 instances running, one for the high value, one for the low value.

    I would like to figure out how to write the .efs to perform both functions with only 1 instance loaded as well as do the colored symbols mentioned in 1st post.

    I have NO programming skills, to speak of.
    Here is the copied code, it is not working as I had hoped. It needs to trigger the sound/popup as the threshold is crossed and it is not currently doing that. Not sure what the problem is:


    vInit = false;
    var PriceLevel = null;
    var vAlertTriggered = false;

    function preMain() {

    if (vInit == false) {
    setPriceStudy(true);
    setStudyTitle("Alert at X");
    setShowCursorLabel(false);

    var fp1 = new FunctionParameter("PriceLevel", FunctionParameter.NUMBER);

    var fp1a = new FunctionParameter("HiLo", FunctionParameter.STRING);
    fp1a.setName("Alert Type?");
    fp1a.addOption("At_Or_Above");
    fp1a.addOption("At_Or_Below");
    fp1a.setDefault("At_Or_Above"); //Edit this value to set a new default

    var fp2 = new FunctionParameter("Popup", FunctionParameter.BOOLEAN);
    fp2.setName("Pop-up Alert?");
    fp2.setDefault(true);

    var fp3 = new FunctionParameter("Sound", FunctionParameter.BOOLEAN);
    fp3.setName("Sound Alert?");
    fp3.setDefault(true);

    var fp4 = new FunctionParameter("Email", FunctionParameter.BOOLEAN);
    fp4.setName("Email Alert?");
    fp4.setDefault(false);

    vInit = true;
    } else if (vInit == true) setStudyTitle("Alert at " + PriceLevel);

    }

    var bEdit = true;

    function main(PriceLevel,HiLo,Popup,Sound,Email) {

    if (bEdit == true || getBarState() == BARSTATE_NEWBAR) {
    vAlertTriggered = false;
    bEdit = false;
    }

    if (PriceLevel == null || vAlertTriggered) return;


    if (HiLo == "At_Or_Above" && vAlertTriggered == false) {
    if (close() >= PriceLevel) {
    if (Popup == "true") Alert.addToList(getSymbol(), "ALERT: " + getSymbol() + " >= " + PriceLevel);
    if (Sound == "true") Alert.playSound("Ding.wav");
    if (Email == "true") Alert.email(getSymbol(), "ALERT: " + getSymbol() + " >= " + PriceLevel);
    vAlertTriggered = true;
    }
    } else if (HiLo == "At_Or_Below" && vAlertTriggered == false) {
    if (close() <= PriceLevel) {
    if (Popup == "true") Alert.addToList(getSymbol(), "ALERT: " + getSymbol() + " <= " + PriceLevel);
    if (Sound == "true") Alert.playSound("Ding.wav");
    if (Email == "true") Alert.email(getSymbol(), "ALERT: " + getSymbol() + " <= " + PriceLevel);
    vAlertTriggered = true;
    }
    }

    return;
    }


    Thanks,
    Tom
    Last edited by tcberwick; 07-14-2006, 03:26 PM.
    tcberwick

    Comment


    • #3
      Tom

      The file I located is called Alert_at_x . Unfortunately, it is apparently written in old format and will not open in version 8.0 Formula wizard.
      That file is not written in old format. The reason the Formula Wizard cannot read it is because the Formula Wizard can only read code that was written using the Formula Wizard which is not the case of the script you posted.

      It needs to trigger the sound/popup as the threshold is crossed and it is not currently doing that. Not sure what the problem is:
      It is not working because it requires a change in the code to comply with a modification that was implemented in the formula engine in version 7.9 ie subsequently to when that script was posted. In this thread [which is where I believe you found that file] there is an updated version posted by me that will work correctly with the more recent versions of eSignal.

      I would like to figure out how to write the .efs to perform both functions with only 1 instance loaded as well as do the colored symbols mentioned in 1st post.
      I have NO programming skills, to speak of.
      I would suggest that you begin by learning how to program in efs. The added benefit is that you will be able to take fiull advantage of what eSignal has to offer.
      The best way to do this is to start by reviewing the JavaScript for EFS video series. That 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.
      If on the other hand you are not interested in learning efs you may want to review the FAQ: How can I get my custom study built?
      Alex

      Comment

      Working...
      X