Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parabolic SAR Automated Strategy doesn't work.

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

    Parabolic SAR Automated Strategy doesn't work.

    I have tried to set up the simplest autotrade ninjascript strategy in the world. Basically using the Parabolic SAR and stop orders. The strategy consistently misses trades and will not exit propoerly because of a flaw in the Parabolic SAR.

    When a stop is triggered, the Parabolic SAR should immediately reverse position making a new stop position valid, but it doesn't. The indicator waits until the next bar before placing the reversal. Any thoughts on fixing this?


    #2
    Hi, please check the attached sample for the ParabolicSAR reveral trades. This one reverses the position when the Close crosses the Parabolic value plus a tick offset. In your screenshot you don't use a reversal order, just an ExitShort which puts you into a flat state after being short.

    The strategy will also have to wait for the bar that penetrates the SAR to be closed and then it places the order for the next bar, since you cannot look 'into' the bar.

    If you need this tested with more resolution, I would suggest looking at this reference sample on how to add a finer datastream to simulate intrabar execution - http://www.ninjatrader-support2.com/...ead.php?t=6652
    Attached Files
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      In your screenshot you don't use a reversal order, just an ExitShort which puts you into a flat state after being short.
      Correct. I have developed 2 different strategies, one to take just the long positions, and another to take just the short positions. I do not want a true reversal. The problem still occurs because the reversal does not happen until after the bar closes if at all. I don't have that problem with the Parabolic on Best Pro Trader, it auto-reverses. Once the stop is triggered, it flips positions on the indicator. If you have a workaround I am all ears. I am unsure why the parabolic was programmed in the way it was, it seems obvious that if it hits a stop then the indicator should reverse on the next bar at the very least.

      Here are another 2 examples of the reversal not working when the price action is triggered.





      I think that fixing the indicator is as simple as referencing the high or low of the previous bar rather than the default input series. One thing is for certain, the parabolic doesn't work properly in it's current formulation.

      So in my opinion this is not an intrabar issue. It is a functional error of the indicator in ninja itself. There is no denying that the reversal should have been triggered both times. So how can this be fixed?
      Last edited by kocmodpom; 03-06-2009, 08:06 AM. Reason: minor adjustments

      Comment


        #4
        This is a great link and saves a question about better resolution for the Stochastic specifically. Thanks.

        Originally posted by NinjaTrader_Bertrand View Post
        If you need this tested with more resolution, I would suggest looking at this reference sample on how to add a finer datastream to simulate intrabar execution - http://www.ninjatrader-support2.com/...ead.php?t=6652

        Comment


          #5
          In backtesting, all orders placed on the signal bar are always executed on the next bar. On the signal bar, you evaluated a signal as of the point in time when you already have the closing price for that bar. Next tradeable location is the open of the next bar.

          In real-time, the same is true if you have CalculateOnBarClose set to true.

          You cannot evaluate your system visually. Please use Print()s along with TraceOrders to determine the values of your conditions at each point in time. http://www.ninjatrader-support2.com/...ead.php?t=3418
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Ok I will attempt to test with the newer version of the Parabolic provided below to see if I can recreate the issue.
            Last edited by kocmodpom; 03-06-2009, 03:53 PM.

            Comment


              #7
              After a few hours of testing the improved Parabolic indicator you posted does work properly! Will you make it a standard part of the next Ninja upgrade?

              Comment


                #8
                Great you got it working, to clarify: the indicator itself works just fine. I just used the correct order to reverse position in my posted zip you tried out. In your strategy you were using ExitLong and ExitShort, those will get you flat, but not reverse as you liked. If you are for example long and issue a EnterShort it will close the long position and get you into a new short position.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Hello,
                  Very nice strategy, but is it possible to include a trailing stop in the design?

                  Cheers

                  Comment


                    #10
                    Since it was build in the wizard, you can modify it there and add a trailing stop on the 'Stops and Targets' page - http://www.ninjatrader-support.com/H...rdScreens.html
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_Bertrand View Post
                      In your strategy you were using ExitLong and ExitShort, those will get you flat, but not reverse as you liked. If you are for example long and issue a EnterShort it will close the long position and get you into a new short position.
                      No, no, not what I wanted. I indeed only want to go flat, not reverse. I have two strategies, one for taking all the long positions, and another separate strategy for taking the shorts. On any given day I only take one side of the Parabolic signals.

                      Furthermore, the ParabolicSAR is intended to be used with STOP orders at the calculated values, not market orders at crossing points. So the autotrade solution you provided is not really accurate. The point is that the reverse of all the long trades should equal exactly all the short trades at every entry and exit point. On to the problem at hand.

                      Unfortunately, the problem has reared its head on ENTRY again.

                      In the following example, there is only 1 step in the entry strategy as follows:



                      This single entry command results in the following entry points from the March 7th ES contract data.



                      Note the MISSED ENTRY POINT at 680.25 which happens to be exactly where the new ParabolicSAR value = the open price of the next bar. I am not sure if this is a correct value calculation (I don't have my copies of the indicator as published in Wilder's "New Concepts in Technical Analysis" where the indicator was invented and explicitly calculated piece by piece painstakingly by hand. He is the inventor afterall.)

                      The conflict arises in that you can't enter a long stop order when the current market price is equal to or greater than the Parabolic value of the stop order.

                      The obvious solution would be to add a secondary long stop entry at the previous value of the Parabolic, so that if the order in step one fails to execute, then the stop still active at the previous value would.

                      So to compensate, I create step 2 which also places a stop order at the previous value of the Parabolic with the following command:



                      Which results in the following chart...



                      So now the final entry point is corrected for, but the second entry point is now incorrect. It appears as though the Parabolic[1] value was used to trigger the stop entry instead of Parabolic[0]. This makes no sense to me since clearly the lower value of Parabolic[0] should be triggered first.

                      Any thoughts why this problem is occuring? Doesn't seem to matter if I use calculate on close or not. Kind of frustrating.
                      Attached Files
                      Last edited by kocmodpom; 03-14-2009, 11:24 PM. Reason: Added description of ParabolicSAR system

                      Comment


                        #12
                        Hello,

                        Send an email to us via Help>Mail to Support "attn Josh" and we will provide you with another ParabolicSAR indicator. This is likely this cause of the issue. Include a link to this thread for his reference.
                        DenNinjaTrader Customer Service

                        Comment


                          #13
                          Updated Version - Same Problem

                          As per Bertrand's instructions, I installed the latest version of Ninjatrader X.9 released yesterday and reran the strategy. Same result. Some of hte time, the stop on the previous bar's Parabolic is triggered which should not happen. Other times it works fine. Case in point, Tuesday's market data on ES. So why is this still happening?

                          Is there a problem executing stop orders in strategies in general?

                          Last edited by kocmodpom; 03-20-2009, 01:29 AM. Reason: added info

                          Comment


                            #14
                            Hi, thanks for the update - can you please post the code you used to arrive at this? Just because you use the Parabolic indicator for generating your signals, it does not mean you use place the orders as a certain type, limit / stop...so if you place a market order after the condition occured this may explain the difference you witness. Thanks!
                            BertrandNinjaTrader Customer Service

                            Comment


                              #15
                              Filling orders right away.

                              Every strategy that use always fills my order right away. How do I stop this from happening? A lonng is placed and then the order takes me out the same time I place the trade.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              14 views
                              0 likes
                              Last Post AaronKoRn  
                              Started by carnitron, Yesterday, 08:42 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post carnitron  
                              Started by strategist007, Yesterday, 07:51 PM
                              0 responses
                              13 views
                              0 likes
                              Last Post strategist007  
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              44 responses
                              3,983 views
                              3 likes
                              Last Post jhudas88  
                              Working...
                              X