Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Horizontal line at market open

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

    Horizontal line at market open

    I've been searching for posts and indicators that plot a horizontal line at US market open (9:30:01 EST)...
    Some fellow traders posted indicators at ninjatraderecysystem.com and found this one...

    Hello Traders, I have enhanced the capabilities a little. Now you can name the event. In the example, I have the CL Pit Open, the Equities Open and the CL Pit Close. I hope that this is useful for you… Bob Hello Traders, Here is an NT8 indicator that marks the pit open, or any […]



    I tried this indicator to see if it works as it stated but I'm having a little problem with that.
    It actually plots the line at the close of candle not the open.

    I set time at 13:55 and expected to see a horizontal line plotted at the open price
    But this indicator actually drew the line at the close of 13:55 at 13:55:01 not open
    I expected a line would be drawn at the open price at 13:55:01 as soon as 13:55 (1m) candle opens

    I tried to look at the code to see if I can change close to open... but couldn't figure it out.. (probably it might not that simple...)

    Attached the original indicator and I would appreciate any comments and support.

    Thank you
    Attached Files

    #2
    Hello jjanguda,

    Thanks for your post.

    If I understand correctly you want the line to be drawn at the open price of the time selected candle and currently, it is drawing at the Close value of that bar.

    In quickly looking at the code I noticed that on line 85 they have o=Closes[1][0]; which would be the close price of the candle. You can change that to Opens[1][0] and that should then move the line to the Open price of the bar selected. After that change you would need to recompile the indicator and if no errors can then apply it.

    Please keep in mind that NinjaTrader time stamps the end of the bar.

    Comment


      #3
      Pual, thank you very much for your quick support.
      It's working and plotting the open as soon as the candle closes.

      Greatly appreciated!!!



      Comment


        #4
        I have been using this indicator for a while, and I am having an issue with the option to color different additions of this indicator. For example, I have the Equity market open as Navy blue, and the Lunch open as Red. But when I shut down NT, it resets both of those lines to the default of Orange. Is there anything wrong with the code that I might be able to adjust so that it saves the specific color I assigned to it? I've tried saving it as Default, and also save as, and neither of those are doing the trick. Thanks for your help.

        Comment


          #5
          Hello hennx,

          Thank you for your post.

          It looks like the brush in this indicator isn't serialized so the user can edit the color.

          If you would like to edit the script so the brush that colors this plot can be user defined, I recommend taking a look at this Help Guide page which goes over user definable color inputs. There is also a sample script linked at the bottom of the page that you can take a look at that demonstrates using two user definable brush inputs to determine the color of a drawn rectangle:



          Please let us know if you have any further questions.

          Comment


            #6
            Hi Gaby V,
            I looked at the code and compared it to the sample that you sent and as far as I can see they look the same. Just to clarify, I do not have a problem defining the color while I am using the indicator, the problem I am having is that when the program restarts the default color is Dark Orange and it changes all of my versions of the same indicator back to Dark Orange. I hope I am not confusing you. Here is a screenshot of what the code looks like compared to the sample that you sent. Click image for larger version

Name:	image.png
Views:	1218
Size:	387.7 KB
ID:	1298610

            Comment


              #7
              Hello hennx555,

              The code to serialize the brush is commented out in that script. You will need to add code to serialize the brush. You can see in the code for SampleBrushInput the section of code that says 'Serliaize our brush input' is not included in that script.

              Please let us know if you have any further questions.

              Comment


                #8
                Hi. I am using this indicator to show 8:30 opening price & Midnight price on 1min chart but when I switch to a 5min chart the midnight opening price line is above or below chart. Any ideas how I can fix this?? Thanks!

                Comment


                  #9
                  Hello ScottDJC,

                  Thank you for your post.

                  I'm not seeing this behavior when I test out the script.

                  Make sure you have the indicator parameters set up correctly. What parameters are you using to set the midnight price line?

                  Comment


                    #10
                    Hi. I'm not sure what caused the issue but now it's working fine! I also have the same issue as user hennx555​ regarding the indicator color not saving. I have no clue with coding.. Do I just copy paste the codes provided in the user definable codes provided in ninjatrader support link? Not sure which line to copy paste?? Thank you!

                    Comment


                      #11
                      Hello scottscott8080,

                      Welcome to the NinjaTrader forums!

                      For a brush to be saved in a workspace or template, this would need to be serialized for xml.

                      From the help guide linked in post # 5.

                      [XmlIgnore()]
                      [Display(Name = "BorderBrush", GroupName = "NinjaScriptParameters", Order = 0)]​
                      public Brush BorderBrush
                      { get; set; }

                      [Browsable(false)]
                      public string BorderBrushSerialize
                      {
                      get { return Serialize.BrushToString(BorderBrush); }
                      set { BorderBrush = Serialize.StringToBrush(value); }
                      }

                      Instead of BorderBrush, use the name of your public brush variable.​​
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        OMG~ No clue where to copy paste the codes. No clue~ Why is Ninjatrader so so so so so so so so so so so so difficult?? I guess I'm stuck with Dark Orange..

                        Comment


                          #13
                          Hello,

                          This code would need to go in the Properties region of the script.

                          Comment


                            #14
                            Hello, I am trying to add in midnight opening price but nothing appears on my chart. Please see my attached settings: Click image for larger version

Name:	for ninjatrader.jpg
Views:	952
Size:	83.9 KB
ID:	1317896

                            Comment

                            Latest Posts

                            Collapse

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