Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

pivot indicator

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

    pivot indicator

    Hi,

    How can I display daily pivots lines on intraday charts?

    Andrew

    #2
    Andrew, you can just apply the Pivots indicator to an intraday chart. From the chart, open the indicators window and then double-click on Pivots to add it.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Andrew, you can use the PivotPoint-Indicator shipped with NinjaTrader.
      Here is an example, if you want to add it in your strategies:

      Code:
      Add(Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 50));
      I guess you are interested in the HLCCalculationMode parameter.

      DT

      Comment


        #4
        Thanks guys,

        How do I go about about buy / sell at pivot point value?

        How do I add it into the EnterLong / EnterShort function?

        Thanks,
        Andrew

        Comment


          #5
          Andrew, you can try for example starting with this simple snippet to go long if Close crosses over the PP -

          Code:
           
          if (CrossAbove(Close, Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 20).PP, 1))
          {
          EnterLong(DefaultQuantity, "");
          }

          Comment


            #6
            Thanks,

            I would like to enter long if close crosses above previous day close and enter short if close crosses below previous day close. My code is below, I try it on the 15min chart but there doesn't seem to be any trade that gets entered. Is there something wrong with the code?

            protected override void Initialize()
            {
            Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
            Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
            SetProfitTarget("", CalculationMode.Price, 28);
            SetStopLoss("", CalculationMode.Price, 60, false);

            CalculateOnBarClose = true;
            }

            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            // Condition set 1
            if (CrossAbove(Close, Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 20).PP[-1], 1))
            {
            EnterLong(DefaultQuantity, "");
            }

            // Condition set 2
            if (CrossAbove(Close, Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 20).PP[-1], 1))
            {
            EnterShort(DefaultQuantity, "");
            }
            }


            Thanks in advance,

            Andrew

            Comment


              #7
              Andrew,

              You are using [-1] which is not allowed. You cannot use a negative index value. [0] means current bar, [1] means previous bar, [2] means bar before that. [-1] doesn't mean future bar, it is not allowed and actually throws an error which should be viewable in the Control Center log.

              Please adjust this and it should work better.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Thanks Josh,

                There either seem to be something wrong with my entry or exits, my exits are as follows;

                protected override void Initialize()
                {
                Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
                Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
                SetProfitTarget("", CalculationMode.Ticks, 28);
                SetStopLoss("", CalculationMode.Ticks, 60, false);

                CalculateOnBarClose = true;
                }


                Essentially what I am after is profit at entry +28 pts and stoploss at -60pt.

                Please see pic of backtest.

                THanks for your help,

                Andrew
                Attached Files

                Comment


                  #9
                  Andrew, strange it seems to be submitted at price instead of ticks - which NT version you running? Please check under Help > About and ensure this is the latest 6.5.1000.14.

                  Comment


                    #10
                    thats the version I got.

                    Andrew

                    Comment


                      #11
                      Andrew, any way you could attach the script so I can check into it on my end?

                      Comment


                        #12
                        OK,


                        // This namespace holds all strategies and is required. Do not change it.
                        namespace NinjaTrader.Strategy
                        {
                        /// <summary>
                        /// Enter the description of your strategy here
                        /// </summary>
                        [Description("Enter the description of your strategy here")]
                        public class Pivot3 : Strategy
                        {
                        #region Variables
                        // Wizard generated variables
                        private int myInput0 = 1; // Default setting for MyInput0
                        // User defined variables (add any user defined variables below)
                        #endregion

                        /// <summary>
                        /// This method is used to configure the strategy and is called once before any strategy method is called.
                        /// </summary>
                        protected override void Initialize()
                        {
                        Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
                        Add(Pivots(NinjaTrader.Data.PivotRange.Daily, NinjaTrader.Data.HLCCalculationMode.CalcFromIntrad ayData, 20));
                        SetProfitTarget("", CalculationMode.Ticks, 28);
                        SetStopLoss("", CalculationMode.Ticks, 60, false);

                        CalculateOnBarClose = true;
                        }

                        /// <summary>
                        /// Called on each bar update event (incoming tick)
                        /// </summary>
                        protected override void OnBarUpdate()
                        {
                        // Condition set 1
                        if (CrossAbove(Close, Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 20).PP[1], 1))
                        {
                        EnterShort(DefaultQuantity, "");
                        }

                        // Condition set 2
                        if (CrossBelow(Close, Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 20).PP[1], 1))
                        {
                        EnterLong(DefaultQuantity, "");
                        }
                        }

                        #region Properties
                        [Description("")]
                        [Category("Parameters")]
                        public int MyInput0
                        {
                        get { return myInput0; }
                        set { myInput0 = Math.Max(1, value); }
                        }
                        #endregion
                        }
                        }




                        Thanks,

                        Andrew

                        Comment


                          #13
                          Andrew, I don't see I reason why you should see this strange behavior noted - does for example our SampleMACrossOver strategy work for you properly?

                          If not, I would suggest doing a clean install of the latest NT 6.5.1000.14 and then rechecking.

                          Thanks

                          Comment


                            #14
                            Thanks Bertrand,

                            It worked after I did a reinstall, just one other question.

                            I would like to enter only once per session (day)

                            I found the following code on another thread, but where do I enter it in my code below?



                            // in variables section
                            private bool canTrade = true;

                            OnBarUpdate()
                            {
                            if (SessionBreak)
                            canTrade = true;

                            if (long trade conditions are met)
                            {
                            canTrade = false;
                            EnterLong(...);
                            }

                            if (short conditions are met)
                            {
                            canTrade = false;
                            enterShort(...);

                            }

                            Thanks,

                            Andrew

                            Comment


                              #15
                              Andrew,

                              You would place that inside your OnBarUpdate() method over your trade logic.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              672 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              379 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              111 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              577 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              582 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X