Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Find Low of the Day: Irrespective of the chart timeframe selected

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

    Find Low of the Day: Irrespective of the chart timeframe selected

    Hi,
    I want use Low of the day value for my strategy. https://ninjatrader.com/support/help...nt_day_ohl.htm
    I am using this guide however CurrentDayOHL().CurrentLow[0 is giving me unpredictable results.
    Does is matter which chart timeframe selected to use this api?

    Thanks​

    #2
    Hello gbajaj,

    Thank you for your post.

    The Current Day OHL indicator should only be used on an intraday series. Additionally, the values will be based on the Trading Hours selected for the series used. You mentioned you were getting unpredictable results; do you have an example of an instrument, timeframe, and Trading Hours used for the series that resulted in an unexpected value for the CurrentLow? You may get a better idea of how this indicator is calculated by viewing the source code in the NinjaScript Editor > Indicators folder > CurrentDayOHL.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Stock: DKNG
      Time Frame 1 min
      I am printing this as a label on chart by calling this method on press of a custom button, value it gives me is $22.86 however the correct value is $24.66. As you suggested, i looked at the code of indicator which looks ok , however i don't want to add code for something already done and would want to reuse that.

      Now I do get correct value when I call this method in OnBarUpdate and store the value come from this method. However i want to call this method, as i mentioned, on press of button. Why doesn't that work?

      Thanks

      Comment


        #4
        Hello gbajaj,

        Thank you for that information.

        Please provide a snippet or a reduced sample of your script so I may see the behavior that is occurring with the button press vs. storing the value when called in OnBarUpdate() and see if I can reproduce the discrepancy on my end. To export a reduced sample, go to Control Center > Tools > Export > NinjaScript Add-on. Then, you may attach the exported .zip in your reply.

        I appreciate your patience and look forward to your reply.

        Comment


          #5

          Please go to file name SampleWPFModifications.cs and line number 1226. If you load this sample with chart trader enabled, you should see button with the label "Button 3", press that button to see the TextFixed from line 1126 printed on Left Bottom of the chart, you should notice that it shows the wrong value.

          Thanks​
          Attached Files

          Comment


            #6
            Hello gbajaj,

            Thank you for your reply.

            In order to synchronize the NinjaScript indexes and pointers when your button is clicked, you should use TriggerCustomEvent():


            Here is a modified snippet starting from line 1225 for Button 3 in the example you provided. I commented out your original Draw.TextFixed() method and instead put it inside of TriggerCustomEvent(). You can see the difference if you switch it to comment out TriggerCustomEvent() and uncomment your original line of code, recompile, then press the button:

            Code:
            else if (button == chartTraderCustomButtonsArray[2])
            {
            TriggerCustomEvent(o =>
            {
            Draw.TextFixed(this, "infobox", "Chart trader custom Button 3: Lod " + CurrentDayOHL().CurrentLow[0], TextPosition.BottomLeft, Brushes.DarkOrange, new SimpleFont("Arial", 25), Brushes.Transparent, Brushes.Transparent, 100);
            }, null);
            // Draw.TextFixed(this, "infobox", "Chart trader custom Button 3: Lod " + CurrentDayOHL().CurrentLow[0], TextPosition.BottomLeft, Brushes.DarkOrange, new SimpleFont("Arial", 25), Brushes.Transparent, Brushes.Transparent, 100);
            }

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

            Comment


              #7
              Thank you so much, it worked

              Comment

              Latest Posts

              Collapse

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