Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Alert going to the chart

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

    Alert going to the chart

    Hi,

    Is there a way to make an alert show up on the chart, instead of in the "Alerts Window"?

    If so, can it be set to show for 30seconds, then to disappear?

    Thanks,

    #2
    Hello ScottieDog,

    Thanks for your post about on chart alerts.

    There is no method to redirect an alert to a chart.

    However you can do what you are suggesting through some custom programming of your indicator. The methods would involve using DrawText or DrawTextFixed, PlaySound and a time check. For the time check you could use a time span or just simply a bar count depending on the type chart.

    Here is an example using bar count as the means to remove the object.


    Code:
    [I]Variables section[/I]
    
    private int barCount = 0;
    private bool trigger = true ;
    
    .
    [I]OnBarUpDate section[/I]
    
    if (yourAlertCondition && trigger)   // trigger is bool previous set to true
    
    {
    
    DrawTextFixed("tag1", "Your Alert message", TextPosition.Center);  // Draw in center of screen for alert
    
    PlaySound(@"C:\mySound.wav");  // PlaySound is optional
    
    trigger = false ;   // change the trigger condition
    
    barCount = CurrentBar ;  // Save the current bar number for the time reference
    
    }
    
    if (Currentbar - barCount > 4 && !trigger)   // if the number of bars is greater than 4 since the alert and the trigger is false
    {
    
    RemoveDrawObject("tag1");    // Remove the drawtext object
    trigger= true;   // reEnable the trigger
    }

    Please let me know if I can be of further assistance

    Comment


      #3
      Great stuff, thanks. I should be able to get it sorted from that info. Thanks.

      Comment


        #4
        Hello ScottieDog,

        Thanks for your reply.

        If you do want to try using a time system, here is an example:


        Code:
        [I]In the variables section:[/I]
        private Time myDateTime;  // Date time object to use
        private bool trigger = true ;
        
        [I]in OnBarUpdate section[/I]
        
        if (yourAlertCondition && trigger)   // trigger is bool previous set to true
        
        {
        
        DrawTextFixed("tag1", "Your Alert message", TextPosition.Center);  // Draw in center of screen for alert
        PlaySound(@"C:\mySound.wav");  // PlaySound is optional
        trigger = false ;   // change the trigger condition
        myDateTime = DateTime.Now;              // Event time
        myDateTime = myDateTime.AddSeconds(30);      // add the 30 seconds, or whatever interval duration for reset is desired.
        }
        
        if ((DateTime.Compare (DateTime.Now,myDateTime) >0) && !trigger)   // if 30 seconds have passed and the trigger is false
        {
        RemoveDrawObject("tag1");    // Remove the drawtext object
        trigger= true;   // reEnable the trigger
        }

        Please let me know if I can be of further assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X