Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the help!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Stanfillirenfro, Today, 07:23 AM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      2 responses
      21 views
      0 likes
      Last Post cmtjoancolmenero  
      Started by olisav57, Yesterday, 07:39 PM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      7 responses
      944 views
      0 likes
      Last Post Jquiroz1975  
      Started by oviejo, Today, 12:28 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X