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

Incorporating "Pivots" Indicator into a Strategy

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

    Incorporating "Pivots" Indicator into a Strategy

    Hello

    I'm using the standard Ninja "Pivots" indicator and I'd like to integrate it into a custom strategy.
    What I'm struggling with is how to identify the various Pivot Points (R1, R2, P1, P2, etc) in order to use them in the strategy. For example, how can I "call" S1 in order to code something like this:

    if Low[0] <= "S1", then....etc

    Thanks a lot for any pointers.

    #2
    laocoon, this would work the same way as with other multi plot indicators as well, all plots are exposed for access, so it depends which one you designate to work with in your script call.

    For example this will give you the S2 level from the indicator :

    double value = Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).S2[0];

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks a lot for that Bertrand!

      Have a great day.

      Comment


        #4
        I've got a follow-up question regarding the use of Daily HLC Pivots in a strategy:

        In my strategy, a short entry is invalid if the Low of a Candle is closer than 3 ticks from S1 and closes above it. Here's the code snippet:

        if (Low[0] <= Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).S1[0]+3*TickSize && Close[0] >= Pivots(PivotRange.Daily, HLCCalculationMode.CalcFromIntradayData, 0, 0, 0, 20).S1[0])

        {
        DotsS1Short = false;
        }

        It compiles OK but for some reason the strategy just ignores the code.

        Any pointers as to why would be very much appreciated.

        Thanks.
        Last edited by laocoon; 02-20-2013, 11:58 AM.

        Comment


          #5
          laocoon, how do you judge that the rules gets ignored? How do you use the DotsS1Short you set? It would be best if you printed the variable output with the exact date time (PrintWithTimeStamp) so you would know at which exact bar which result was seen per your condition set.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thanks for your reply Bertrand. I know that the rule gets ignored because the setup happened yesterday and my strategy drew a dot where there shouldn't be one. The "DotsS1Short" is part of a series of criteria that form my strategy. If all are true, the strategy draws a dot on the chart and sends an order to the market. I usually don't work with (PrintWithTimeStamp), I prefer to test my strategy when the setup occurs in real time and so far this has worked very well. Will have to keep looking until I find what's wrong here.

            Thanks.

            Comment


              #7
              Would the setup / dot from your script now print historically at the same 'incorrect' time as well? Then you have a good chance to debug and understand what part of the rule is not working as you expect from it - try printing out all associated parts / variables to see where it works differently then you expect so you could amend as needed.
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Started by ScottWalsh, Today, 06:52 PM
              4 responses
              36 views
              0 likes
              Last Post ScottWalsh  
              Started by olisav57, Today, 07:39 PM
              0 responses
              7 views
              0 likes
              Last Post olisav57  
              Started by trilliantrader, Today, 03:01 PM
              2 responses
              21 views
              0 likes
              Last Post helpwanted  
              Started by cre8able, Today, 07:24 PM
              0 responses
              10 views
              0 likes
              Last Post cre8able  
              Working...
              X