Announcement

Collapse
No announcement yet.

show alerts within the charts

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

  • show alerts within the charts

    I am using Alert.addToList for alerts. However, I think it will great help if I can hv EFS to show the alert msg within the charts with below features:
    i) show the msg in the chart (showing the alert together with the time stamp) instead of the alert list
    ii) blink in different colors for 5s
    iii) stay in red color after 5s
    iv) disappear when I click on it

    Would you me show me how to do so? thx.

  • #2
    Hello Richard,

    i) show the msg in the chart (showing the alert together with the time stamp) instead of the alert list
    You can accomplish this using our Drawing Functions (see EFS Knowledgebase link at the bottom of this post). You could use one of the drawText functions to draw this information somewhere on your chart. To get the time stamp of the trade, you would use the JavaScript Date Object to build a string representing the time stamp of the trade that generated the alert.

    ii) blink in different colors for 5s
    iii) stay in red color after 5s
    We do not currently have blinking capabilities. EFS execution is generated by trade updates in the chart. You could create a process that redraws the text objects (be sure to use the same tag name for the text images) a different color on each subsequent trade. However, if you're looking at a fast market the blink rate would be very fast. Likewise, for a slow market, the object may not appear to blink at all if no new trades occur within the next 5 seconds. You could draw them with one color upon the initial alert, record the time using the date object methods and then check the time of each subsequent trade to look for the first trade after at least 5 seconds has passed. At that point redraw the text objects to a different color.

    iv) disappear when I click on it
    Using the text parameter of the drawText functions, you can assign a user-defined function to run when the object is clicked. All you do is add "@URL=EFS:functionName" at the end of the text parameter. The function that executes can then call the removeText() function to remove, or delete, itself from the chart.

    PHP Code:
    function main() {
        ....
        ....

        if (
    getBarState() == BARSTATE_NEWBAR) {
            
    drawTextAbsolute(2020"test@URL=EFS:test"nullnull
                
    Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.FRAMEnull12"test");
        }
        ....
        ....
    }

    function 
    test() {
        
    removeText("test");
        return;

    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

    Working...
    X