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

Anchoring an Indicator to the start of a session

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

    Anchoring an Indicator to the start of a session

    I created a horizontal histogram indicator that currently plots on the LH side of a chart. I'd like to anchor that histogram to the open of a session if the open is currently displayed on the chart. Can anyone point me to an indicator or some sample code that does this?
    TIA

    #2
    Hello,

    Thanks for the note.

    Unfortunately this would require overriding Plot() to be able to do this. Which is unsupported NinjaScript territory. The is a sample on how to override the Plot() under Control Center->Tools->Strategies->SampleOverridePlot.

    Let me know if I can be of further assistance.

    Comment


      #3
      Thanks Brett, I am already overriding Plot to create my horiz. histogram but have not figured out how to determine if the session open is on the chart and how to anchor the base of the histogram to the open when it is being plotted, ie - is the session open on the chart and how do I determine the x coord to start painting my histogram, both can likely be resolved with the same info.

      I will also want to do the same for every session as I scroll back through the chart but that should be easy once I can get the last session to anchor as described (Create a class to handle the histogram paint and instantiate a new class for each session) .

      Cheers,

      Paul

      Comment


        #4
        Hello,

        I understand. Yes I don't really have any idea's on how you would anchor it Unfortunately. If you don't know how to get the bar of the first bar of session let me know and I can send you this information though.

        Otherwise I would not be able to further assist sorry.

        Comment


          #5
          Originally posted by paulca View Post
          Thanks Brett, I am already overriding Plot to create my horiz. histogram but have not figured out how to determine if the session open is on the chart and how to anchor the base of the histogram to the open when it is being plotted, ie - is the session open on the chart and how do I determine the x coord to start painting my histogram, both can likely be resolved with the same info.

          I will also want to do the same for every session as I scroll back through the chart but that should be easy once I can get the last session to anchor as described (Create a class to handle the histogram paint and instantiate a new class for each session) .

          Cheers,

          Paul
          Use FirstBarOfSession to key off the start of your drawing.

          Comment


            #6
            Originally posted by koganam View Post
            Use FirstBarOfSession to key off the start of your drawing.
            Thanks, that's the easy part. The more difficult prob. is how to determine if the open is currently visible on the chart and, if so, how to determine the chart X value to know where to start the plot. I'm looking to see if internal classes ChartControl and/or ChartHelper will give me what I need. If you have any other ideas I'm open to suggestions.

            Comment


              #7
              Originally posted by paulca View Post
              Thanks, that's the easy part. The more difficult prob. is how to determine if the open is currently visible on the chart and, if so, how to determine the chart X value to know where to start the plot. I'm looking to see if internal classes ChartControl and/or ChartHelper will give me what I need. If you have any other ideas I'm open to suggestions.
              You can start with:

              ChartControl.GetXByBarIdx(ChartControl.LastBarPain ted);
              ChartControl.GetXByBarIdx(ChartControl.FirstBarPai nted);

              Needless to say, they are unsupported.

              You may also want to look in the code for the VolumeZones indicator. It pretty much does what you are trying to do, so you should be able to get some ideas in there.
              Last edited by koganam; 05-24-2011, 04:24 PM.

              Comment


                #8
                Originally posted by koganam View Post
                You can start with:

                ChartControl.GetXByBarIdx(ChartControl.FirstBarPai nted);
                ChartControl.GetXByBarIdx(ChartControl.LastBarPain ted);
                Sweet, thank you! That is probably all I need.

                Comment


                  #9
                  Originally posted by paulca View Post
                  Sweet, thank you! That is probably all I need.
                  You may also want to look in the code for the VolumeZones indicator. It pretty much does what you are trying to do, so you should be able to get some ideas in there.

                  Comment


                    #10
                    Originally posted by koganam View Post
                    You may also want to look in the code for the VolumeZones indicator. It pretty much does what you are trying to do, so you should be able to get some ideas in there.
                    Thanks, that was my initial code basis and have that (horizontal volume distribution histogram) working ok anchored to the left side of the chart, it was the anchoring to the open that I was having a problem with. Really appreciate the help, thanks again.

                    Comment


                      #11
                      The shipping NT version of the Volume Profile works only with realtime data, and is erased if one loads the chart after market hours.

                      I was thinking of writing a version that stays on the chart, a la Market Profile, or Volume Profile from many other vendors. Is that perchance what you are currently writing?

                      Maybe, I can exchange something for it, once you are done? I really would rather not reinvent the wheel, if you know what I mean.

                      Comment


                        #12
                        Originally posted by koganam View Post
                        The shipping NT version of the Volume Profile works only with realtime data, and is erased if one loads the chart after market hours.

                        I was thinking of writing a version that stays on the chart, a la Market Profile, or Volume Profile from many other vendors. Is that perchance what you are currently writing?

                        Maybe, I can exchange something for it, once you are done? I really would rather not reinvent the wheel, if you know what I mean.
                        That's exactly what I am aiming for - the volume histogram only displays the last session and I need it to display on historical data for backtesting. I'd be happy to share once I have that working since a second pair of eyes looking at the code/chart is always a good thing. For example I currently highlight the PVP/POC on the chart & it's value is different from the value displayed by a PVP indicator downloaded from this forum.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Shansen, 08-30-2019, 10:18 PM
                        25 responses
                        949 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by JonesJoker, 04-22-2024, 12:23 PM
                        8 responses
                        41 views
                        0 likes
                        Last Post JonesJoker  
                        Started by timko, Today, 06:45 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post timko
                        by timko
                         
                        Started by Waxavi, 04-19-2024, 02:10 AM
                        2 responses
                        39 views
                        0 likes
                        Last Post poeds
                        by poeds
                         
                        Started by chbruno, Yesterday, 04:10 PM
                        1 response
                        44 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X