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

    #31
    Hello ,

    I am not understanding your question.

    When you mention "want to say the program that 'empty' means all of values" what are hoping to have happen?

    An int will need to have a value but can be set to 0.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #32
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello ,

      I am not understanding your question.

      When you mention "want to say the program that 'empty' means all of values" what are hoping to have happen?

      An int will need to have a value but can be set to 0.
      Sorry for my pure english)
      Will try to explain what i want to do.

      I have array of different integer elements . Value of each element can be from 0 to maximum.

      And I have two custom properties 'Min' and 'Max' .
      User set Min and Max values and the script gets only values between min and max.
      This is , I think is clear.

      As a example I want to get values let say from
      * min = 30 and
      * max = nolimit , what means that all values from array greather than 30

      And the question is what to set to the 'Max' property, in this case?

      Comment


        #33
        Hi akushyn,

        It would not be possible to not set a value for an int.

        But you can have your logic decide that a 0 means unlimited.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #34
          Originally posted by NinjaTrader_ChelseaB View Post
          Hi akushyn,

          It would not be possible to not set a value for an int.

          But you can have your logic decide that a 0 means unlimited.
          0 it would be a good, but 0 can be in array.

          May be, some how to set = -1 as unlimited ?
          I've tried smth like this, but not working correctly

          Code:
          if (level.Volume >= category.MinVolume && (level.Volume <= category.MaxVolume || category.MaxVolume == -1))
          {
              // do smth
          }

          Comment


            #35
            Hi akushyn,

            You could use -1 if you like.

            You could also use an extra bool variable instead of a particular value to prevent this.
            So when the bool is true, it uses all instead of a max.

            The code you wrote does appear correct.
            Did you add any prints to see what values the condition is getting?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #36
              Thank you for the response.

              I would like to draw text on the left of each level.
              So, have 2 questions:
              1) how to draw the text
              2) how to determine the position where to draw?

              I think have to use DrawText() function.

              --
              Andriy
              Attached Files

              Comment


                #37
                Hi Andriy,

                To draw text use the DrawText() or DrawTextFixed() calls.

                For example, to draw the word hello 3 ticks above the high of the 1 bar ago use:

                DrawText("myText"+CurrentBar, "Hello", 1, High[0]+3*TickSize, Color.Blue);
                DrawText(string tag, string text, int barsAgo, double y, Color color)

                Below are links to the help guide.

                DrawText() - http://www.ninjatrader.com/support/h...7/drawtext.htm

                DrawTextFixed - http://www.ninjatrader.com/support/h...wtextfixed.htm
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #38
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hi Andriy,

                  To draw text use the DrawText() or DrawTextFixed() calls.

                  For example, to draw the word hello 3 ticks above the high of the 1 bar ago use:

                  DrawText("myText"+CurrentBar, "Hello", 1, High[0]+3*TickSize, Color.Blue);
                  DrawText(string tag, string text, int barsAgo, double y, Color color)

                  Below are links to the help guide.

                  DrawText() - http://www.ninjatrader.com/support/h...7/drawtext.htm

                  DrawTextFixed - http://www.ninjatrader.com/support/h...wtextfixed.htm
                  Thank you for quick reply.
                  I know how to draw above or below the bar.

                  Originally posted by akushyn View Post
                  I would like to draw text on the left of each level.
                  ....
                  I draw horizontal lines (see picture in previous post)
                  Would like to draw text close to the each horizontal level exactly on the left side.

                  Comment


                    #39
                    I use the function bellow:

                    Code:
                    		private void displayAverageLevel(bool displayLevel, bool displayText, string tag, double price)
                    		{
                    			if (displayLevel)
                    			{
                    				DrawLine(tag, false, startSession, price, endSession, price, AverageLevelColor, AverageDashStyle, AverageWidth);
                    				
                    				string textTag = "";
                    				if (displayText)
                    				{
                    					textTag = tag + ".text";
                    					
                    					[B]// do draw text on the left side of 'startSession'
                    					//DrawText();[/B]
                    				}
                    				else
                    					RemoveDrawObject(textTag);
                    			}
                    			else
                    				RemoveDrawObject(tag);
                    		}

                    Comment


                      #40
                      Hello akushyn,

                      Thank you for your response.

                      Use GetBar() and the startSession DateTime object to call that barsAgo index and then add one to place it one bar back. For example:
                      Code:
                      int barsAgo = CurrentBar - Bars.GetBar(startSession);
                      DrawText("tag", price.ToString(), barsAgo, price, Color.Blue);
                      For information on GetBar() please visit the following link: http://www.ninjatrader.com/support/h...nt7/getbar.htm

                      Comment


                        #41
                        Originally posted by NinjaTrader_PatrickH View Post
                        Hello akushyn,

                        Thank you for your response.

                        Use GetBar() and the startSession DateTime object to call that barsAgo index and then add one to place it one bar back. For example:
                        Code:
                        int barsAgo = CurrentBar -[B] Bars.GetBar(startSession);[/B]
                        DrawText("tag", price.ToString(), barsAgo, price, Color.Blue);
                        For information on GetBar() please visit the following link: http://www.ninjatrader.com/support/h...nt7/getbar.htm
                        Thank you Patrick.
                        The method GetBar is what I was looking for.

                        Comment


                          #42
                          Originally posted by NinjaTrader_PatrickH View Post
                          Have some more questons... and need advise

                          Let say, I read 10 bulletin files.
                          When reading finish, I have array of bulletin objects. Each bulletin has Date property. I have to draw horizontal lines (levels) on history on exact Date.

                          Example:
                          bulletin[0].Date = "29.09.2014"; --> have to draw on 29.09.2014
                          bulletin[1].Date = "01.10.2014"
                          ....
                          bulletin[9].Date = "07.10.2014" --> have to draw on 07.10.2014

                          So, how to check the Date in correct way ?
                          And how check that there are enough bars to process OnBarUpdate() method?

                          Comment


                            #43
                            Hello ,

                            Thank you for your post.

                            I would recommend taking a look at the Date property at the following link and the different formats that can be used via ToString(): http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx

                            Comment


                              #44
                              Originally posted by NinjaTrader_PatrickH View Post
                              Hello ,

                              Thank you for your post.

                              I would recommend taking a look at the Date property at the following link and the different formats that can be used via ToString(): http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx
                              thank you for the response.

                              OnBarUpdate work only on currentBar. When I load levels, I dont know enough history or not. Let say I have bulletin with 05.10.2014 date but there are only 3 history days , how to check it ?

                              Because ninjascript will say that you try to draw on 5 bar but there is only 4 bars or smth like this.

                              And also I dont know how to compare bulletin date with ninja date.
                              I want smth like this:

                              Code:
                              // date with format 'dd.mm.yyyy'
                              if (bulletin.Date == Time[0] && enoughHistory == true)
                              {
                                   // do draw levels at this history day
                              }

                              Comment


                                #45
                                Hello akushyn,

                                Thank you for your response.

                                The bulletin[index].Date, what does the .ToString() look like when printed to the Output window (Tools > Output window) using the Print() method?

                                Would the following not work in your testing?
                                Code:
                                if(bullentin[0].Date >= Time[0].Date)
                                {
                                // draw levels
                                }

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by jaybedreamin, Today, 05:56 PM
                                0 responses
                                3 views
                                0 likes
                                Last Post jaybedreamin  
                                Started by DJ888, 04-16-2024, 06:09 PM
                                6 responses
                                18 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post Javierw.ok  
                                Started by timmbbo, Today, 08:59 AM
                                2 responses
                                10 views
                                0 likes
                                Last Post bltdavid  
                                Working...
                                X