Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting up Strategy outgoing Email

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

    Setting up Strategy outgoing Email

    Convert.ToString(NinjaTrader.Cbi.Instrument.GetIns trument(),

    I would also like the Machine ID if possible,

    How to I get the instrument trade sent in the email or alert- i tryed the above
    Thanks


    #2
    Hello DTSSTS, thanks for your question.

    I made this indicator in the past that emails the user when an execution occurs on the account:

    https://ninjatraderecosystem.com/use.../email-trades/

    The machine ID can be accessed with Cbi.License.MachineId.

    Please let me know if you have any questions about this.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      So can i just use that indicator in my strategy builder

      i also would need to embed an ToEmail Address not to be modified

      Exactly how do i apply this indicator in a strategy builder,
      Left side set email and right side true or = 1

      or should left side indicate the trade took place and then right side list email address
      Last edited by DTSSTS; 08-10-2020, 10:56 AM.

      Comment


        #4
        when using the strategy builder i cant seem to get the instrument and the machineid to do anything but send a text

        with @" Cbi.Instrument.GetInstrument() because I have @ instead of Conver.ToString

        SendMail(@"[email protected]", autotrade, Convert.ToString(Position.MarketPosition) + @" Cbi.Instrument.GetInstrument() + Convert.ToString(Position.Quantity) + " " + Convert.ToString(Position.AveragePrice) + @" Cbi.License.MachineId");
        }


        also need to figure out how to send email on order filled OR send Once rather than BarsSinceEntryExecution as the email sends multiple times until the next bar is open
        Last edited by DTSSTS; 08-10-2020, 03:33 PM.

        Comment


          #5
          Hello DTSSTS, thanks for your reply.

          This can not be done in the builder. It is generating string literals and not system code for the actual property. The script needs to be unlocked to get this to work.

          Please let me know if I can assist any further.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            that being said, is this correct script

            SendMail(@"[email protected]", autotrade, Convert.ToString(Position.MarketPosition) + Convert.ToString(Cbi.Instrument.GetInstrument()) + Convert.ToString(Position.Quantity) + Convert.ToString(Position.AveragePrice) + Convert.ToString(Cbi.License.MachineId);


            Thanks

            ALSO can your indicator be used in strategy builder, you never said, if so, what goes where as I ask in earlier post

            Comment


              #7
              Hello DTSSTS, My apologies, the forum was down for some time.

              All clients that are writing scripts should be able to debug and test lines of code on their own. To test if the line of code you provided works, put it into the NinjaScript editor, make sure it compiles first, then check the output of the line of code.

              The script I gave can not be used in the builder, it runs on a chart. Whatever account is selected in the properties, it will send an email containing details on the executions that occur on the account.

              Kind regards.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                thanks for the info

                Comment


                  #9
                  Chris I have finally unlock our code and editing the send email line of code, I still have an error (likely just a comma or something little)

                  the error states: "No overload for method 'getInstrument' takes 0 arguments" CS1501

                  here is my code, thanks

                  SendMail(@"[email protected]", @"ATSAutoTrade", Convert.ToString(Position.MarketPosition) + Convert.ToString(Cbi.Instrument.GetInstrument()) + Convert.ToString(Position.Quantity) + Convert.ToString(Position.AveragePrice) + Convert.ToString(Cbi.License.MachineId));

                  Comment


                    #10
                    Hello DTSSTS,

                    When you get a compile error stating the "No overload for method" this would mean your syntax is incorrect. We are also being advised that GetInstrument does not take 0 parameters. Looking at your code, you are calling GetInstrument without any parameters.

                    Resolving would involve checking how the syntax should be written. You can check the documentation to see how this method would be used.

                    https://ninjatrader.com/support/help...instrument.htm

                    We look forward to assisting.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      I do not follow, we are not trying to define the instrument, but retrieve the instrument as the instrument could be ONE of any

                      Convert.ToString(Cbi.Instrument.GetInstrument())

                      I am only looking for what goes () between the brackets to have the Instrument symbol be included in the email

                      all other items are being included

                      any help from any one is appreciated
                      Last edited by DTSSTS; 01-22-2021, 02:09 PM.

                      Comment


                        #12
                        Hello DTSSTS,

                        Do you mean you want to fetch the name of the Instrument that the script is applied to? You can use Instrument.FullName.

                        Instrument.FullName - https://ninjatrader.com/support/help...t_fullname.htm

                        Instrument.GetInstrument(string instrumentName) would be used to get an Instrument object by specifying the name of the instrument. You are using this in your code, and you are not providing the instrument name parameter, so the compiler gets and error and tells you the syntax is incorrect.

                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          i tried several ways to use Instrument.FullName (I would rather have the symbol, but name may have to work) the help guide is not detail enough

                          Convert.ToString(Cbi.Instrument.GetInstrument()) +

                          what do i replace this with, I have tried many options without success

                          thanks for the help

                          Comment


                            #14
                            Jim I did get Instrument.FullName to work,

                            example of what I get for Home Depot for instance is

                            ShortHD Default100283.22354machineidnumber79D85FE

                            also with the help guide where is the section that covers how to get spaces between each field that is being emailed

                            FOR ANYONE WISH TO SEND EMAIL FROM STRATEGY - THE BELOW DOES WORK, if we get the spaces in I will post update

                            SendMail(@"[email protected]", @"ATSAutoTrade", Convert.ToString(Position.MarketPosition) + Convert.ToString(Cbi.Instrument.GetInstrument(Inst rument.FullName, true)) + Convert.ToString(Position.Quantity) + Convert.ToString(Position.AveragePrice) + Convert.ToString(Cbi.License.MachineId));


                            Trying for message

                            Short HD Default100 283.22 354machineidnumber79D85FE

                            thanks for all the help

                            Comment


                              #15
                              Hello DTSSTS, thanks for your reply.

                              You will need to add the spaces to the string manually e.g.

                              Convert.ToString(Cbi.Instrument.GetInstrument(Inst rument.FullName, true)) + " " + Convert.ToString(Position.Quantity) //and so on

                              Please let me know if I can assist any further.
                              Chris L.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by guenni7, Today, 09:43 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post guenni7
                              by guenni7
                               
                              Started by jonfan45, Today, 06:06 PM
                              0 responses
                              9 views
                              0 likes
                              Last Post jonfan45  
                              Started by rustyspring, Today, 05:15 PM
                              0 responses
                              13 views
                              0 likes
                              Last Post rustyspring  
                              Started by xulu13, Today, 05:01 PM
                              0 responses
                              15 views
                              0 likes
                              Last Post xulu13
                              by xulu13
                               
                              Started by Pbarrionuevo, Today, 04:30 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post Pbarrionuevo  
                              Working...
                              X