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

SendMail

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

    SendMail

    I'm trying to add a function for sending mail when there is a potential trade setup. The problem is that the script sending mail for (I guess) every tick, and I recive "tons" of emails. I need some help how to get this set to only send one mail when I have a potential setup. Below is the code I'm using right now. Hope someone can guide me in the right direction with this. Thanks

    if (mail==true && SMA1[0] > SMA2[0]
    {
    SendMail("[email protected]", [email protected], "Trade Alert", "Potential long @"+Instrument.FullName + Bars.Period.ToString() + " chart");

    mail = false;
    }

    #2
    finnbjurvoll, are you working with the script on CalculateOnBarClose = false then?

    If you are interested in the SMA crossover I would simply change the rule used to a CrossAbove / CrossBelow, so you would get a notification only on the crossover bar and not on subsequent bars as well until the opposite occurs.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      SendMail

      I'm working on a CalculateOnBarClose = false.

      Ok, let me redefine.

      I guess the below code would be the same logic as crossAbove/Below?
      I still have the same problem. I can't use this based on bar close, I need to be alerted when there is a potential setup.

      Finn.

      if (mail==true && SMA1[1] < SMA2[1] && SMA1[0] > SMA2[0] && Rising(SMA3));
      {
      SendMail("[email protected]", address, "Trade Alert", "Potential long @"+BarsArray[0].Instrument.FullName+ Bars.Period.ToString() + " chart");
      mail = false;
      }

      Comment


        #4
        Thanks for the additional input, then I would suggest you add a bool flag to your code that you reset when you would like to trigger the alert again.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          SendMail

          Thank you, that worked

          Comment


            #6
            Hi. Please could you put your code again based on NinjaTrader_Bertrand suggestion (adding a bool flag)? I have the same problem, and i would like to know how you fixed it.
            Thanks

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rbeckmann05, Yesterday, 06:48 PM
            1 response
            12 views
            0 likes
            Last Post bltdavid  
            Started by llanqui, Today, 03:53 AM
            0 responses
            6 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by burtoninlondon, Today, 12:38 AM
            0 responses
            10 views
            0 likes
            Last Post burtoninlondon  
            Started by AaronKoRn, Yesterday, 09:49 PM
            0 responses
            15 views
            0 likes
            Last Post AaronKoRn  
            Started by carnitron, Yesterday, 08:42 PM
            0 responses
            11 views
            0 likes
            Last Post carnitron  
            Working...
            X