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

Pivot

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

    Pivot

    Good morning,
    I can not run the Pivot indicator inside the code.
    How do you do it?
    Thank you.
    Roberto

    #2
    Hello Roberto,

    Thanks for your post.

    Can you clarify what error or issue you are seeing in trying to use the pivots indicator?

    Can you post your code example or screenshot?

    Are you using the strategy builder or coding directly in Ninjascript?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Attached the code. I did not understand what I should enter as values in place of "0" in State.DataLoaded.
      Pivots1 = Pivots (PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0,0,0,20);

      Then, in protected override void OnBarUpdate (), I wrote this way:

      if (Close [0]> Pivots1.Pp [0])
      {
      Golong
      }

      Where am I wrong?
      Roberto
      Attached Files

      Comment


        #4
        Hello Roberto,

        Thanks for your reply.

        Your code looks correct. Have you created Pivots1 at the class level? For example:

        private Pivots Pivots1; This would be placed just under the public class strategyname : Strategy

        The zeros in the statement: Pivots (PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0,0,0,20); are for a user specified High, Low and Close value to define the pivots when user-defined is selected in the HLCCalculationMode, if not select the values are ignored.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Yes. I had forgotten to put it, now it's been included in the attached file. The strategy in this way does not show on the chart the Pivots. Then, every candle enters Long, continuously. How to set up Pivots. Could you please give me an example?
          Thank you.
          Roberto
          Attached Files

          Comment


            #6
            Hello Roberto,

            Thanks for your reply.

            Please make sure that you are enabling the strategy if you are applying to a live data chart.

            If you do not see the pivots on the chart, you may need to change the vertical price scale to be able to see the pivots as they may well be out of the charts view.

            Also, keep an eye on the "log" tab when something is not working as expected as there could be runtime errors that would be displayed there.

            Your current entry condition is quite static so on each bar if that condition is true it indeed would want to enter an order.

            I believe what you are looking for is to know when price crosses the pivots? If so then you should look at the CrossAbove() and CrossBelow() methods.

            For example:

            if (CrossAbove (Close, Pivots1.Pp[0], 1)
            {
            // go long
            }

            Reference:

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thank you very much Paul.
              Tomorrow I try and Monday I'll let you know.
              Good weekend.
              Roberto

              Comment


                #8
                Thanks Paul

                Perfect Pivot.
                Thanks Paul
                Roberto

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                4 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                41 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                20 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Working...
                X