Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Fill to Current Bar

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

    Changing Fill to Current Bar

    I am using tick data to compute an indicator on the Open price of a bar. In real time I would then place a market order and it would fill on some price within the current bar hopefully.

    Is there a way to back test this strategy? The strategy computation now is giving me the open price of the next bar which may be quite different(gaps) from what I will experience in real time and therefore will not allow me to optimize the parameters for the indicator.

    #2
    Unfortunately not since you can not backtest on a tick by tick basis. You can however, run the strategy in real-time tick by tick.
    RayNinjaTrader Customer Service

    Comment


      #3
      Ray,
      In the help menu of 6.5 I find 'Fill Types':

      Custom Fill Algorithms
      In addition to the two system fill types (Default and Liberal) you can also script a custom fill algorithms using any code/text editor.


      Would this give me the capability to change the way an order is filled so that I could fill it with a price from the current bar.



      This code looks kind of difficult and the example is not complete. Is there more documentation for this functionality?

      Comment


        #4
        I don't recall if the current bar value is retrievable withing this class. If it is then yes however, we do not provide support for this which is of course why you do not see documentation. Which just expose it for those who can take advantage of this feature with out our help.
        RayNinjaTrader Customer Service

        Comment


          #5
          If anyone out there has done something to customize Fill Type I would appreciate a copy. Not so good at C# as to tackle this without an example.

          Comment


            #6
            Ray,
            Looking at the code in the @DefaultFillType.cs I am seeing NextHigh,NextLow,NextOpen defined as public variables from some other code that we do not have access to. Can you tell me if Open[0],High[0],Low[0] (CurrentBar Open,High,Low) are defined by some public variable that I can access? If so what would they be called.

            Comment


              #7
              Unfortunately this is beyond what we can provide support for.

              Comment


                #8
                Just as well!

                I followed the procedure in Help:
                1. Provide a new display name for example rename "Liberal" to "MyFill"
                2. Provide a new class name for example rename "LiberalFillType" to "MyFillType"
                3. Code your fill algorithm within the Fill() method
                4. Once complete, open any indicator or strategy within the NinjaTrader's NinjaScript Editor and compile. This will compile the new fill algorithm and make it available within any backtest dialog window.


                After compiling a strategy the Fill Type I had created did not show in the drop down list.



                So what is described in Help does not work. I think!!!

                Comment


                  #9
                  I've done this myself, the procedure does work...did you save the file to something like MyFillType.cs?

                  Comment


                    #10
                    No thanks to MS the file was saved as .cs.txt. Now that is corrected the procedure works but I can't find where I can reference the current bar H/L/O/C.

                    This would be of a great help in testing systems that reference tick data when you are displaying min bars.

                    Comment


                      #11
                      Hi There,

                      Did you have any luck completing this custom fill? I am also working on the same issue. The place where I am running into an issue is in accessing Open, High, Low, Close from the Fill(Order order) method. NextOpen, NextHigh, and NextLow are all available, but I get the error "Close does not exist in the current context". Is this the same issue you rant into earlier?

                      Thanks,

                      Learning1

                      Comment


                        #12
                        Learning1,
                        Yes! That is the problem I encountered. Did not find a way to reference the current OHLC info. Had to switch to IB's API to test my Walk Forward code. if you find a way to reference the current OHLC please post it.

                        Comment


                          #13
                          Guys, next NT6.5 update will expose Open(s), High(s), Low(s), Close(s), Volume(s), Time(s), Medians(s), Typical(s).

                          Comment


                            #14
                            Dierk,
                            Thanks for making this change. Making OHLC available will greatly enhance the capability to simulate real trades. NinjaTrader is by far the most responsive trading package on the market today.

                            Now if you could only fix the problem with the BackBars being added to the length of the Walk Forward
                            (See http://www.ninjatrader-support.com/v...ead.php?t=6000)
                            we would have an exemplary way of doing system testing as it should be done.

                            Comment


                              #15
                              As Ray pointed out this is on our list yet.

                              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