Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawDot...

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

    DrawDot...

    Hello,

    I am using a tick chart and when a condition becomes true I want to draw a
    dot on the current bar at the current price.

    I am using:
    DrawDot("LogicDot", true, 0, Median[0],Color.Blue);

    I am also logging the condition went true and playing a sound. The logging
    and sound is working.

    The dot is not drawn at the current price or the median price on the active bar.

    It appears to draw on the bar the strategy was made active and that can be 10 or more bars earlier.

    What am I doing wrong?

    Ciao,

    Mark

    #2
    DrawDot() draw on the bar it was called. I suggest you print out the timestamp it was called so you can correlate it with the chart.

    Print(Time[0].ToString());
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hello

      >DrawDot() draw on the bar it was called.

      What does that mean?

      I know when it is called. I am watching the chart and the sound plays and the output window updates correctly. The dot is not drawn. If I just started the stragety the dot is drawn at the bar the stragery starts.

      I will add the timestamp for trouble shooting.

      Ok. I just did that and the time is the correct bar.

      OK #2 I just verified that the dot is drawn on the bar were the stragety goes active not the time of the current bar.

      What am I doing wrong?

      Ciao,

      Mark

      Comment


        #4
        Please provide a screenshot. Thank you. Are you absolutely sure that is the code you are using? If you told it to draw at bar 0 it would not draw on a historical bar way in the past.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi,

          That is what I thought.

          I will post a screen shot of the output window and the dot on the tick chart tomorrow.

          When normal trading with the DOM, I have noticed the trade entry and exit points on the tick chart are not in the correct locations. But, it did not bother me, so I said nothing.


          Till tomorrow,

          Mark

          Comment


            #6
            Please sync your PC clock to ensure accurate timestamping.

            Entry/exit plots show up on the first bar with the same timestamp of the execution. If you are using a tick chart that is moving so fast that you have many bars with the same timestamp you may experience what you are describing.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              The PC clock is sync'd every morning.

              > with the same timestamp

              I would assume the resoultion is down to the second. So, if three bars appeared in the same second I could see it on the first bar and that makes sense.

              What I want to do is draw "anything", that stands out, at the current bar and at the current price under certain logic conditions. I am not using the bar update to draw. I need it to draw at anytime. I am at present using another event to check the logic and I want to draw in that event. Can you suggest a draw command that would let me achive the above?

              Thanks,

              Mark

              Comment


                #8
                Mark,

                The Tag must be unique for each bar / time its called, otherwise you will only see the last one.

                Use this nomenclature:

                Code:
                DrawDot(CurrentBar.ToString(), true, 0, Median[0],Color.Blue);
                hope this helps.
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  Thanks mrlogik, good point.

                  Mark, it would be helpful for us to see the code you use to further advise - Thanks!

                  Comment


                    #10
                    Hi,

                    Ok. I have verified that it is only drawing at the bar the stragety is started. I attached the screen shot. The first dot was at :27 and it should have been 28. The second dot should have been at :30:01. But what happened is the first dot disappeared and a new dot appeared on the same bar but at the new price.

                    The sound plays and the print works at the correct time.
                    How do I get the current price value?

                    protectedoverridevoid OnMarketData(MarketDataEventArgs e)

                    if x
                    {
                    PlaySound(@"C:\bbell.wav");
                    Print("Logic Fired " + Time[0].ToString());
                    DrawDot(CurrentBar.ToString(), true, 0, Median[0],Color.Blue);
                    // DrawDot("", true, 0, Median[0],Color.Blue);
                    }

                    Thanks,

                    Mark

                    Attached Files
                    Last edited by Mark-; 03-03-2009, 08:46 AM. Reason: Picture did not upload...

                    Comment


                      #11
                      Mark.

                      Like I said earlier, the tag must be unique for each dot draw.

                      You will get an update for each Tick of the bar, which means for each full bar, you will only plot 1 dot at the very last tick of the bar.

                      What are you trying to do? Please give some a full description so I can help you more.

                      Thanks
                      mrlogik
                      NinjaTrader Ecosystem Vendor - Purelogik Trading

                      Comment


                        #12
                        Hi,

                        I am sorry, I am confused. I made the change as you suggested.

                        DrawDot(CurrentBar.ToString(), true, 0, Median[0],Color.Blue);

                        >What are you trying to do?

                        I stated what I am trying to do in eariler post.

                        --
                        What I want to do is draw "anything", that stands out, at the current bar and at the current price under certain logic conditions. I am not using the bar update to draw. I need it to draw at anytime. I am at present using another event to check the logic and I want to draw in that event. Can you suggest a draw command that would let me achive the above?
                        --

                        Ciao,

                        Mark

                        Comment


                          #13
                          Mark,

                          All provided Draw() methods are tied to bars. You can only draw on bars. If you want many draw objects each representing some condition you need to use a more unique string than just CurrentBar.ToString(). That would only get you a unique string per bar which is not necessarily unique enough if you have many draw attempts within one bar. I suggest you use your own counter and each time you add a new object just increment the counter.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello,

                            OK. I can do that but, it seems a point not related to the time and dot not appearing on the correct bar. Did you look at the screen shots I sent? It shows the time logged and the dot are not in sync. What can I do about that problem?

                            I just have one condition and I want to draw it on the bar. If the dot moves up/or down on the bar that is fine. As long as it is on the correct bar.

                            This is the problem.
                            1) I have a condition.
                            2) I get the time, log it.
                            3) I play a sound.
                            4) I draw a dot on the current bar.

                            1,2 and 3 work without error. 4 fails. What is the solution to that failure?

                            Ciao,

                            Mark

                            Cheers,

                            Mark

                            Comment


                              #15
                              you MUST have a unique tag for each time you call DrawDot.

                              Make some global counter,

                              int x = 0;

                              each time you call your DrawDot, do this

                              Code:
                              [FONT=Courier New]DrawDot(CurrentBar.ToString() + x.ToString(), [SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][SIZE=2], Median[[/SIZE][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][SIZE=2]],Color.Blue);[/SIZE][/FONT]
                              x++;
                              This will give you a unique tag each time. If you DO NOT have a unique tag, you will simple erase the last dot you drew with the same tag.
                              mrlogik
                              NinjaTrader Ecosystem Vendor - Purelogik Trading

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              634 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              364 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              567 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X