Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CPU with Lines and Text

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

    #16
    Hello Kate,

    This will help a lot. Also for other Ninjatraders from what I read in the forum.

    Thank you for your support!
    Tony

    Comment


      #17
      Hello Kate,

      from this code I could continue but I experience 2 problems. The timetoreset needs to be on 17:00 otherwise the high or low would not be in the calculation for the timerange. But when I do so then it is not plotting from Sunday to Monday. And the other problem is that on 1st of month its plotting to the left. I attach a screenshot where both is visible from Nov 29th do Dec1st. and on Dec 6th.

      I tried to resolve it with different timetoresets and also inside the code but I had no success.

      Thank you!
      Tony
      Attached Files
      Last edited by tonynt; 12-14-2020, 02:41 PM. Reason: add info screenshot

      Comment


        #18
        Hello tonynt,

        Thank you for your reply.

        The example provided is simply a basic example of finding a high and low for an overnight time frame and is not meant to cover all logical possibilities. For example, logic would need to be added for it to plot correctly for holidays or when the month changes. We did not include this additional logic in the example as it's meant to be a starting point.

        Please let us know if we may be of further assistance to you.

        Comment


          #19
          Hello Kate,

          thank you for your reply. Where can I get an idea how to work with month changes. I know how to use "if time....Saturday/Sunday"... but I dont know how to catch month/month change.

          Thank you!
          Tony

          Comment


            #20
            Hello tonynt,

            Thank you for your reply.

            Since DateTime.AddDays(1) will go forward to the next day, you could try switching the endDateTime assignment to this:

            endDateTime = new DateTime(Time[0].AddDays(1).Year, Time[0].AddDays(1).Month, Time[0].AddDays(1).Day, EndHour, EndMinute, 0);

            Please let us know if we may be of further assistance to you.

            Comment


              #21
              Hello,

              when modifying the "basic" SampleGetHighLowByTimeRange and adding a dataseries I get errormessages from onbarupdate in logtab. Are there any restictions with time and drawings please when working with more than primary dataseries?

              Thank you!
              Tony

              Comment


                #22
                Hello tonynt,

                Thank you for your reply.

                You'd need to modify any references to Time[0] to refer to the series you want the Time to refer to. So if you need it to be calculated from the primary series timestamps, you'd modify any references to Time[0] to Times[0][0]. Aside from that, I'd need to see the full text of the errors being received and your modifications to the code to determine what may be occurring.

                Please let us know if we may be of further assistance to you.

                Comment


                  #23
                  Hello,

                  thank you for your reply. I modified the code referring to what I know from using added dataseries and what you replied me but I still get error messages. If you might think why I do here so I agree it doesnt make sense in this sample maybe, but I want to understand from this sample when working without errors in onbarupdate. As you wrote to see the full code, I upload the sample, its the minimum code (basic sample dataseries)

                  Thank you!
                  Tony
                  Attached Files

                  Comment


                    #24
                    Hello tonynt,

                    Thank you for your reply..

                    I note you're not checking to see whether there have been enough bars of the secondary series before calculating the rest of the strategy. You'd need at least one bar to have been processed of the secondary series in order for it to process and since the primary series would calculate first, on the first run through OnBarUpdate you'd hit a index error since no secondary bars have been processed yet. Try adding a CurrentBars check for the secondary series to the top of OnBarUpdate:

                    if (CurrentBars[1] < 1)
                    return;

                    Please let us know if we may be of further assistance to you.

                    Comment

                    Latest Posts

                    Collapse

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