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

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.
    Paul H.NinjaTrader Customer Service

    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.
          Gaby V.NinjaTrader Customer Service

          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:	124
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.
              Gaby V.NinjaTrader Customer Service

              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?
                  Gaby V.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by morrnel, 05-12-2024, 06:07 PM
                  4 responses
                  52 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by xepher101, 05-10-2024, 12:19 PM
                  6 responses
                  68 views
                  0 likes
                  Last Post xepher101  
                  Started by gbourque, Today, 04:11 PM
                  0 responses
                  1 view
                  0 likes
                  Last Post gbourque  
                  Started by James650, 05-07-2024, 08:25 AM
                  3 responses
                  14 views
                  0 likes
                  Last Post NinjaTrader_ChristopherJ  
                  Started by Vitamite, Yesterday, 12:48 PM
                  3 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X