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

FileOpen dialog on indicator

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

    FileOpen dialog on indicator

    Ok, Guys,

    I searched whole forum and nobody has answer how to invoke FileOpen dialog to select Alert sound file in Ninja Indicator. However I own proprietary indicator that does exactly that (yes, it is compiled . Also it is absolutely clear that such functionality exists and Ninja developers knows about that. And it is clear that even this info closed || unsupported || whatever it leaked enough that people are using it, it is stable and products with such functionality are sold.

    So, let's be honest, how to do that?

    In addition - how to change plot names in Indicator options to normal words with spaces, not PlotCurrentT3AverageIfSM (instead "T3 average colour"). I saw this implemented too several times.

    Thank you,
    -Andrius.

    #2
    what you are asking is standard C# queries. google a bit and you will get the answer. anyway heres a nt code.

    Code:
    using System.Windows.Forms;
    Code:
    protected override void OnStartUp()
            {
                
                OpenFileDialog file = new OpenFileDialog();
                file.ShowDialog();
                
                string path;
                path = file.FileName;
                MessageBox.Show(path);
                
            }

    Comment


      #3
      Dear bukkan,

      I am aware about OpenFileDialog(); however I fail to understand how to fit it into Indicator's properties dialog under particular field. Please see screenshotted example what I am trying to achieve...

      Thank you,
      -Andrius.
      Attached Files

      Comment


        #4
        For some reason I can't download that JPEG to look at what you are trying to achieve.

        Off the top of my head an enum with a switch statement, say, UserSound that calls the OpenFileDialog if selected should do the trick.

        You might need to watch how you Dispose of things, though.

        Comment


          #5
          ahh the pic made things clear. still its a c# thing and googling will help more rather than searching here.

          heres a sample code

          in the variable region
          Code:
          string open;
          in properties
          Code:
          [Description("")]
                  [GridCategory("Parameters")]
                  [Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
                    typeof(System.Drawing.Design.UITypeEditor))]
                  public string Open
                  {
                      get{return open;}
                      set{open = value;}
                  }

          Comment


            #6
            How about an equivilant for NT6.5? This would be nice!

            Buddy

            Comment


              #7
              Dear Buddy,

              the same code works for both NT6.5 and NT7. basically you override System.Windows.Forms.Design.FileNameEditor with something bukkan wrote.

              What about second part of my question - any ideas how to change description entry for particular plot? Any ideas how to hide plot style and color select dialog at all?

              Thank you,
              -Andrius.

              Comment


                #8
                The reason I didn't think it would work in 6.5 is because
                // FileNameEditor

                //Does not seem to be valid here

                [Editor(typeof(System.Windows.Forms.Design.FileNameEditor),
                typeof(System.Drawing.Design.UITypeEditor))]


                Then I tried the same in NT7 and found the same thing

                Comment


                  #9
                  Dear Buddy,

                  you need to add referrence to System.Design.dll file for this to complile. Depending on IDE you use this may vary... On Ninja editor just press right click and follow from there.

                  -Andrius.

                  Comment


                    #10
                    I have a similar problem.

                    I want to capture the input parameters for an indicator of a C # form. The call of the OnBarUpdate method should be avoided until the form is closed.

                    my idea is:

                    public class ParmsForm : Form
                    public ParmsForm ()
                    {
                    this.Text = "C# - einfaches Form";
                    this.Size = new Size(600, 400);

                    AddContextMenuAndItems();

                    addControls();

                    }
                    .... .... ....
                    I call the modal form from inside the OnStartup method:
                    protected override void OnStartUp()
                    {
                    ParmsForm parmsForm = new ParmsForm();
                    parmsForm.ShowDialog();
                    }
                    The form is displayed. However, the OnBarUpdate method is called before the form is closed. My parameters are thus in the indicator is still not known.

                    Does anyone provide any solution or idea?

                    Comment


                      #11
                      Do you really want to stop the NT tool? Don't know if that's a good idea. Why don't you use the property grid for input? It is guaranteed to provide its content before the indicator starts operating.
                      If the property grid gets to confusing because you need to input a lot of date, then you could develop something with the expansion functionality of the grid (this little + - signs). Especially, if you have a lot of date with a repetitive structure you could use the property expansion quite effectively.

                      Regards
                      Ralph

                      Comment


                        #12
                        Basically you're right. But In a WinForm, one could structure the input parameters a little bit better.

                        Comment


                          #13
                          Depending on your coding skills it would be possible to add something like a WinForm to the property grid. Advantage still is that you are conform with the rules how NT sets up an indicator. Here is the link to an example illustrating how that could be reached:
                          How to use UITypeEditors, Smart Tags, ControlDesigner Verbs, and Expandable Properties to make design-time editing easier.


                          Regards
                          Ralph

                          Comment


                            #14
                            What is the right way to do this?

                            Originally posted by andrius View Post
                            Dear Buddy,

                            you need to add referrence to System.Design.dll file for this to complile. Depending on IDE you use this may vary... On Ninja editor just press right click and follow from there.

                            -Andrius.
                            For my future reference, what is the easy way to do that (in the NT editor)?
                            • I presume you want just the DLL name so normal search rules are in effect.
                            • Entering the name in the "References... | Add..." dialog forces a fully qualified pathname -- I saw no way to avoid that
                            • I found a likely looking XML file (Config.xml) and edited that -- inserted between System.Core.dll and System.Drawing.dll, to preserve alphabetic order. (I can just see the NT support folks cringing ...)
                            • That worked, but only after stopping and restarting NT

                            I presume there is an easier way -- please enlighten me?

                            --EV
                            Last edited by ETFVoyageur; 01-03-2011, 09:05 PM.

                            Comment


                              #15
                              Originally posted by andrius View Post
                              What about second part of my question - any ideas how to change description entry for particular plot? Any ideas how to hide plot style and color select dialog at all?
                              -Andrius.
                              The name that shows for the plot, is set directly when you define the plot in the Initialize() method, thus:

                              Code:
                                
                              Add(new Plot(Color.Green, "[B]This is the name that shows in the configuration GUI[/B]"));
                              You hide the plot configuration dialog using this line in the Initialize() method:

                              Code:
                              PlotsConfigurable = false;

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by adeelshahzad, Today, 03:54 AM
                              5 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by stafe, 04-15-2024, 08:34 PM
                              7 responses
                              32 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by merzo, 06-25-2023, 02:19 AM
                              10 responses
                              823 views
                              1 like
                              Last Post NinjaTrader_ChristopherJ  
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              21 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Working...
                              X