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 funk10101, Today, 09:43 PM
            0 responses
            3 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            36 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            24 views
            0 likes
            Last Post algospoke  
            Working...
            X