Announcement

Collapse
No announcement yet.

Distribution DAY

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

  • Distribution DAY

    Can someone help me with this file?
    Looking to enlarge the down arrows and show the down arrows for the last 100 bars. It currently only shows todays results. Also the sound wave is not working.
    Thanks....Greg
    Here is the formula.
    //{{EFSWizard_Description
    //
    // This formula was generated by the Alert Wizard
    //
    //}}EFSWizard_Description


    //{{EFSWizard_Declarations
    var vLastAlert = -1;
    //}}EFSWizard_Declarations


    function preMain() {
    /**
    * This function is called only once, before any of the bars are loaded.
    * Place any study or EFS configuration commands here.
    */
    //{{EFSWizard_PreMain
    setPriceStudy(true);
    setStudyTitle("Distribution Day");
    setCursorLabelName("?", 0);
    setDefaultBarStyle(PS_SOLID, 0);
    setDefaultBarFgColor(Color.red, 0);
    setDefaultBarThickness(1, 0);
    setPlotType(PLOTTYPE_LINE, 0);
    //}}EFSWizard_PreMain

    }

    function main() {
    /**
    * The main() function is called once per bar on all previous bars, once per
    * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
    * in your preMain(), it is also called on every tick.
    */

    //{{EFSWizard_Expressions
    //{{EFSWizard_Expression_1
    if (
    close() < open() &&
    volume() > volume(-1)
    ) onAction1();
    //}}EFSWizard_Expression_1

    //}}EFSWizard_Expressions


    //{{EFSWizard_Return
    return ;
    //}}EFSWizard_Return

    }

    function postMain() {
    /**
    * The postMain() function is called only once, when the EFS is no longer used for
    * the current symbol (ie, symbol change, chart closing, or application shutdown).
    */
    }

    //{{EFSWizard_Actions
    //{{EFSWizard_Action_1
    function onAction1() {
    drawShapeRelative(0, high(), Shape.DOWNARROW, "", Color.RGB(255,0,0), Shape.TOP, "Sell");
    if (vLastAlert != 1) Alert.playSound("C:\\Program Files\\eSignal\\Sounds\\Ohno.wav");
    vLastAlert = 1;
    }
    //}}EFSWizard_Action_1

    //}}EFSWizard_Actions

  • #2
    Hello gwika,

    The reason you only see one arrow is because your tagID for the drawShapeRelative() function is using a fixed string, "Sell." To have more than one arrow drawn by this function you need to give each arrow a unique tagID. One easy way to do this is to change the tagID parameter to rawtime(0). This function returns the time stamp of the bar, which is unique for each bar in the chart.

    drawShapeRelative(0, high(), Shape.DOWNARROW, "", Color.RGB(255,0,0), Shape.TOP, rawtime(0));

    The size of the arrows can not be controlled by this function. What you can do as an alternative is use the drawTextRelative() function and specify the "Wingdings" font type. For an example, see this post.

    For the alert sound, it will only occur in real time. You may also want to remove the path to the sound file. This is not necessary if your Sound Files Root is set to the Sounds folder where you have installed eSignal (C:\ .... \eSignal\Sounds). To check, go to Tools --> EFS --> Settings menu.

    Alert.playSound("Ohno.wav");
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      Say that I use a unique ID made out of rawtime(0) as you suggest.

      Would I need to record that in some way (string or variable) at the same time in order to be able to erase it later? Using removeShape(tagID), for example?

      Volatility during the same bar often makes initial signals on a sensitive indicator no longer valid on later ticks. So I'd like to be able to remove those signals before the bar is over if that should be the case.

      Suggestions?

      Comment


      • #4
        Steven
        In that case you need to ensure that the tag name you assign to each graphic object is unique so as to be able to remove it if necessary.
        The example enclosed below will draw only one graphic object with that name on that bar and at the same time will remove it if the condition is no longer true.
        Alex

        PHP Code:
        if (myCondition) {
            
        drawShapeRelative(0high(0), Shape.DOWNARROW""Color.redShape.BOTTOM"DnArrow"rawtime(0));
        } else {
            
        removeShape("DnArrow"+rawtime(0));

        Comment


        • #5
          Hi, Alex --

          I wasn't clear that rawtime() would remain the same as long as it remained the same bar/interval. I thought it maybe changed with the tick.

          So, thanks!

          Comment


          • #6
            Steven
            You are most welcome.
            Just to confirm rawtime() is the time stamp of the bar expressed in seconds starting from January 1st 1970 and remains constant for the duration of each bar.
            Alex

            Comment

            Working...
            X