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

Looking for and add-on or indicator that plots specific closes and opens

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

    Looking for and add-on or indicator that plots specific closes and opens

    Specifically the previous day's normal close and the current day's normal open. Anyone have an idea if this indicator exists or if its possible to use a pre existing indicator to plot these? thanks

    #2
    Hello JustinOfNazareth,

    Thank you for your post.

    You could do this by simply applying two built-in indicators to your chart, the Current Day OHL and the Prior Day OHLC. Each of these allows you to choose which lines to plot, so I set the Current Day OHL to just show the Open and the Prior Day OHLC to just show the Close.

    You could also create a custom indicator that would pull those plots from those indicators and display them as one single indicator.

    Here's a quick example of code that would plot just the Prior Close and Current Open:

    Code:
            protected override void OnStateChange()
            {
                if (State == State.SetDefaults)
                {
                    Description                                    = @"Enter the description for your new custom Indicator here.";
                    Name                                        = "PriorDayCloseCurrentDayOpen";
                    Calculate                                    = Calculate.OnBarClose;
                    IsOverlay                                    = true;
                    DisplayInDataBox                            = true;
                    DrawOnPricePanel                            = true;
                    DrawHorizontalGridLines                        = true;
                    DrawVerticalGridLines                        = true;
                    PaintPriceMarkers                            = true;
                    ScaleJustification                            = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                    //Disable this property if your indicator requires custom values that cumulate with each new market data event. 
                    //See Help Guide for additional information.
                    IsSuspendedWhileInactive                    = true;
                    AddPlot(Brushes.DodgerBlue, "PriorClose");
                    AddPlot(Brushes.ForestGreen, "CurrentOpen");
                }
                else if (State == State.Configure)
                {
                }
            }
    
            protected override void OnBarUpdate()
            {
                if(CurrentBar < 1)
                    return;
    
                Values[0][0] = PriorDayOHLC().PriorClose[0];
                Values[1][0] = CurrentDayOHL().CurrentOpen[0];
            }
    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello JustinOfNazareth,

      Thank you for your post.

      You could do this by simply applying two built-in indicators to your chart, the Current Day OHL and the Prior Day OHLC. Each of these allows you to choose which lines to plot, so I set the Current Day OHL to just show the Open and the Prior Day OHLC to just show the Close.

      You could also create a custom indicator that would pull those plots from those indicators and display them as one single indicator.

      Here's a quick example of code that would plot just the Prior Close and Current Open:

      Code:
       protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = @"Enter the description for your new custom Indicator here.";
      Name = "PriorDayCloseCurrentDayOpen";
      Calculate = Calculate.OnBarClose;
      IsOverlay = true;
      DisplayInDataBox = true;
      DrawOnPricePanel = true;
      DrawHorizontalGridLines = true;
      DrawVerticalGridLines = true;
      PaintPriceMarkers = true;
      ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
      //Disable this property if your indicator requires custom values that cumulate with each new market data event.
      //See Help Guide for additional information.
      IsSuspendedWhileInactive = true;
      AddPlot(Brushes.DodgerBlue, "PriorClose");
      AddPlot(Brushes.ForestGreen, "CurrentOpen");
      }
      else if (State == State.Configure)
      {
      }
      }
      
      protected override void OnBarUpdate()
      {
      if(CurrentBar < 1)
      return;
      
      Values[0][0] = PriorDayOHLC().PriorClose[0];
      Values[1][0] = CurrentDayOHL().CurrentOpen[0];
      }
      Please let us know if we may be of further assistance to you.


      Thanks Kate but for some reason the two indicators you listed are plotting opens and closes at different times then the regular open and close and it doesn't seem to be consistently plotting at the same time. I also don't know enough about C# to know if your code would get me where I want. I'm just looking for an indicator that will plot the prior day close at 4:15 est, and the current day open at 9:30 est, thanks

      Comment


        #4
        Hello JustinOfNazareth,

        Thank you for your reply.

        The times it would plot as open and close would be dependent on your Trading Hours Template for the chart. You can find these listed (with their associated times) under Tools > Trading Hours. If you do not see a template that meets your needs, you can create your own. Here's a link to our help guide regarding Trading Hours Templates:



        Once you've figured out which Trading Hours template displays the time frame you wish, you can then apply it to a chart by right clicking on the chart > Data Series > Trading Hours > Set your template > OK. This should then display the open and close at the times you expect. Please note that Trading Hours templates cannot be applied to daily charts as daily bars come fully formed from your data provider and cannot be changed - a 1440 minute chart would need to be used instead.

        If you need to plot the indicator based on RTH hours on an ETH chart, you can do so by using a hidden data series. Here is a publicly available video from our YouTube channel that goes over how to do this:
        Get started with the NinjaTrader software for FREE: http://ninjatrader.com/GetStartedThis video demonstrates how to plot an indicator based off of one data s...


        Please let us know if we may be of further assistance to you.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        45 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by arvidvanstaey, Today, 02:19 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        8 views
        0 likes
        Last Post f.saeidi  
        Started by alifarahani, 04-19-2024, 09:40 AM
        9 responses
        55 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X