Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

1 pip stoploss and PF of 6.5 WOW (something's wrong)

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

    1 pip stoploss and PF of 6.5 WOW (something's wrong)

    I started a thread over in the general category but decided this made more sense over here in the issues section. This started off as some questions I had regarding doing successful back testing on Renko charts. After reading through dozens of threads I believe I was able to get my strategy setup correctly. The setup is as follows...
    1. Renko is my primary series(for my testing I am using brick size 10)
    2. My secondary series data is 1 tick data from a Dukascopy import
    3. I check for my entry signal on the Renko charts, and enter my trade using the overloaded verison of EnterLong()/EnterShort() that takes the BarsInProgressIndex parameter so I can execute my market order on the granular series, not the Renko.
    4. I wrote code for a manual trailing stop which is checked every tick, if the trade is stopped I use the overloaded ExitLong()/ExitShort() that takes the BarsInProgressIndex parameter so I can execute my exit order on the granular series, not the Renko.
    5. I use OnOrderUpdate() to track the order object and also pull information on the order to help track down the issue I am seeing

    So the issue I am having is that I have a trailing stop loss of 1 pip, I currently have it set up to just constantly re-enter the market every time it gets stopped out, and the result I am getting is a profit factor of 6.5, and even up to 10 if I play with the settings. And that is after it takes over 100,000 trades! This result is obviously a total farce. I can write the same simple EA in other programs(MT4 and MT5 for example), and I will get a PF of 0.1. I understand this is using close only data, so it doesn't have the realism of bid/ask spreads(yes I know I can simulate that with more series, which I probably will doin the future, but for now I would like to see the close only data working correctly). Even with close only and no bid/ask spread I would still expect a strategy that just enters constantly with a 1 pip spread to perform very poorly, not achieve 6-10 PF on 100k trades.

    I added some print statements to monitor prices as orders are being filled to see if there is any strange candle problems happening but it doesn't really look like it to me. Below I added the output from those Print statements for a single trade. #1 is the current Close[] when EnterLong() or EnterShort() is called(this is called from OnBarUpdate()). #2 and #3 are printed inside of OnOrderUpdate() when the actual entry order is filled. #2 are the Close[] prices again just to ensure the order is filled on the same tick that EnterLong/EnterShort was called, which it always is. #3 looks at 1 bar previous for both series data. #4 and #5 is the same as #2 and #3 but when the exit order is filled. Also as a side note this strategy can only open 1 order at a time, and is allowed to go long or short.

    1. Renko price at entry: 1.10881 - Tick price at entry: 1.10877
    2. tick_data_long - Renko price: 1.10881 - Tick price: 1.10877 - FillPrice: 1.10876
    3. tick_data_long - Renko Previous price: 1.10871 - Tick Previous price: 1.10877 - FillPrice: 1.10876
    4. tick_data_close_long - Renko price: 1.10881 - Tick price: 1.10881 - FillPrice: 1.10877
    5. tick_data_close_long - Renko Previous price: 1.10871 - Tick Previous price: 1.10883 - FillPrice: 1.10877

    So overall I want to know why I am getting these fake, amazing results. The only explanation is something is not right with order execution and it is somehow scalping a little profit each trade due to something with the back testing engine. If that is the case then I would like to know what I am doing wrong and how to fix it. Obviously NT built an amazing back testing engine that works well, and I am just missing something. I also have a second side question, sometimes my fill price is 1 pip above or below the currect Close[] of the tick price at the time of order fill, and sometimes it is exactly the same. Why is that inconsistent(I would expect the fill price to be the same as Close[0] at time of order fill). Is it filling on the next tick that hasn't yet been loaded into Close[] when OnOrderUpdate()is called?

    Thanks!
    Last edited by krugman25; 08-07-2016, 09:38 PM.

    #2
    I don't want to sound impatient but is there anyone that has any ideas about this. I can't move forward with strategy development until this gets resolved since I won't be able to trust any results I get. As described in the original post it is a very straightforward issue and simple to reproduce. Constantly re-entering the market after being stopped out from a 1 pip stop should not results in a PF over 1, let alone a 5-10 PF.

    As an added note, I switched the primary series from Renko to minute candles. I still get profit factors that are way to large to make any sense, so I am not convinced it is an issue with having Renko as the primary data.

    Comment


      #3
      I use Renko (actually UniRenko) and have found out that you have to change the parameters of the size. If you used 2 in NT7 you now have to use 20 in NT8 or at least I do with Forex and FXCM as my provider. Same goes with Range bars. All has to do with the 10th pip. I've done a lot of posts about this here.

      Hope it helps.

      Comment


        #4
        Hello krugman25,

        Thank you for your post.

        You are running NinjaTrader 8, correct? If so, you can use TickReplay in order to calculate intra-bar on the Renko bars: http://ninjatrader.com/support/helpG...ick_replay.htm

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello krugman25,

          Thank you for your post.

          You are running NinjaTrader 8, correct? If so, you can use TickReplay in order to calculate intra-bar on the Renko bars: http://ninjatrader.com/support/helpG...ick_replay.htm
          Yes sir I am using NT8(latest build). Isn't what I am doing right now giving me intra-bar granularity on my market orders? Lets take a look at my setup and how orders are being executed at a code level...
          1. Every new Renko bar I check if my trade condition is met.
          2. If trade condition is met I then call EnterLong()/EnterShort() and use the overloaded version and pass in my tick data series, for example
            Code:
            EnterLong(1, 10000, "Long_From_Tick_Series")
          3. This gets me in the market at the very next tick, not the next Renko bar
          4. Once I am in a trade I then monitor that trade, tick by tick using the intra-bar(tick) data using BarsInProgress() == 1. I don't use the built in trailing stop, since it won't work due to the fact the trailing stop would be used on the Renko bars. Rather I programmed my own trailing stop that I check at every tick of the secondary series tick data.
          5. If my trade is stopped out I call ExitLong()/Exit short() and use the overloaded version and pass in my tick data series, for example
            Code:
            ExitLong(1, 10000, "Exit_Long_From_Tick_Series", "Long_From_Tick_Series")
          6. This gets me out of the market at the very next tick, not the next Renko bar

          In summary it should be using the Renko chart just for finding the entry signal. If a new Renko bar triggers an entry, it then enters the trade using tick data. It also monitors the trade, tick by tick and if it is stopped out it also exits using the tick data. That should in effect give me tick level market order granularity while being able to use Renko just for my entry signal.

          From my testing and generous use of print statements it looks like that is exactly what it is doing. What am I missing then from my description above? Is that not how trades would be executed from market replay or live? If I am not using the Renko bars to enter, manage, or exit my orders, but rather using tick data series, then how would the Renko bars be having any affect on the wrong profits I am seeing?
          Last edited by krugman25; 08-08-2016, 03:00 PM.

          Comment


            #6
            Thanks Segwin, I did actually see some of your previous posts about that. Thank you for the heads up, I will keep that in mind.

            In regards to the issue I am seeing, even if NT8 is interpreting my brick size of 10 as a 1 pip brick, it still wouldn't explain why I am getting these false profit results.

            Originally posted by Segwin View Post
            I use Renko (actually UniRenko) and have found out that you have to change the parameters of the size. If you used 2 in NT7 you now have to use 20 in NT8 or at least I do with Forex and FXCM as my provider. Same goes with Range bars. All has to do with the 10th pip. I've done a lot of posts about this here.

            Hope it helps.

            Comment


              #7
              I feel like I am beating my head against a wall on this. What if I make my primary series the 1 tick data and add the renko charts as the second series? Would that solve my and a lot of other peoples problems.

              UPDATE: I did swap the series and made my tick data primary and added the renko as secondary. Since the tick data was now the primary I went ahead and used the built in trailing stop. The results, not only did it not fix anything, I had an ever higher profit factor of 11!
              Last edited by krugman25; 08-08-2016, 06:25 PM.

              Comment


                #8
                Have you tried this at all in NT7?

                Comment


                  #9
                  Originally posted by Segwin View Post
                  Have you tried this at all in NT7?
                  No. I seem to keep running back to 7 because I continuously run into problems with 8, but I have wasted so much time doing that I decided I am going to just stick with 8 and try to resolve the issue.
                  Maybe I will eventually cave and try 7, who knows.

                  Comment


                    #10
                    I see a lot of NT techs posting in these forums day in and day out. I am curious, why so little attention to this post. Seems like a pretty straightforward and repeatable issue?

                    Thanks.

                    Comment


                      #11
                      Originally posted by krugman25 View Post
                      No. I seem to keep running back to 7 because I continuously run into problems with 8, but I have wasted so much time doing that I decided I am going to just stick with 8 and try to resolve the issue.
                      Maybe I will eventually cave and try 7, who knows.
                      Only reason I ask is that if it works OK in 7 then you would know there is a hangup in 8.
                      Last edited by Segwin; 08-09-2016, 06:18 PM.

                      Comment


                        #12
                        Originally posted by krugman25 View Post
                        I feel like I am beating my head against a wall on this. What if I make my primary series the 1 tick data and add the renko charts as the second series? Would that solve my and a lot of other peoples problems.

                        UPDATE: I did swap the series and made my tick data primary and added the renko as secondary. Since the tick data was now the primary I went ahead and used the built in trailing stop. The results, not only did it not fix anything, I had an ever higher profit factor of 11!
                        You are correct in that even TickReplay will not provide the intra-bar movements needed for the Renko bars. In backtesting and historical performance, the fill of an order is determined by the Open, High, Low, and Close of the bar. This limits Renko bars as they re-draw the Open of the bar after it has already formed. As Renko bars are formed based on the intra-bar price movement, prices that were traded in real-time can be "cut-off" due to the historical Open, High, Low, Close. So there is no way of knowing if an order placed only a few ticks away from the Low or High would have truly filled.

                        Adding an additional 1 Tick Series will not resolve this nor will TickReplay.

                        Comment


                          #13
                          Originally posted by NinjaTrader_PatrickH View Post
                          You are correct in that even TickReplay will not provide the intra-bar movements needed for the Renko bars. In backtesting and historical performance, the fill of an order is determined by the Open, High, Low, and Close of the bar. This limits Renko bars as they re-draw the Open of the bar after it has already formed. As Renko bars are formed based on the intra-bar price movement, prices that were traded in real-time can be "cut-off" due to the historical Open, High, Low, Close. So there is no way of knowing if an order placed only a few ticks away from the Low or High would have truly filled.

                          Adding an additional 1 Tick Series will not resolve this nor will TickReplay.
                          I appreciate you bearing with me here. I think I am going set my primary data series as tick data and just build my own Renko bar collection within the code. I was already considering doing that, the only reason I wanted to use the built in Renko was because of the convenience of being able to use indicators on the series data versus having to manually write indicators to use on my own customer Renko bars.

                          I still have another question about using the overloaded method of EnterLong,EnterShort,ExitLong,ExitShort that takes as its first parameter the bars series. I have read both in these forums and in the NT documentation that you can add tick data as a secondary series and that way you can create orders on a smaller time frame, to achieve more realistic, intra-bar order execution. That is exactly what I did with my Renko strategy, which I've explain in detail in this thread. So my question is how am I misunderstanding what I read from forums and the NT documentation?
                          Last edited by krugman25; 08-09-2016, 12:38 PM.

                          Comment


                            #14
                            Hello krugman25,

                            You can simulate intra-bar fills with an added 1 Tick series, but this will not simulate the real time creation of a Renko bar on a historical backtest.

                            Comment


                              #15
                              Originally posted by NinjaTrader_PatrickH View Post
                              Hello krugman25,

                              You can simulate intra-bar fills with an added 1 Tick series, but this will not simulate the real time creation of a Renko bar on a historical backtest.
                              Does this same issue affect regular candlestick type bars? Also does the back tester ever "peek forward" and use prices from the next bar that hasn't formed. Final question! Does NT8 backtester have 1 second resolution or has it been updated for micro second resolution? I was reading a thread from about a year ago that it was on NT's to-do to make the resolution higher.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              672 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              379 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              111 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              575 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              582 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X