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

Submit a screenshot of the chart

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

    Submit a screenshot of the chart

    Hello, I have an indicator that sends me correctly by email if one of the conditions that I want is met. I have added the possibility to send a screenshot of the chart and sometimes it has done it but many times. I think the code is not correct, can you please tell me how to send an email with a screenshot? Surely my code is wrong. I have read all the threads about sending a chart by mail but it has not been possible. I send you the code that I have.
    Thanks in advance.

    if (SendEmailForConditionC)
    {
    SendMail(toEmailAddress, "SELL", "¿YES? " + Time[0].ToString() + " chart de " + BarsPeriod.Value.ToString() + " " + BarsPeriodType.Minute);
    }
    if (ScreenShotSent)

    {
    SendMailChart("Subject","This is the body of the email","[email protected]","[email protected]"," smtp.gmail.com",587,"YourEmailUsername","YourEmail Password");
    ScreenShotSent = true;
    }

    else
    {
    ConditionCTrue = false;
    ScreenShotSent = false;
    }


    #2
    Hello punkiy2111,

    From the given code I can't see what you are doing in the methods you made to send the messages. Are you using the Share Service to send the email? Generally you would save the screenshot as a file and store the path to that file as a variable. Share can then be used with the overload with an attachment file:



    Share(string serviceName, string message, string screenshotPath)

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Could you please send me an example or a file where I can serve to add to my indicator? or do you just use the "share" command and that's it?
      Thanks in advance.

      Comment


        #4
        Hello punkiy2111,

        You can see the link I provided for more information about the "Share()" method. Once you take a screenshot you would need to save that to file. After doing that the Share method takes a file path to a screenshot. Using Share is the easiest way to send emails, you would configure the email in the share services list in the Tools -> Options menu and then just call Share() when you want to send an email using that service.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Thanks for answering but what worries me is knowing in a simple way how to make a ninjatrader screenshot and save it so that later with "share" it calls it, could you explain to me how to make that capture and save it, which is the most difficult thing for me ? Thank you so much

          Comment


            #6
            Hello punkiy2111,

            What code or sample did you use for the screenshot code you mentioned in post 1?

            You can find examples of taking screenshots in the following post: https://ninjatrader.com/support/foru...865#post717865

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              I used this code and adapted it to my indicator but the problem I have is that it sends me a lot of screenshots, it goes crazy ...

              https://ninjatrader.com/support/foru...re?postcount=7

              ChartToEmail.cs
              Last edited by punkiy2111; 10-04-2021, 01:30 PM.

              Comment


                #8
                Hello punkiy2111,

                You could see the link I provided for an example of saving the file instead of using a memory stream. The Share command could be used with the saved file.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Thank you very much, it seems fine to me, but of the 2 files, which one should I choose? and can this code be added to my indicator or is it to run in a separate indicator?

                  Comment


                    #10
                    Hello punkiy2111,

                    If the problem with the file you provided is that the condition happens too frequently then you may need to modify that logic to accommodate what your goal is. You could otherwise make a new script or use the one you mentioned in post #1 to use the Share method. Either script shows an example of how to get the image it would just depend on your logic to control when that gets called.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment


                      #11
                      You could with the code of the first post that I have taken from the file that I sent you modify that code so that it could work? Thank you

                      Comment


                        #12
                        Hello punkiy2111,

                        I wouldn't be able to modify it for you, this also depends on what you want overall. You already have two working examples of saving the image and then one working example of sending it. If the problem you had with the sending is that it was too frequent then you would need to add more to the condition so it happens less frequently.

                        I look forward to being of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          Is there someone from the technical service who can help me?

                          Comment


                            #14
                            Hello,

                            Thank you for your post.

                            You can search our list of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
                            You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

                            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 companies and services 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.

                            Let me know if I may be of further assistance.
                            Thomas C.NinjaTrader Customer Service

                            Comment


                              #15
                              I have finally been able to make it work, it takes the screen capture and saves it to me but does not send it by email.

                              I am interested that you send me the email with the body, the time and the time frame of the chart.
                              I want this to appear the same as I have it with the "sendmail" command and to attach the screenshot to me. Is it possible to do it with "sendmail" or is it only necessary to use "share"? with "sendmail" it works fine thank you very much.



                              I have it like this.


                              if (SendEmailForConditionA)
                              {
                              SendMail(toEmailAddress, "RED", "Relative sell " + Time[0].ToString() + " chart de " + BarsPeriod.Value.ToString() + " " + BarsPeriodType.Minute);
                              Share("Email", "Example Image", @"C:\Users\Mypc\Documents\NinjaTrader 8\MyScreenshot.png", new object[]{"[email protected]","test e-mail with image"});
                              takeShot = true;
                              }
                              }
                              else
                              {

                              takeShot = false;

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Rapine Heihei, Today, 08:19 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by Rapine Heihei, Today, 08:25 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post Rapine Heihei  
                              Started by f.saeidi, Today, 08:01 PM
                              1 response
                              4 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by Rapine Heihei, Today, 07:51 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Rapine Heihei  
                              Started by frslvr, 04-11-2024, 07:26 AM
                              5 responses
                              97 views
                              1 like
                              Last Post caryc123  
                              Working...
                              X