Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to draw more than 1 line in PricePanel?

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

    How to draw more than 1 line in PricePanel?

    Hi,
    Could somebody help me please? I'm trying to draw 2lines in PricePanel, see code sample, but only the last one always appear. I don't know what I'm doing wrong?
    Many thanks for any idea how to do it.
    jaspee

    code sample:
    Code:
    protected override void OnBarUpdate()
            {
                // Use this method for calculating your indicator values. Assign a value to each
                // plot below by replacing 'Close[0]' with your own formula.
                //Plot0.Set(Close[0]);
    			
    			int startBar = CurrentBar - Bars.GetBar (new DateTime (2015,2,12,19,27,00));
    			int endBar  = CurrentBar - Bars.GetBar (new DateTime (2015,2,12,21,21,00));
    			int deltaAgo = endBar - startBar;
    			
    			//DrawLine(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)
    			
    			if (CurrentBar > 20)
    			{
    			DrawOnPricePanel = true;
    			//DrawLine("tagEntry",5,2082,0,2086,Color.Blue );
    			DrawLine("tagEntry",true,new DateTime (2015,2,12,19,27,00),Open[startBar],new DateTime (2015,2,12,21,21,00),Close[endBar],Color.Blue ,DashStyle.Dash,3);
    			
    			DrawOnPricePanel = true;	
    			DrawLine("tagEntry",true,new DateTime (2015,2,12,19,45,00),Open[startBar],new DateTime (2015,2,12,21,21,00),Close[endBar],Color.Blue ,DashStyle.Dash,3);
    			
    			DrawOnPricePanel = false;

    #2
    Hello jaspee,

    Thanks for your post and welcome to the forum.

    When you draw an object it is important that each drawn object have a unique tag name, otherwise the last drawn object with the same tag name will replace any previous with the same name.

    So in your example you could change one to tag1 and the other to tag2 (instead of "tagEntry"). Both lines will then be drawn and will be updated on each OnBarUpdate.

    Please let me know if I can be of further assistance
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Paul,
      thank you for your time and solution. Now I know where was my mistake.
      I just corrected, and it works :-) Great!

      be honest, I've got one more question regarding to drawing. So if you could be so kind any info will be appreciated. I would like to draw circle with diameter 10pt for ES market with central point in same position as is actually mouse CrossCursor over the chart and when mouse cursor move, circle move it together with. Like circle will be drawn arround the cursor and move together as one when mouse will be moving. Such as gauge arround cursor.
      Many thanks for any idea.
      jaspee

      Comment


        #4
        Hello jaspee,

        Thanks for your reply.

        I am not aware of a method to do that and likely would be unsupported.

        Here is a link to a thread that may provide some good references: http://www.ninjatrader.com/support/f...ad.php?t=23979

        Please let me know if I can be of further assistance
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Paul,
          many thanks for your reply and link. It is good reference. It's a pity that custom cursor is not supported. Anyway never mind.
          jaspee

          Comment


            #6
            Here is one...

            Have a look at this free tool available here. Its size is determined by the number of ticks in its radius.
            There is also a full featured version here.
            Dan
            Attached Files
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Belfortbucks, Today, 09:29 PM
            0 responses
            6 views
            0 likes
            Last Post Belfortbucks  
            Started by zstheorist, Today, 07:52 PM
            0 responses
            7 views
            0 likes
            Last Post zstheorist  
            Started by pmachiraju, 11-01-2023, 04:46 AM
            8 responses
            151 views
            0 likes
            Last Post rehmans
            by rehmans
             
            Started by mattbsea, Today, 05:44 PM
            0 responses
            6 views
            0 likes
            Last Post mattbsea  
            Started by RideMe, 04-07-2024, 04:54 PM
            6 responses
            33 views
            0 likes
            Last Post RideMe
            by RideMe
             
            Working...
            X