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

coloring premarket/afterhours sessions

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

    coloring premarket/afterhours sessions

    Is there a way to change the background color of premarket/afterhours sessions?

    thanks!

    #2
    Hello FightOn2, and thank you for your question.

    I have prepared the attached indicator for educational purposes which will accomplish this. Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_JessicaP View Post
      Hello FightOn2, and thank you for your question.

      I have prepared the attached indicator for educational purposes which will accomplish this. Please let us know if there are any other ways we can help.
      Sorry to dig up an old thread, but I was interested in something like this, and tried to use the script you posted. However when trying to save it, it gives the error "Unhandled exception: At least one object must implement IComparable."

      I'm new to this and figured the script may work as is, which I could tweak from there if necessary. Any suggestions on resolving this error? Thanks!

      Comment


        #4
        Thank you for your question risteon. It sounds like something is happening with your compile environment, as the SessionColors script doesn't use any IComparable overloads.



        These troubleshooting steps should help us track down exactly where this message is coming from so we can remove it. Please repeat these steps and report back if you continue seeing this message about IComparable


        1. First, please remove your existing copy of SessionColors.cs from your system.
        2. Next, in NinjaTrader, please visit New -> NinjaScript Editor
        3. Next, in the NinjaScript Editor, please press the F5 button to compile. If you do not hear a chime, and you see error messages at the bottom, please use the Windows Snipping Tool to take a picture of your NinjaScript editor, and attach it to your reply.
        4. Assuming you did hear a chime, please re-download SessionColors.cs and copy / paste it to Documents\NinjaTrader 8\bin\Custom\Indicators .
        5. Finally, please select your NinjaScript editor once more, and press F5 to compile. Just like last time, if you don't hear a chime, please send us a picture of your editor window.



        One of my colleagues will be happy to help if there are any more questions we may answer.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_JessicaP View Post
          Thank you for your question risteon. It sounds like something is happening with your compile environment, as the SessionColors script doesn't use any IComparable overloads.



          These troubleshooting steps should help us track down exactly where this message is coming from so we can remove it. Please repeat these steps and report back if you continue seeing this message about IComparable


          1. First, please remove your existing copy of SessionColors.cs from your system.
          2. Next, in NinjaTrader, please visit New -> NinjaScript Editor
          3. Next, in the NinjaScript Editor, please press the F5 button to compile. If you do not hear a chime, and you see error messages at the bottom, please use the Windows Snipping Tool to take a picture of your NinjaScript editor, and attach it to your reply.
          4. Assuming you did hear a chime, please re-download SessionColors.cs and copy / paste it to Documents\NinjaTrader 8\bin\Custom\Indicators .
          5. Finally, please select your NinjaScript editor once more, and press F5 to compile. Just like last time, if you don't hear a chime, please send us a picture of your editor window.



          One of my colleagues will be happy to help if there are any more questions we may answer.
          That worked just fine. Thank you much!

          I'll have to play around with it, as I would like to have a futures chart color the regular market session difference (9:30-4pm/eastern one color, everything else another color).

          Comment


            #6
            In case anyone interested, I did a simple modification to JessicaP's script to accept input of a fixed start and end time to define the session. Defaults set to 9:30am and 4:00pm (since I'm eastern time) to represent normal market hours. I did this since I like to see this represented on futures symbols as well (just personal preference).
            Attached Files

            Comment


              #7
              I don't know what to do with the CS file. In the user guide, the directions state that the import process expects a zip file. The ninja script editor is unavailable to me with the free license. Is the CS file loaded into the editor and then compiled? I don't mind doing my own reading but I couldn't find any material on the subject. Thanks.

              Comment


                #8
                Originally posted by leon of pizza View Post
                I don't know what to do with the CS file. In the user guide, the directions state that the import process expects a zip file. The ninja script editor is unavailable to me with the free license. Is the CS file loaded into the editor and then compiled? I don't mind doing my own reading but I couldn't find any material on the subject. Thanks.
                Just follow the 5 steps Jessica mentioned. That's what worked for me.
                1. First, please remove your existing copy of SessionColors.cs from your system.
                2. Next, in NinjaTrader, please visit New -> NinjaScript Editor
                3. Next, in the NinjaScript Editor, please press the F5 button to compile. If you do not hear a chime, and you see error messages at the bottom, please use the Windows Snipping Tool to take a picture of your NinjaScript editor, and attach it to your reply.
                4. Assuming you did hear a chime, please re-download SessionColors.cs and copy / paste it to Documents\NinjaTrader 8\bin\Custom\Indicators .
                5. Finally, please select your NinjaScript editor once more, and press F5 to compile. Just like last time, if you don't hear a chime, please send us a picture of your editor window.

                Comment


                  #9
                  Hello leon of pizza,

                  Thank you for your post.

                  Attached are the two files in their .zip format.
                  Attached Files

                  Comment


                    #10
                    Thanks to all. I was able to load the CS file using a sim key Ryan gave me and I tried the other method with the zip files Patrick provided and it worked fine too. Thanks to risteon for making the time input a variable (not sure what the use of the first version is: all it does is shade the settlement session).

                    It creates over 1000 objects for a 30 day chart, and when I switch aggregation periods it takes over 20 sec to get sorted out. It seems to me that the feature could be added to whatever paints the background and it would use less resources there.

                    edit: 1000 objects for 30m bars. 30,000 objects for 1m bars. I tried changing the Calculate On variable - no help.
                    Last edited by leon of pizza; 06-13-2018, 07:43 PM. Reason: new info

                    Comment


                      #11
                      Hello leon of pizza,

                      Thank you for your response.

                      Utilizing the OnRender function to use custom rendering would improve performance of the indicator. You can find details on OnRender at the following link: https://ninjatrader.com/support/help...s/onrender.htm

                      Please let me know if you have any questions.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by jeronymite, 04-12-2024, 04:26 PM
                      3 responses
                      39 views
                      0 likes
                      Last Post jeronymite  
                      Started by bill2023, Today, 08:51 AM
                      2 responses
                      15 views
                      0 likes
                      Last Post bill2023  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      167 responses
                      2,260 views
                      0 likes
                      Last Post jeronymite  
                      Started by warreng86, 11-10-2020, 02:04 PM
                      7 responses
                      1,362 views
                      0 likes
                      Last Post NinjaTrader_Manfred  
                      Started by Perr0Grande, Today, 08:16 PM
                      0 responses
                      5 views
                      0 likes
                      Last Post Perr0Grande  
                      Working...
                      X