• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hiding multiple condition arrows

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

    Hiding multiple condition arrows

    Hello,
    I have a bit of a house cleaning issue that I can't figure out and am hoping for some help.
    I have several conditions that print arrows as is shown in the attachment. Obviously the arrows print when the condition is true, but I only want to see the arrow when the condition is true the first time. Is there a way to allow the condition to be true for each succeeding bar but only print the arrow on the first bar? Any ideas?
    Thanks.
    Attached Files

    #2
    Hello CaptainAmericaXX,

    Thank you for the post.

    You would need to use logic to control this, likely a bool variable would work for this use case. You would also need to reset this at some point so the arrow can be drawn for future conditions when you wanted it. A simple example would be toggling between two conditions, you want the first arrow drawn and skip each arrow after that until the opposing condition which it can be reset. Here is a simple example of that use case:

    Code:
    bool canDrawArrowUp = true;
    bool canDrawArrowDown = true;
    protected override void OnBarUpdate()
    {
        if(CurrentBar < 1) return;
        if(Close[0] < Open[1])
        {
            if(canDrawArrowUp)
            {
                Draw.ArrowUp(this,"up"+ CurrentBar, true, 0, Close[0], Brushes.Red);
                canDrawArrowUp = false;    
                canDrawArrowDown = true;
            }
        } 
    
        else if(Close[0] > Open[1])
        {
            if(canDrawArrowDown)
            {
                Draw.ArrowDown(this,"down" + CurrentBar, true, 0, Close[0], Brushes.Green);
                canDrawArrowUp = true;    
                canDrawArrowDown = false;
            }
        } 
    }
    In this use case if the close is greater or lesser than the open of the prior bar delegates if an arrow is drawn.

    Without using any logic, this is drawn on nearly every bar:
    Click image for larger version

Name:	2019-03-12_1159_001.png
Views:	1
Size:	4.6 KB
ID:	1051110

    Using the bool conditions allows you to control when these happen:

    Click image for larger version

Name:	2019-03-12_1159.png
Views:	1
Size:	3.3 KB
ID:	1051111
    JesseNinjaTrader Customer Service

    Comment


      #3
      Ahh, simple enough. Thanks Jesse!

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello CaptainAmericaXX,

        Thank you for the post.

        You would need to use logic to control this, likely a bool variable would work for this use case. You would also need to reset this at some point so the arrow can be drawn for future conditions when you wanted it. A simple example would be toggling between two conditions, you want the first arrow drawn and skip each arrow after that until the opposing condition which it can be reset. Here is a simple example of that use case:
        Hi Jesse,

        Jim suggested a simple one bool approach here that I believe produces the same result. Is that the case?

        Thanks.

        https://ninjatrader.com/support/foru...62#post1050962

        Comment


          #5
          Hello aligator,

          Yes, it looks this would be another way to accomplish the task.

          Please let me know if I may be of additional assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rickyblah12, Today, 08:17 PM
          0 responses
          4 views
          0 likes
          Last Post rickyblah12  
          Started by mrlucky1x, Today, 08:07 PM
          0 responses
          2 views
          0 likes
          Last Post mrlucky1x  
          Started by uday12, Today, 07:21 PM
          0 responses
          3 views
          0 likes
          Last Post uday12
          by uday12
           
          Started by voltlon, Today, 05:18 PM
          0 responses
          6 views
          0 likes
          Last Post voltlon
          by voltlon
           
          Started by Bobisam, Today, 04:57 PM
          0 responses
          8 views
          0 likes
          Last Post Bobisam
          by Bobisam
           
          Working...
          X