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

sending email from script

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

    sending email from script

    Hi,

    We are just taking little baby steps here. I setup a simple test strategy that is supposed to email me. I see what I am supposed to in the output box and it makes some sort of noise. But email does not work.

    This is a snip from the ninja script ( obviously not my real email) but code is same. Real script has real email.

    // Condition set 1
    if (CrossAbove(Close, IchimokuCloud(9, 26, 52).TenkanSen, 8)
    && MACD(12, 26, 9).Avg[0] > MACD(12, 26, 9).Avg[1])
    {
    PrintWithTimeStamp("Above cloud Yes it is");
    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert3.wav");
    SendMail("[email protected]", "[email protected]", "ninja alert", "We have done it");
    }


    This is supposed to send me an email if price moves above the cloud and MACD is increasing.
    Do I need to do something to enable emailing an alert to myself.? I thought sending myself messages when conditions occur would be a safe first step

    Thanks for any help

    #2
    (could not tell where you are using it).

    I believe it only works in live market, not market replay if that is what you are using.

    If you want it to work in market replay, you need to google c# howto email and use alternative code.

    If you are running in live, did you setup your email and does that test button work from within ninjatrader?



    Originally posted by mcteague View Post
    Hi,

    We are just taking little baby steps here. I setup a simple test strategy that is supposed to email me. I see what I am supposed to in the output box and it makes some sort of noise. But email does not work.

    This is a snip from the ninja script ( obviously not my real email) but code is same. Real script has real email.

    // Condition set 1
    if (CrossAbove(Close, IchimokuCloud(9, 26, 52).TenkanSen, 8)
    && MACD(12, 26, 9).Avg[0] > MACD(12, 26, 9).Avg[1])
    {
    PrintWithTimeStamp("Above cloud Yes it is");
    PlaySound(@"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert3.wav");
    SendMail("[email protected]", "[email protected]", "ninja alert", "We have done it");
    }


    This is supposed to send me an email if price moves above the cloud and MACD is increasing.
    Do I need to do something to enable emailing an alert to myself.? I thought sending myself messages when conditions occur would be a safe first step

    Thanks for any help

    Comment


      #3
      Hi. I did not know I had a test button. Not being in any hurry to loose all my money, the plan was to write some scripts that notify me when certain indicators hit before actually trying to get it to take a position. I wanted to test it first in the simulated data feed.

      I am sure what I want is pretty basic. If these 2 or 3 indicators say this; then do that. Just being cautious.
      I will look around for setting up the email and the test button. Thanks

      Comment


        #4
        Originally posted by mcteague View Post
        Hi. I did not know I had a test button. Not being in any hurry to loose all my money, the plan was to write some scripts that notify me when certain indicators hit before actually trying to get it to take a position. I wanted to test it first in the simulated data feed.

        I am sure what I want is pretty basic. If these 2 or 3 indicators say this; then do that. Just being cautious.
        I will look around for setting up the email and the test button. Thanks
        I dont think email works in sim feed

        You can open the output window, and your Print statements will go there for easy feedback.

        The email thing is somewhere in options. Not at my laptop, so cant be more specific at the moment.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junkone, Today, 11:37 AM
        0 responses
        2 views
        0 likes
        Last Post junkone
        by junkone
         
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        34 views
        0 likes
        Last Post love2code2trade  
        Started by cls71, Today, 04:45 AM
        2 responses
        10 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Working...
        X