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

Drawdots under each bar?

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

    Drawdots under each bar?

    Hi,
    Coming from TS and used to TS Showme functions that puts dots under/over a bar depending on a variables and show historic variables settings too.

    Let me explain

    1. The following code puts a single dot under say an entry point loong/short

    TrStop.Set(Low[0] - StDev*1.382);
    DrawDot("TStop_Long", true, 0, TrStop[0], Color.Blue);

    2. Moving the stop along the bars I am then changing the variable
    if (TrStop[0] == 0) TrStop.Set(Close[0]);
    if (Close[0] > Close[1]) TrStop.Set(Low[0] - StDev * 1.382);
    if (Low[0] - High[1] > StDev) TrStop.Set(Low[0] - StDev * 0.618);
    if (TrStop[0] < TrStop[1]) TrStop.Set(TrStop[1]);
    DrawDot("", true, 0, TrStop[0], Color.Blue);

    But the dot does not stay under that completed bar - seems it is deleted and put on the next bar ( the last bars seems to have a dot!)

    How can I put a dot under each bar as the trade progresses?

    #2
    mefTrader, when drawing objects there is a need to specify a tag inside quotes. When the tag is the same for every draw object, that same object will be drawn over and over again. To create more than one object, they need different identifiers. CurrentBar is the number of the bar the indicator is currently "thinking" about and is useful for this purpose:
    Code:
    DrawDot("dot tag" + CurrentBar, true, 0, TrStop[0], Color.Blue);
    AustinNinjaTrader Customer Service

    Comment


      #3
      great thanks

      Comment


        #4
        I found the use of DrawDot("dot tag" + CurrentBar... to kill the performance of NT 7. Memory consumption and CPU spike and NT locks up for minutes. Running on brand new 6 core processor computer. Is there another way to draw dots ( and other graphics objects ) on every bar?

        Comment


          #5
          Brillo, unfortunately not - do you see this on backtesting or on the regular charts when the indicator / strategy is running? How many objects are you drawing approximately as you see this happening?

          Thanks
          BertrandNinjaTrader Customer Service

          Comment


            #6
            It's backtesting a 24/7 ES 20 tick 3 days. I've stopped using the drawing objects on every bar as it's really usable. It would appear that the architecture is creating a separate GDI object for each and every bar. This is wasteful.

            Comment


              #7
              Thanks for clarifying - you would indeed create an object for each dot then, in back testing in the Strategy Analyzer we would suggest to not draw them at all in your strategy.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Brillo, is there any reason to not use a dot Plot under every bar instead of a Draw object?

                Dan
                eDanny
                NinjaTrader Ecosystem Vendor - Integrity Traders

                Comment


                  #9
                  Probably not! I don't know about DrawObject. I was going by the suggestion I found here in this thread. Can I use DrawObject to draw the dots and use less system resources?

                  Comment


                    #10
                    Originally posted by eDanny View Post
                    Brillo, is there any reason to not use a dot Plot under every bar instead of a Draw object?

                    Dan
                    Unfortunately, I'm not sure what you mean. At first I thought you were saying that there's an alternative way to draw dots called a Draw object that is better then the DrawDot api that I'm using. But on a second read of your note it's not clear.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Brevo, Today, 01:45 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post Brevo
                    by Brevo
                     
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    239 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    384 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Started by oviejo, Today, 12:28 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post oviejo
                    by oviejo
                     
                    Working...
                    X