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

Windows Form, load .pdf

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

    #16
    Originally posted by sledge View Post
    You could add a flag to say that you have loaded this file and check that flag.

    Reset the flag on the next day in a window of 7am to 730am or something... then after that load the bulletin.txt and set the flag to say it was loaded.
    yeah, I've tried, but have one problem.
    How to recognize that user open indicator properties dialog and make some changes?
    In that case I have to reset flag = false - that is a point

    Comment


      #17
      Thank you for your response.
      In that case you would not need the OnBarUpdate().
      Is there a way to check that indicator property was changed ?
      (its the same when you press "Apply / OK" btns on the Indicators window)

      Still not sure in what context you are referring to this. Can you provide an example?
      I showed you in attached screen what I want...
      smth like:

      for (var i = 0; i < 6; i++)
      {
      Category category = new Category("category1");

      Property display = new Property (Boolean, "Display");
      display.setAttribute(......);
      category.append(display);
      .....
      }
      I am sure there is ability to do this, but have to know what classes to use.

      Correct, the indicator when removed should also remove it's drawing objects/
      How to loop the circle of all drawing objects to check which one was created by me?
      Attached Files

      Comment


        #18
        Hello akushyn,

        Thank you for your response.

        I guess you would need to know when to check, when do you want to check the options have changed?

        Aside from setting these options in the code as you normally would, you could set the options again in code when you click the settings button or if this is a form as well you could create fields that set the options. I believe I understood you here, if not please let me know.

        For the drawing tools loop, do you mean which ones were created manually?
        You can use the example in the IDrawObject link below and check for the UserDrawn bool: http://www.ninjatrader.com/support/h...drawobject.htm

        Comment


          #19
          Hello,
          thank you for the response.

          How to do calculations only for the current day ?
          Because when I have let say 45 days of history , m5 timeframe, the indicator precess a lot of useless calculations and is very heavy.

          Hello akushyn,

          Thank you for your response.

          I guess you would need to know when to check, when do you want to check the options have changed?


          Aside from setting these options in the code as you normally would, you could set the options again in code when you click the settings button or if this is a form as well you could create fields that set the options. I believe I understood you here, if not please let me know.
          Custom forms/buttons, methods is clear for me how to do this.
          The issue is how to monitor pressing OK or Apply button on the build in "Indicators" dialog (you use hot key Ctrl+I on the chart to call this ninja dialog)

          For the drawing tools loop, do you mean which ones were created manually?
          You can use the example in the IDrawObject link below and check for the UserDrawn bool: http://www.ninjatrader.com/support/h...drawobject.htm
          That is what i was looking for.
          What override method have i to use to implement logic of clearing objects: OnTerminate or OnDispose?
          Last edited by akushyn; 09-23-2014, 11:54 AM.

          Comment


            #20
            Hello akushyn,

            Thank you for your response.

            You could check the bar's timestamp against your PC time. For example:
            Code:
            if(Time[0].Day != DateTime.Now.Day)
            return;
            There is no way to directly monitor the OK button on the Indicators menu.

            OnTermination() would be when the indicator is removed, so this would be the method to use.

            Comment


              #21
              Originally posted by NinjaTrader_PatrickH View Post
              Hello akushyn,
              For the drawing tools loop, do you mean which ones were created manually?
              You can use the example in the IDrawObject link below and check for the UserDrawn bool: http://www.ninjatrader.com/support/h...drawobject.htm
              Hello,
              Thank you Patrick for the response.

              When I try to use IDrawObject sometimes I get exception
              "Error on calling 'OnTermination' method for indicator 'akOptionLevels': Collection was modified; enumeration operation may not execute."

              Hot to fix it?
              Inside OnTermination there is a code:

              Code:
              		protected override void OnTermination()
              		{
              			// Disposes resources used by the StreamReader
              			if (reader != null)
              			{
              				reader.Dispose();
              				reader = null;
              			}
              			
              			// clear custom created objects on termination
              			foreach (IDrawObject draw in DrawObjects)
              			{	
              				if (draw.Tag.Contains(OPTION_LEVEL_TAG))
              					RemoveDrawObject(draw.Tag);	
              			}
              		}
              where OPTION_LEVEL_TAG is a static string

              Code:
              		public static string OPTION_LEVEL_TAG = "option.level";
              And there is a part of code, where I add drawing :

              Code:
              		// draw filtered horizontal levels 
              		private void displayCategory(int index, List<AkOptionLevel> list)
              		{
              			// loop circle and draw levels
              			for (int i = 0; i < list.Count; i++) 
              			{
              				DrawLine(OPTION_LEVEL_TAG + index.ToString() + i.ToString(), false, startSession, list[i].Price, endSession, list[i].Price, list[i].Color, list[i].Style, list[i].Width);
              			}
              		}
              If you need more details I can attach a script file.

              Comment


                #22
                Hello akushyn,

                Thank you for your response.

                The drawing objects that are drawn by the indicator will be removed when you remove the indicator, there is no need to cycle through them and remove them via code.

                Comment


                  #23
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello akushyn,

                  Thank you for your response.

                  The drawing objects that are drawn by the indicator will be removed when you remove the indicator, there is no need to cycle through them and remove them via code.
                  Ok, I see, thank you for the answer.
                  when the user set Display property = false I have to clear useless drawing, so in any case I have to cycle through drawing items.

                  What would you recomend in this case?

                  Comment


                    #24
                    Hello akushyn,

                    Thank you for your response.

                    I am not sure I understand, is the Display a property you have created? Can you provide a sample script?

                    Comment


                      #25
                      Originally posted by NinjaTrader_PatrickH View Post
                      Hello akushyn,

                      Thank you for your response.

                      I am not sure I understand, is the Display a property you have created? Can you provide a sample script?
                      Sure, the script in attached file.
                      Code commented.
                      Attached Files

                      Comment


                        #26
                        Hello akushyn,

                        Thank you for your patience.

                        Please send me your log and trace files for today so that I may look into what occurred. You can do this by going to the Control Center-> Help-> Mail to Platform Support. Please place this thread in the subject line: "http://www.ninjatrader.com/support/forum/showthread.php?t=68349"

                        Comment


                          #27
                          Hello Akushyn,

                          The reason for this message is because you cannot remove the objects from the collection when reading in a foreach loop.

                          You would need to create a list of the objects that you want to remove, run the first foreach to assign the objects to the list, then another for each for the list to remove them.
                          See the thread below on more information -
                          http://www.ninjatrader.com/support/f...ad.php?t=44194
                          Cal H.NinjaTrader Customer Service

                          Comment


                            #28
                            Hello,

                            Have an issue, can't find the why it happend.
                            The draw object (s) not delete at all.

                            I do create manually simple indicator , when the custom (string) property empy = draw text fixed, else remove drawing.

                            Code:
                                [Description("Enter the description of your new custom indicator here")]
                                public class akRemoveDrawing : Indicator
                                {
                            		private string path = "D:\\Dropbox\\Camera Uploads";
                            
                                    protected override void Initialize()
                                    {
                                        Overlay				= true;
                            			CalculateOnBarClose = false;
                                    }
                            
                                    protected override void OnBarUpdate()
                                    {			
                            			if (Path.Trim().Length <= 0)
                            				DrawTextFixed("invalid.path", "The path of bulletin file is not defined or empty.", TextPosition.BottomRight, Color.Red, new Font(FontFamily.GenericSerif, 12), Color.Empty, Color.Empty, 100);
                            			else
                            				RemoveDrawObject("invalid.path");
                                    }
                            
                            		[Description("")]
                                    [GridCategory("Parameters")]
                                    public string Path
                                    {
                                        get { return path; }
                                        set { path = value; }
                                    }
                                }
                            This code work well.
                            The same I do in my indicator. I 've commended already everything else and still not working....

                            Attached the indicator file. Could pls someone look what is going on?
                            Attached Files

                            Comment


                              #29
                              Hi akushyn,

                              Are you removing the text box that was drawn by the script or a text box that was drawn manually?

                              If the string is not "" i would imagine no text box would be drawn at all. The string itself shouldn't change as the script starts running.

                              Are you finding the text box is being drawn?
                              Does this mean that the string is empty?
                              If the string is empty why would the text box be removed?
                              Chelsea B.NinjaTrader Customer Service

                              Comment


                                #30
                                Originally posted by NinjaTrader_ChelseaB View Post
                                Hi akushyn,

                                Are you removing the text box that was drawn by the script or a text box that was drawn manually?

                                If the string is not "" i would imagine no text box would be drawn at all. The string itself shouldn't change as the script starts running.

                                Are you finding the text box is being drawn?
                                Does this mean that the string is empty?
                                If the string is empty why would the text box be removed?
                                Thanks for questions. I got it )))

                                Have one more question...
                                How is it possible to use empty value for int custom property?

                                I would like to use empty values when I want to use all of values.
                                Let say I have array with 100 size. Each element has value and I want to filter values according to filter rules.
                                I set Min Volume and Max Volume. And want to say the program that 'empty' means all of values. Could you advise how is it possible to do?

                                See attached screen.
                                Attached Files
                                Last edited by akushyn; 09-29-2014, 10:36 PM.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by rhyminkevin, Today, 04:58 PM
                                3 responses
                                48 views
                                0 likes
                                Last Post Anfedport  
                                Started by iceman2018, Today, 05:07 PM
                                0 responses
                                5 views
                                0 likes
                                Last Post iceman2018  
                                Started by lightsun47, Today, 03:51 PM
                                0 responses
                                7 views
                                0 likes
                                Last Post lightsun47  
                                Started by 00nevest, Today, 02:27 PM
                                1 response
                                14 views
                                0 likes
                                Last Post 00nevest  
                                Started by futtrader, 04-21-2024, 01:50 AM
                                4 responses
                                50 views
                                0 likes
                                Last Post futtrader  
                                Working...
                                X