Announcement

Collapse
No announcement yet.

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];

    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.

          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.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              646 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              367 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              107 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              569 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X