Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

position shapes

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

    position shapes

    Hello,

    I want to ask please as I couldn´t find in the helpguide how do to eg drawdot not at a current bar but to have it at the right margin of chart (eg when I do drawhorizontalline this is plotted from the left to the right margin of chart). To keep the chart clean I want to draw a dot at the right margin of the window and not with the bars.

    Thanks
    Tony

    #2
    Hello Tony,
    Unfortunately you cannot draw a dot on the margin using the DrawDot method.

    As an alternative you can draw a custom shape in the Plot override using the graphic object.

    Code:
    public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
    {
    	graphics.DrawEllipse(....);
    }
    Unfortunately the Plot override is not supported by us, however you can take reference from the CustomPlotSample indicator that comes with NinjaTrader.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Originally posted by tonynt View Post
      Hello,

      I want to ask please as I couldn´t find in the helpguide how do to eg drawdot not at a current bar but to have it at the right margin of chart (eg when I do drawhorizontalline this is plotted from the left to the right margin of chart). To keep the chart clean I want to draw a dot at the right margin of the window and not with the bars.

      Thanks
      Tony
      Officially not supported, but you can use a negative offset for the dot "x" position.

      Comment


        #4
        koganam,

        thank you very much for your reply. Dont want to bother you but could you shortly show me how you would do this?

        Thanks in advance.

        Best
        Tony

        Originally posted by koganam View Post
        Officially not supported, but you can use a negative offset for the dot "x" position.

        Comment


          #5
          Hello Tony,
          You can use this code
          Code:
          this.DrawDot("dot", false,[B] -5[/B], Close[0], Color.Blue);
          @koganam, thanks for your input.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Thank you both for your ideas!

            But there appears the error-message "No overload for method DrawDot takes 6 arguments



            Originally posted by NinjaTrader_Joydeep View Post
            Hello Tony,
            You can use this code
            Code:
            this.DrawDot("dot", false,[B] -5[/B], Close[0], Color.Blue);
            @koganam, thanks for your input.
            Last edited by tonynt; 10-16-2012, 11:17 AM.

            Comment


              #7
              Hello,

              or is it possible to draw at CurrentAsk-Price a line starting from right margin with a certain size to the left? Eg with size of RightSizeMargin?

              Thanks
              Tony

              Originally posted by NinjaTrader_Joydeep View Post
              Hello Tony,
              Unfortunately you cannot draw a dot on the margin using the DrawDot method.

              As an alternative you can draw a custom shape in the Plot override using the graphic object.

              Code:
              public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
              {
                  graphics.DrawEllipse(....);
              }
              Unfortunately the Plot override is not supported by us, however you can take reference from the CustomPlotSample indicator that comes with NinjaTrader.

              Comment


                #8
                Hello Tony,
                To assist you further may I know what code you have used to draw the dot?

                Yes, you can append a line too on the right side of the margin. Please try the below code to do it
                Code:
                this.DrawLine("line", false, 0, this.GetCurrentAsk(), -5, this.GetCurrentAsk(), Color.Blue, DashStyle.Solid, 2);
                JoydeepNinjaTrader Customer Service

                Comment


                  #9
                  Hi,

                  thanks for your reply. Maybe there is a misunderstanding. I try again:

                  With "Drawxxx............. there should be a horizontalline at currentprice BUT fixed on right sid margin and with a certain size (eg same size/length as righsidemargin, so that line starts on right margin and ends always on most recent bar - at fixed price, eg entry price)

                  (Why is in your code 2 times ask?)

                  Thanks
                  Tony

                  Originally posted by NinjaTrader_Joydeep View Post
                  Hello Tony,
                  To assist you further may I know what code you have used to draw the dot?

                  Yes, you can append a line too on the right side of the margin. Please try the below code to do it
                  Code:
                  this.DrawLine("line", false, 0, this.GetCurrentAsk(), -5, this.GetCurrentAsk(), Color.Blue, DashStyle.Solid, 2);
                  Last edited by tonynt; 10-16-2012, 01:36 PM.

                  Comment


                    #10
                    Originally posted by tonynt View Post
                    Hi,

                    thanks for your reply. Maybe there is a misunderstanding. I try again:

                    With "Drawxxx............. there should be a horizontalline at currentprice BUT fixed on right sid margin and with a certain size (eg same size/length as righsidemargin, so that line starts on right margin and ends always on most recent bar - at fixed price, eg entry price)

                    (Why is in your code 2 times ask?)

                    Thanks
                    Tony
                    Code:
                    private bool MktPosFlat = true;
                    private double entryPrice = 0.00;
                    Code:
                    if (ConditionsToEnter && MktPosFlat) 
                    {
                    entryPrice = GetCurrentAsk();
                    MktPosFlat = false;
                    }
                    this.DrawLine("line", false, 0, entryPrice, -5, entryPrice, Color.Blue, DashStyle.Solid, 2);
                    IOW, you just have to record the entryPrice and then use it in your drawing.

                    Comment


                      #11
                      Hello koganam,

                      I want to thank you for your help. If I can share the idea if you´re interested, this way I dont need anymore another chart with chart-trader "to make visible" the trade with entry, stops and targets. Now I have these lines in the same chart as my strategies and the lines are not filling up the chart but are seperate at the right margin and are nicely to view.

                      (It works with DrawLine "X" and eg if flat{Remove DrawObject "X")} but what I do not understand is why the line is not removed when I do with "X" +CurrentBar and then eg if flat({Remove DrawObject("X2 +CurrentBar)}. The lines remain on the chart with CurrentBar.

                      Thanks again!

                      Best regards
                      Tony
                      Last edited by tonynt; 10-18-2012, 12:56 PM. Reason: clearify

                      Comment


                        #12
                        Originally posted by tonynt View Post
                        Hello koganam,

                        I want to thank you for your help. If I can share the idea if you´re interested, this way I dont need anymore another chart with chart-trader "to make visible" the trade with entry, stops and targets. Now I have these lines in the same chart as my strategies and the lines are not filling up the chart but are seperate at the right margin and are nicely to view.

                        (It works with DrawLine "X" and eg if flat{Remove DrawObject "X")} but what I do not understand is why the line is not removed when I do with "X" +CurrentBar and then eg if flat({Remove DrawObject("X2 +CurrentBar)}. The lines remain on the chart with CurrentBar.

                        Thanks again!

                        Best regards
                        Tony
                        I believe that I have already explained that as CurrentBar is not a fixed value, you can use it to create unique tags. Therefore, the tag that includes CurrentBar as part of its definition is different on every bar. so if you call it by that tag at the time that you want to delete an object, it CANNOT be the correct tag, unless you are on the same exact bar on which you drew the object, a most unlikely scenario from what you describe as your scenario. "X" is "X", is always "X": CurrentBar on bar 1 is 1 and on bar n, it is n, so it is a different value.

                        Comment


                          #13
                          Thank you!

                          Originally posted by koganam View Post
                          I believe that I have already explained that as CurrentBar is not a fixed value, you can use it to create unique tags. Therefore, the tag that includes CurrentBar as part of its definition is different on every bar. so if you call it by that tag at the time that you want to delete an object, it CANNOT be the correct tag, unless you are on the same exact bar on which you drew the object, a most unlikely scenario from what you describe as your scenario. "X" is "X", is always "X": CurrentBar on bar 1 is 1 and on bar n, it is n, so it is a different value.

                          Comment


                            #14
                            Originally posted by tonynt View Post
                            Thank you!
                            Now that we have gone through all that, where I answered the exact question that you asked, seeing as how your question evinced an obvious desire to understand and solve the problem, rather than just get a cut-and-dried answer, I have a question for you.

                            If you want the line drawn to the right margin, why are you not using DrawRay(), which draws to the margin by design?

                            Comment


                              #15
                              Originally posted by tonynt View Post
                              Hello koganam,

                              I want to thank you for your help. If I can share the idea if you´re interested, this way I dont need anymore another chart with chart-trader "to make visible" the trade with entry, stops and targets. Now I have these lines in the same chart as my strategies and the lines are not filling up the chart but are seperate at the right margin and are nicely to view.
                              ...
                              Thanks for the offer, but part of the reason why I knew the answer so quickly is that I use the idea myself in the Heiken-Ashi Smoothed indicator that I shared in the forum, albeit I am using the actual closing price of the candle, so that it is displayed separately from the Heiken-Ashi candle.

                              That code is open, so you may care to take a look?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by rocketman7, Today, 09:41 AM
                              4 responses
                              15 views
                              0 likes
                              Last Post rocketman7  
                              Started by selu72, Today, 02:01 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by WHICKED, Today, 02:02 PM
                              2 responses
                              13 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by f.saeidi, Today, 12:14 PM
                              8 responses
                              21 views
                              0 likes
                              Last Post f.saeidi  
                              Started by Mikey_, 03-23-2024, 05:59 PM
                              3 responses
                              56 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Working...
                              X