Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Confused about Bars

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

    #16
    Sorry to disturb you again Brett. The solution you offered fixed my earlier problem perfectly, but another problem has just cropped up.

    As discussed in my earlier post, my strategy heavily utilizes pivots.

    My strategy seeks to do this: When the price comes within 10 pips of a Pivot Resistance level (along with confirmation from some other trending conditions), I sell. When the price comes within 10 pips of a Pivot Support level (along with confirmation), I buy. I don't trade off the central pivot at all.

    How I tried to do this: I sought to do this by specifying a 20 pip range within the price must lie (using the condition builder). You can see in my strategy that in condition sets 6,7 and 8 (for trading Resistances R1, R2 and R3), I have specified that Price < Rn + 10 ticks and Price > Rn - 10 ticks as conditions (using the offset parameter). The desired effect of these two conditions was to create a trade condition which would be met if the price lay within 10 pips on either side of the relevant pivot.

    I have done the same in condition sets 1, 2 and 3 for trading Supports.

    The problem: I ran the strategy today, and got fills at levels ridiculously far from the pivots. On the EURUSD chart you see below, I was filled a shocking 90 pips from R1! On the USDCAD chart, I was filled 30 pips below R1! (Both from shorting Resistance levels. Long trades were not triggered today)

    Could you suggest a possible explanation for the problem?

    My Hypothesis 1: My hunch on why the problem arose is that in trading Forex, 1 "tick" as defined (whether by NT or by my datafeed provider Barchart) is not equal to 1 pip, but something crazy, like 1 cent. If that is indeed the root of the problem, it would explain why my strategy seemingly ignored the pivot levels which I specified! Alarmed, I stopped the strategies and flattened the positions before the parabolic SAR stop was triggered.

    My Hypothesis 2: Another hypothesis I have is regarding the use of -10 ticks, which might not be a valid condition for some reason I don't yet know.

    My Hypothesis 3: A third hypothesis is that the pivots showing on my charts are different from the pivots calculated in the algo. However, I have already taken all precautions against that happening by specifying the same session convention in the chart and in my strategy (FOREX option chosen). I also made sure that I selected daily bars for both, and cross checked that the chart pivot values tallied pivot values provided by Bloomberg. I really don't think the problem lies here.

    These are my three hypotheses (all of which could be wrong!) Please help me shed some light on the matter! I hope you can help me resolve this issue like you did earlier. Thanks!
    Attached Files
    Last edited by skyholder84; 10-26-2010, 10:39 AM.

    Comment


      #17
      skyholder84, for using BarChart please ensure your pip setting is set to 'tenthPip' so the pipettes can be accurately reflected. In the strategy code then a 10 pip offset, would 100 pipettes of course thus you would need to change the code to reflect this.
      BertrandNinjaTrader Customer Service

      Comment


        #18
        Bertrand, I'm not sure I follow you. To me, one pip is 1/100 of a cent, and I'm not sure what a pipette is. Under FX conventions, 1 cent = 100 pips.

        For example, in the EURUSD chart, the central pivot is at 1.3990. This means that if I were to trade the central pivot, my trading band would be 1.3980 - 1.4000. That is a 20 pip difference.

        Please advise me exactly on the steps I need to take to rectify my problem, as I fear our understanding of what constitutes a pip and what constitutes a tick might differ.

        In any case, I fail to see where I went wrong originally. If my prices were originally quoted in pips, each tick is one pip. And my strategy would have the correct band of 20 ticks, ie 20 pips.

        Even if each tick is a tenthpip, this simply means that my strategy activation band is 2 pips rather than 20 pips. If this is correct, the strategy would not have traded at all, rather than traded so far away from the pivot.

        I hope you could provide a better explanation, and offer a step-by-step solution. After I change the FX quote to tenthpip, what do I need to enter as my strategy offset parameter?

        Comment


          #19
          skyholder, we would unfortunately not be able to debug your strategy - you could only ensure via Prints that the values calculated are hitting home as you expect them to - if you use BarChart as connection option, the FX data is quoted in tenthPip resolution, thus you need a tick offset of 100 to express a 10 pip offset.
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Hi Bertrand, I just need you to confirm two things then:

            1) I have set the price quote settings to show tenthpips. Does this mean that 1 tick = 0.1 pips, and 100 ticks would be the correct value if I wish to create a 10pip offset from the pivot point?

            2) Is the value of -100 ticks a valid offset value to use, or must offset values be strictly positive?

            Thanks!

            Comment


              #21
              This is correct skyholder84 - you can enter a negative offset value.
              BertrandNinjaTrader Customer Service

              Comment


                #22
                Could you also confirm that where prices are quoted in tenthpips, Ninjatrader treats 1 tick as a tenthpip? (And hence, to specify a 10 pip offset, I'd use 100 ticks)

                Thanks!

                Comment


                  #23
                  Yes, this is what I actually meant by my comment 'correct' in the previous post, if your min tick is 0.1 (a pipette) you would then use 100 ticks to achieve a 10 pip offset.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    Thanks! I know you don't provide debugguing services, but I would really very appreciate it if you could verify if this code specifies a range +/- 10pips from Pivot level S3. It would help me greatly in narrowing down the list of possible bugs in my strategy. Hope you can help!

                    GetCurrentBid() <= Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).S3[0] + 100 * TickSize

                    &&

                    GetCurrentBid() >= Pivots(PivotRange.Daily, HLCCalculationMode.DailyBars, 0, 0, 0, 20).S3[0] + -100 * TickSize

                    Comment


                      #25
                      The code looks ok to me, please keep in mind in backtesting GetCurrentBid and GetCurrentAsk are replaced by the Close. I would test your entry off by adding a drawing when you intend to trigger a trade, this way you see visually when exactly is evaluates to 'true' as you programmed it in.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #26
                        Thanks for helping me so far! With your help, I have narrowed down the possible bugs to just a few.

                        I might have just stumbled upon the answer. In my strategy, when I configure the pivots, I choose to use daily bars in the calculation of the pivots. However, I did not add the daily bars object. Could this be the cause?

                        It's a very compelling explanation. However, backtesting the flawed strategy shows executions which correctly follow the pivots. Is there any reason why the strategy works correctly in backtest, but not in real-time? If the backtest algo is capable of loading bars objects which did not exist in the strategy code? If so, my queries are all answered, and my problem is solved.

                        Looking forward to your confirmation and advice

                        Comment


                          #27
                          Hello,

                          Yes this is possible. The pivots indicator is not a true multi series indicator so it currently does not work to use it as a hosted indicator (Calling it from a strategy) with the DailyBar setting as it most load bars from the daily seris to do this which isnt possible in the hosted state to my understanding.

                          Therefor when using the Pivots indicator in a strategy it is important to use it in CalcFromIntraDay data mode and not daily bars mode.

                          Let me know if I can be of further assistance.

                          Comment


                            #28
                            Problem solved. Hair-tearing ceased.

                            Many thanks!

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by tkaboris, Today, 05:13 PM
                            0 responses
                            2 views
                            0 likes
                            Last Post tkaboris  
                            Started by GussJ, 03-04-2020, 03:11 PM
                            16 responses
                            3,281 views
                            0 likes
                            Last Post Leafcutter  
                            Started by WHICKED, Today, 12:45 PM
                            2 responses
                            19 views
                            0 likes
                            Last Post WHICKED
                            by WHICKED
                             
                            Started by Tim-c, Today, 02:10 PM
                            1 response
                            10 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by Taddypole, Today, 02:47 PM
                            0 responses
                            5 views
                            0 likes
                            Last Post Taddypole  
                            Working...
                            X