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 to subscriberlist

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

    #16
    Hello Daxtrading,

    If you're looking to capture execution price for a specific order, please see my post # 8, and refer to SampleOnOrderUpdate for the additional structure that's needed to access properties at the execution level. All your order objects must be declared and managed properly.

    If you want a simpler implementation that does not require IOrder structure, then you can use Position.AvgPrice. You can use it anywhere you like in code, but it will return a zero when you are flat.
    Ryan M.NinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_RyanM View Post
      Hello Daxtrading,

      If you're looking to capture execution price for a specific order, please see my post # 8, and refer to SampleOnOrderUpdate for the additional structure that's needed to access properties at the execution level. All your order objects must be declared and managed properly.

      If you want a simpler implementation that does not require IOrder structure, then you can use Position.AvgPrice. You can use it anywhere you like in code, but it will return a zero when you are flat.
      I started with the Position.AvgPrice but the problem I have is the price showing zero because of CloseOnBar Update.
      If you can help me to setup this method, please let me know.

      Comment


        #18
        It returns zero when you're flat. You can add market position checks so you're only accessing when you're in a position.

        if (Position.MarketPosition != MarketPosition.Flat)
        Print(Position.AvgPrice);
        Ryan M.NinjaTrader Customer Service

        Comment


          #19
          Originally posted by NinjaTrader_RyanM View Post
          It returns zero when you're flat. You can add market position checks so you're only accessing when you're in a position.

          if (Position.MarketPosition != MarketPosition.Flat)
          Print(Position.AvgPrice);
          Ok, please tell me where I should call this and what is the call and place for the price sending to Email.

          Comment


            #20
            Here's Position.AvgPrice in a sendmail method. This goes in OnBarUpdate()

            if (Position.MarketPosition != MarketPosition.Flat)
            SendMail("emailFrom", "emailTo", Position.AvgPrice.ToString(), Position.AvgPrice.ToString());
            Ryan M.NinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_RyanM View Post
              Here's Position.AvgPrice in a sendmail method. This goes in OnBarUpdate()

              if (Position.MarketPosition != MarketPosition.Flat)
              SendMail("emailFrom", "emailTo", Position.AvgPrice.ToString(), Position.AvgPrice.ToString());
              I know why the price is't showing the AvgPrice, my Emaillist is fired direct after the fill of my position.
              At that moment the bar is not closed so the system think it's still flat.
              If you can tell me how I can delay the sending of the email till marketposition isn't flat anymore, you would make me a happy man after struggling whole day.

              Comment


                #22
                The snippet posted earlier does exactly this. It sends mail only when your position is not flat.

                If you're looking for someone to code your project, please see a list of 3rd party NinjaScript consultants here:
                Ryan M.NinjaTrader Customer Service

                Comment


                  #23
                  Originally posted by NinjaTrader_RyanM View Post
                  The snippet posted earlier does exactly this. It sends mail only when your position is not flat.

                  If you're looking for someone to code your project, please see a list of 3rd party NinjaScript consultants here:
                  http://www.ninjatrader.com/webnew/pa...injaScript.htm
                  I finally have the correct price send to my emaillist using IEcecution using entryOrder.
                  Now I am getting the same price for my entry as well for my exit.
                  What needs to be done to fix this?

                  Comment


                    #24
                    daxtrading, you will have to track the exit executions as well to get the exit prices. What code are you currently using to get the exit price?
                    AustinNinjaTrader Customer Service

                    Comment


                      #25
                      Originally posted by NinjaTrader_Austin View Post
                      daxtrading, you will have to track the exit executions as well to get the exit prices. What code are you currently using to get the exit price?
                      I am using the same code as for the entry, entryOrder = ExitLong

                      Comment


                        #26
                        Originally posted by daxtrading View Post
                        I am using the same code as for the entry, entryOrder = ExitLong
                        Yeeha, it's FIXED!
                        Finally I managed to make it work like crazy.
                        Many thanks to the Support team from Maarten, http://daxtrading.nl/en

                        Comment


                          #27
                          daxtrading, glad to hear you got it working. Please let us know if you have any other questions.
                          AustinNinjaTrader Customer Service

                          Comment


                            #28
                            Last thing how to round the price

                            "\nPrice: " + myExecutionPrice shows lots of decimals.

                            Please give me the code to get 2 decimals.

                            Comment


                              #29
                              daxtrading, you can look into those formatting options for strings - http://www.ninjatrader.com/support/f...ead.php?t=3823
                              BertrandNinjaTrader Customer Service

                              Comment


                                #30
                                Originally posted by NinjaTrader_Bertrand View Post
                                daxtrading, you can look into those formatting options for strings - http://www.ninjatrader.com/support/f...ead.php?t=3823
                                Bertrand, you're the best.
                                Thanks!

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by lightsun47, Today, 03:51 PM
                                0 responses
                                4 views
                                0 likes
                                Last Post lightsun47  
                                Started by 00nevest, Today, 02:27 PM
                                1 response
                                8 views
                                0 likes
                                Last Post 00nevest  
                                Started by futtrader, 04-21-2024, 01:50 AM
                                4 responses
                                44 views
                                0 likes
                                Last Post futtrader  
                                Started by Option Whisperer, Today, 09:55 AM
                                1 response
                                13 views
                                0 likes
                                Last Post bltdavid  
                                Started by port119, Today, 02:43 PM
                                0 responses
                                8 views
                                0 likes
                                Last Post port119
                                by port119
                                 
                                Working...
                                X