Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Share Service setup

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

    Share Service setup

    I created the service share correctly. The test email has been confirmed. But when my strategy makes a trade I still do not get an email or text alert. Is the correct syntax:

    if( A + B)
    {
    Share("Google", "Test Message", new object[]{ "[email protected]", "Test Subject Line" });
    Share("Google Text", "Test Message", new object[]{ "[email protected]", "Test Subject Line" });
    }

    Or

    else if (State == State.Realtime)
    {
    Share("Google", "Test Message", new object[]{ "[email protected]", "Test Subject Line" });
    Share("Google Text", "Test Message", new object[]{ "[email protected]", "Test Subject Line" });
    }

    #2
    Hi AdeptistJune, the email in the Arg[0] should be the email you want to send the message to. Try this out and let me know if this does not resolve.

    Kind regards,
    -ChrisL

    Comment


      #3
      Hey Chris,

      I'm using your Email Indicator. It works perfectly, just need it to let me know where a long or short was entered:

      private void OnExecutionUpdate(object sender, ExecutionEventArgs e)

      {
      if(e.Execution.Order != null)
      {
      if (e.Execution.Order.OrderState == OrderState.Filled)
      {
      SendMail(ToEmail, "Execution on your account",
      string.Format("Instrument: {0} Quantity: {1} Price: {2}",e.Execution.Instrument.FullName, e.Quantity, e.Price)
      );
      }

      if (EmailPartFilled && e.Execution.Order.OrderState == OrderState.PartFilled)
      {
      SendMail(ToEmail, "Partial execution on your account",
      string.Format("Instrument: {0} Quantity: {1} Price: {2}",e.Execution.Instrument.FullName, e.Quantity, e.Price)
      );
      }
      }

      NinjaTrader.Code.Output.Process(string.Format("Ins trument: {0} Quantity: {1} Price: {2}",

      e.Execution.Instrument.FullName, e.Quantity, e.Price), PrintTo.OutputTab1);

      }

      Comment


        #4
        Hi AdeptistJune, The Execution object has a MarketPosition value that you can access that tells you if the execution was a buy or a sell:



        Kind regards,
        -ChrisL

        Comment


          #5
          Hello, Chris

          When using the Email Indicator, when closing a long position, the text will say Market Position: Short.

          Is it possible to get the text to read "Sell" instead of "Short" when a long position is closed?

          Also, is it possible to get the text to read the name of the entry or exit signal?

          Thanks.

          Comment


            #6
            Hi AdeptistJune, thanks for your reply.

            You would have to translate it in the script itself. E.g. when a "Short" execution comes through and the position is going from Long to flat, you would write "Sell". The execution object that I already linked has all the available information that you can get from the OnExecutionUpdate method. Please look there for all of the available information.

            Kind regards,
            -ChrisL

            Comment


              #7
              Thanks for the update Chris,

              I know your team is extremely busy today, but whenever you have time, can you explain how "I would translate it in the script itself." Do I translate in the OnStateChange method or the OnBarupdate Method?

              Thanks.

              Comment


                #8
                Hi AdeptistJune, thanks for your reply.

                You can use C# if statements to write "Sell" instead of Short. e.g.

                Code:
                //in OnExecutionUpdate
                
                if(e.Execution.MarketPosition == MarketPosition.Short)
                {
                    Print("Sell order");
                }
                
                if(e.Execution.MarketPosition == MarketPosition.Long)
                {
                    Print("Buy order");
                }
                Make sure you are using Print() while you work on scripts so you can see the data coming from the script.

                Kind regards,
                -ChrisL

                Comment


                  #9
                  Hello, Chris,

                  Sorry for the confusion, but I don't know how to translate the script. Am I re-assigning variable? I've tried but it's still showing Long or Short as exits.

                  if(e.Execution.MarketPosition == MarketPosition.Short) { e.Execution.MarketPosition =="Sell order"; }?

                  I've tried, and I still can't get it to work. I have multiple trading signals and I still can't get it to identify which signal was executed.

                  Is there a thread I can learn from?

                  Thanks

                  Comment


                    #10
                    Hi AdeptistJune, You would modify the script using C# if statements like this:
                    Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

                    Comment


                      #11
                      Thanks, Chris,

                      I see exactly how to do it now.

                      I have a new issue. I'm no longer getting the email alerts using your Email Indicator. I checked my setting and sent a test email, and it will through successfully. I even did SendMail(), and it work as it should.

                      But Share() doesn't work and your Email Indicator doesn't work.

                      Any troubleshooting techniques I can use to get down to the issue?

                      Thanks, again for your patience and willingness to help.

                      Comment


                        #12
                        Hi, the original script works as long as you have a share service set up. Do you see any errors in the Log tab of your Control Center?

                        Comment


                          #13
                          Hello, Chris

                          No. I don't see any errors. I didn't change anything in the script so I have no clue as to what happened. I'm still troubleshooting, backtracking my steps to see what I find.

                          I may need to delete the share service set up and re-do it.

                          Comment


                            #14
                            Good morning Chris,

                            Is possible for me to write a script to show the PnL of the trade it just made in the email text?

                            Comment


                              #15
                              Hi AdeptistJune, It is posisble. Use the OnPositionUpdate method and SendMail to do this:



                              The scripts that are up on the ecosystem website come As Is, so I will not be able to add any more functionality to this example, but it is definitely possible.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Yesterday, 05:17 AM
                              0 responses
                              65 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              139 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              75 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              45 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              50 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X