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

drawing on tick charts

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

    drawing on tick charts

    Hi,

    I thought this would be easy task. But not so. I like to draw a text object on chart a certain time before news report.
    I'd do it by hand, but you can't draw objects, e.g. vertical lines on tick charts ahead of time, like on time based charts.

    Code:
                int news1 = 143000; string newsS1 = @"news 1";
                int news2 = 150000; string newsS2 = @"news 2";
                int news3 = 160000; string newsS3 = @"news 3";
    
                if (ToTime(Time[0]) >= news1-2000 && ToTime(Time[0]) <= news1)
                    BackColorSeries[0] = Color.Gainsboro;
                //    DrawText("News1", false, newsS1, -4, Close[0]-0*TickSize, 0, Color.Orange, new Font ("Arial", 8), StringAlignment.Center, Color.Empty, Color.Empty, 0);
                //else RemoveDrawObject("News1");
                
                if (ToTime(Time[0]) >= news2-2000 && ToTime(Time[0]) <= news2)
                    BackColorSeries[0] = Color.Gainsboro;
                //    DrawText("News2", false, newsS2, -4, Close[0]-0*TickSize, 0, Color.Orange, new Font ("Arial", 8), StringAlignment.Center, Color.Empty, Color.Empty, 0);
                //else RemoveDrawObject("News2");
                
                if (ToTime(Time[0]) >= news3-2000 && ToTime(Time[0]) <= news3)
                    BackColorSeries[0] = Color.Gainsboro;
                //    DrawText("News3", false, newsS3, -4, Close[0]-0*TickSize, 0, Color.Orange, new Font ("Arial", 8), StringAlignment.Center, Color.Empty, Color.Empty, 0);
                //else RemoveDrawObject("News3");
    This is my code (I changed the text object for colored background) and this is result. I marked the bars, that have close times greater than news time with blue dots.

    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


    1st news drawn ok, 2nd completely disappeared, 3rd only one bar in advance

    Am I missing something?

    This is June ES 2000t chart

    Cheers

    Thomas
    Last edited by td_910; 05-24-2013, 12:26 AM.

    #2
    Hi Thomas, the issue is very likely found in the timestamp resolution provided by the 2000T chart - as the charts would not depend on a time component for the bars creation. So the time point you intent would be only approximate by using a tick series - the bars could close whenever the tick count would be up, not at a certain time.

    What you could do is add a minute series for example into this study and then access those minute based timestamps for your checks via Times -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Thanks. Yes, right, there are no certain time intervals for the closing times of tick generated bars.

      That's why I was using a range condition to check for bar close time.

      Code:
      if (ToTime(Time[0]) >= news1-2000 && ToTime(Time[0]) <= news1)
      But still no success.

      Comment


        #4
        Well, you got success with this condition according to the resolution offered in the data. There's only so far you could go with non time based bars as to hitting the time exactly as desired.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Well, I know about the resolution of the data, that's why I'm using range condition. 20 min before news to news time.

          I marked the bars, that should fit that condition on 2nd and 3rd news event.
          Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


          1st news time and bars are displayed correctly - isn't that strange?

          Thomas

          Comment


            #6
            Thomas, apologies - I see the issue now for your 2 other time conditions - if you substract 200 from the 1500 or 1600 Int's you do not arrive at valid times. Try substracting 6000 instead...and it should work then.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hi Bertrand,

              Thank you. I think you figured it out. Its a bit complicated it depends, what time one is subtracting the 20min from. If from full hour one has to subtract 6000, if from lower (like 17:59 one needs to subtract 2000 only, and when subtracting from 17:19 one has to use 6000 again. Tricky.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by bortz, 11-06-2023, 08:04 AM
              47 responses
              1,611 views
              0 likes
              Last Post aligator  
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              9 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              19 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              6 views
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              22 views
              0 likes
              Last Post Javierw.ok  
              Working...
              X