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

DrawingObject Index

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

    #16
    Hello Tony,
    I use chart marker in my case : Draw.Dot(this, "h_mark" + High[0], false, 0, High[0] + 3, Brushes.Green);
    To remove it : RemoveDrawObject("h_mark" + High[0] );

    I don't mark every high or low, I draw the chart markers based on certain conditions, for example above ema channel - mark highs & below channel - mark lows, then based on another condition for example another ema channel (of some other period ) - remove the markers.
    I can't replicate you exact issue but hope this helps!
    Last edited by s.kinra; 10-17-2020, 12:59 AM.

    Comment


      #17
      Hello s.kinra,

      thank you for your reply. You reply how you remove a drawing object. Thats fine and I do all day long in a script. But the question here is how to "find" the correct drawing tool to be removed when you have more than one? How do you loop through a list to find it when a certain condition is true there and you want to remove this (!) drawing. How you get the correct drawing tool from a list to be removed?

      Best regards
      Tony
      Last edited by tonynt; 10-17-2020, 02:24 AM. Reason: translation error

      Comment


        #18
        Hello Tony,
        I use specific tags for specific drawing tools & to remove point the specific tag. For example : txt_tag for text, h_tag for high price, l_tag for low price, tag_line for lines etc. So I don't want the RemoveDrawObject to identify object type, I just use this command to remove the object I want. This might be too basic for you but it works for me as of now. I use certain condition just to invoke RemoveDrawObject & get it working based on my tag name. I think I keep it simple, quite possible you've much more complex code to deal with. When I am trapped I split it into pieces & try to identify the issue then resolve. Hope it helps!
        Last edited by s.kinra; 10-17-2020, 02:35 AM.

        Comment


          #19
          Hello,
          I was hoping to get some direction. I'm using NT 8 Strategy Builder and I'm trying to have a chart marker print during the building bar if the parameters are true. If during the bar the parameters become false before the building bar closes the chart marker would be removed.
          I'm trying to only remove the last marker and not all of them.
          The code prints the chart marker on the chart but I can't seem to get it to be removed. I've tried to follow the above ideas but have had not luck.
          I hope someone can possibly help with this?

          protected override void OnBarUpdate()
          {
          if (BarsInProgress != 0)
          return;

          DDsignal_buy = false;
          DDsignal_sell = false;
          if (CurrentBars[0] < 1)
          return;

          // Set 2
          if ((GomOrderFlowProValues1.Delta[0] > 0)
          && (GetCurrentBid(0) < Open[0]))
          {
          DDsignal_sell = true;
          }

          // Set 3
          if (DDsignal_sell == true)
          {
          Draw.TriangleDown(this, @"dd_sell1 " + Convert.ToString(CurrentBars[0]), true, 0, High[0], Brushes.Red);
          }

          // Set 4
          if (
          // bid > open
          ((GetCurrentBid(0) > Open[0])
          && (DDsignal_sell == true))
          // delta < 0
          || ((DDsignal_sell == true)
          && (GomOrderFlowProValues1.Delta[0] < 0)))
          {
          DDsignal_sell = false;
          RemoveDrawObject(@"dd_sell1 " + Convert.ToString(CurrentBars[0]));
          }

          Thank you for any help.
          James
          Last edited by laoshr; 11-29-2020, 09:31 AM.

          Comment


            #20
            Hello James,
            Try:
            Code:
            // Set 3
            if (DDsignal_sell)[INDENT]Draw.TriangleDown(this, @"dd_sell1 " + Convert.ToString(CurrentBars[0]), true, 0, High[0], Brushes.Red);[/INDENT]
             else[INDENT]RemoveDrawObject(@"dd_sell1 " + Convert.ToString(CurrentBars[0]));[/INDENT]
            Hope it helps!

            Comment


              #21
              Hello s.kinra, thank you so much for your reply. Can I do what you suggest with the strategy builder? so, if the bool becomes false then removedrawobject? I believe i've tried quite a few of those combos. sorry for my total lack of understanding here. i'm a super noob.
              thanks again for your time and knowledge.
              James

              Comment


                #22
                Hello, I think I'm struggling with figuring out how to the "else" statement in the strategy builder.
                Thank you very much for your time.
                James

                Comment


                  #23
                  Hello James,
                  You may not be able to add else statement with Strategy Builder, instead you need to add another set with DDsignal_sell == false, but it may not work as intended as it will not be linked with earlier & will act as a new condition, there are certain limitations of Strategy Builder but its great way to start & learn. You can try this way & check if it works for you. We all are learning here so no worries.

                  Comment


                    #24
                    Thank you very much. I will try and see what I can do.

                    Comment


                      #25
                      s.kinra That worked. Yea!!! Thank you so much. I was wondering if it is possible to print the signal not on the price chart but in its own panel below the price chart? Thanks again so much. That was a big breakthrough for me. LOL
                      James

                      Comment


                        #26
                        Hello James,
                        Yes you can do this, be sure to have
                        Code:
                        DrawOnPricePanel = false;

                        Comment


                          #27
                          Hello s.kinra,
                          You helped me tremendously a while back. I ran into an issue and can't seem to figure out how to fix it. Any help would be greatly appreciated.
                          The EMA shading only updates every so often and not on each bar (see screenshot).
                          I also posted the generated code. I'm trying to add this shading to the swingrays. I got all the user inputs showing and working but the shading just doesn't update.
                          Thank you for your time if you are able to review.
                          James
                          Attached Files

                          Comment


                            #28
                            Hello James,
                            One small fix - move your draw region block outside while loop. Hope it helps!
                            Attached Files
                            Last edited by s.kinra; 09-12-2021, 07:07 AM. Reason: updated fix

                            Comment


                              #29
                              Oh my goodness. Thank you s.kinra . I'm not sure if I would have ever picked that one up. Thank you so much for your help. I truly appreciate it.
                              James

                              Comment


                                #30
                                Hello,
                                I have an indicator that prints arrows/triangles where trade setups happen. It seems there are a lot of items. Is there a way to ONLY remove the arrows/triangles that are older than (let's say) 10 days?
                                Thank you for any help with how to implement this in ninjacript.
                                Thanks again for your time.
                                James

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Zeezee, Today, 12:45 PM
                                0 responses
                                1 view
                                0 likes
                                Last Post Zeezee
                                by Zeezee
                                 
                                Started by swjake, Today, 12:04 PM
                                2 responses
                                9 views
                                0 likes
                                Last Post swjake
                                by swjake
                                 
                                Started by Richozzy38, Yesterday, 01:06 PM
                                5 responses
                                24 views
                                0 likes
                                Last Post Richozzy38  
                                Started by tradingnasdaqprueba, 05-07-2024, 03:42 AM
                                13 responses
                                50 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Started by bill2023, Yesterday, 08:21 AM
                                3 responses
                                18 views
                                0 likes
                                Last Post NinjaTrader_Jesse  
                                Working...
                                X