Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator to send me an email in realtime

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

    indicator to send me an email in realtime

    I'm kinda having the same issue. I want an indicator to send me an email only when conditions are all met and it's connected to live data. So I did something like this for the logic:
    Code:
    if (emailto.ToString() != null && Time[0] == DateTime.Now)
                {
    However Time[0] is never equal to DateTime.Now even on live data.
    Time: 9/5/2017 9:51:00 AM DateTimeNow: 9/5/2017 9:50:59 AM
    So how can I make sure that I'm sending an alert email on the last bar of realtime data only????
    In NT7, we had a 'historical' method. So I could just do it like this
    Code:
     if(emailto.ToString() != null && !historical)sendmail()
    Thoughts?
    Last edited by gqman; 09-05-2017, 09:05 AM.

    #2
    Hello,

    Thank you for the post.

    I have moved this into a new thread as this seems to be an unrelated question.

    Regarding DateTime.Now, this should not be used in NinjaScript to compare time, this is the PC time which has little relevance to what is being processed in the script.

    If you want to do something once in Realtime, you could just use the State system from OnBarUpdate:

    Code:
    if(State == State.Realtime)
    {
    //do something in realtime
    
    }
    You can locate changes like this in the code breaking changes guide: http://ninjatrader.com/support/helpG...ng_changes.htm

    I look forward to being of further assistance.

    Comment


      #3
      Thanks for the help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      245 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      157 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      165 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      250 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      201 views
      0 likes
      Last Post CarlTrading  
      Working...
      X