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

display signals from an indicator for the last day on the chart only

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

    display signals from an indicator for the last day on the chart only

    Hi,

    I would like to display the signals from an indicator for the last day/session on the chart only (for display/performance reasons).
    I used this, but that's pretty arbitrary and doesn't work on all charts (e.g. if I use the indicator on a smaller tick chart)

    if (CurrentBar<Count-200) return;

    How would I go about this?

    Thanks

    #2
    there is a workaround, if I take out the CurrentBar part from the object name, but that is not performance friendly as all bars on the chart are still processed

    Draw.Line(this, "Min60_UpperTail"+(CurrentBar),
    Draw.Line(this, "Min60_UpperTail",

    Comment


      #3
      Hello td_910,

      Thanks for your post.

      An easy way to do this would be to use Bars.ISFirstBarOfSession as a flag to take action to remove previously drawn objects using RemoveDrawObjects(); the only objects remaining would be what is drawn today (well since the start of the session).

      Reference:





      Paul H.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by NinjaTrader_PaulH View Post
        Hello td_910,

        Thanks for your post.

        An easy way to do this would be to use Bars.ISFirstBarOfSession as a flag to take action to remove previously drawn objects using RemoveDrawObjects(); the only objects remaining would be what is drawn today (well since the start of the session).

        Reference:
        https://ninjatrader.com/support/help...rawobjects.htm
        https://ninjatrader.com/support/help...rofsession.htm


        thank you
        yes, right
        but that would also process all bars on the chart before (like my workaround) and e.g. take ages on a 500tick chart of the ES with 50 days loaded

        Comment


          #5
          Hello td_910,

          Thanks for your reply.

          I must have missed your 2nd post.

          If you are connecting with live data, you could trying testing to see if the bar being processed matches todays date and if so then draw the objects. this means you would get objects from Midnight on.
          For example:

          if (Time[0].Date == DateTime.Now.Date)
          {
          Draw.Dot(this, "test"+CurrentBar, true, 0, Low[0] - 3 * TickSize, Brushes.Blue);
          }
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Hello td_910,

            To follow-up on your first post, you could use Bars.Count.
            For example:

            if (CurrentBar > Bars.Count - 30) // draw on latest 30 bars
            {
            Draw.Dot(this, "test"+CurrentBar, true, 0, Low[0] - 3 * TickSize, Brushes.Blue);
            }
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thank you for that

              if (showLastOnly && Time[0].Date < DateTime.Now.Date) return;

              if (showLastOnly && Time[0].Date < ChartBars.Properties.To.Date) return;

              I ended up with the 2nd version, as that shows the objects on the last day of the chart, even if that is set to a date, that is not today

              Many thanks for your help.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kaywai, Today, 06:26 AM
              1 response
              3 views
              0 likes
              Last Post kaywai
              by kaywai
               
              Started by ct, 05-07-2023, 12:31 PM
              6 responses
              202 views
              0 likes
              Last Post wisconsinpat  
              Started by kevinenergy, 02-17-2023, 12:42 PM
              118 responses
              2,779 views
              1 like
              Last Post kevinenergy  
              Started by briansaul, Today, 05:31 AM
              0 responses
              9 views
              0 likes
              Last Post briansaul  
              Started by traderqz, Yesterday, 12:06 AM
              11 responses
              28 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X