Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Filling Type

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

    Custom Filling Type

    Hi!

    I'm trying to code a filling-type script which fills the stoplosses (entered with "SetStopLoss" and profttarget (SetProfitTarget) at the last accepted price without any slippage as soon the current price touches this last accepted price, no matter if this occurs with a gap or not.

    I simply want the fill at the last accepted Stop-price every time. Of course this won't work in live-trading but for backtesting purposes I would like my strategy to behave like that.

    1. Is this possible?
    2. Can someone give me a little help on this issue, maybe with a code snippet?

    thx

    #2
    Technically its possible to do this however programming at this level is currently outside the scope of what is considered supported NinjaScript.
    RayNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ray View Post
      Technically its possible to do this however programming at this level is currently outside the scope of what is considered supported NinjaScript.
      Hi folks,

      Does anyone know how to programmatically set the filltype for a strategy in the Initialize() method; e.g,:

      this.IncludeCommission = true;
      this.EntryHandling = EntryHandling.UniqueEntries;
      this.FillType = What_is_this_enum.A_custome_fill_type; // is there an enum of filltypes?

      Thanks very much in advance.
      Last edited by kevin.nguyen; 08-31-2012, 09:59 AM.

      Comment


        #4
        Hello kevin.nguyen,

        There would not be a supported way to programmatically set the fill type inside a strategy as it only will effect the historical fill processing which can be set when applying a strategy.

        Let us know if we can be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Does it mean that fillType in real time is meanigless?

          Originally posted by NinjaTrader_JC View Post
          Hello kevin.nguyen,

          There would not be a supported way to programmatically set the fill type inside a strategy as it only will effect the historical fill processing which can be set when applying a strategy.

          Let us know if we can be of further assistance.
          As in title. Does it mean that when a strategy is applied in real time, the custom fill routine is not called? Would be strange.

          Comment


            #6
            Hello xTrader1,

            Originally posted by xTrader1 View Post
            As in title. Does it mean that when a strategy is applied in real time, the custom fill routine is not called? Would be strange.
            That is correct.

            When adding a strategy to a chart, the option for Fill type, is located under the label 'Historical Fill Processing'. This means that the Fill type is applied to historical trade information but does not apply to real time.

            The simulation engine at that point takes over and will fill orders based on volume (depending on the settings in Tools -> Options... -> Simulator tab). Most options here are not applied to historical trade information.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChelseaB View Post
              Hello xTrader1,
              That is correct.
              .
              So:
              1) Why "Historical Fill Processing" is not shaded when applying a strategy in real time?
              2) How an order is filled in real time? Always last Close of the instrument in the beginning of the next bar, or another way?

              Comment


                #8
                Hello xTrader1,

                When a strategy is run the strategy will process historical trade information before processing real time data. This option will apply to this historical trade information.

                There is a Historical variable that will have the state of the strategy on whether the strategy is processing historical data or real time data.
                http://www.ninjatrader.com/support/h...historical.htm

                You can implicitly write logic into your strategy to not process historical data, but that will not gray out this setting.

                When a strategy places an order depends on what method the script is, and the Calculate on bar close setting.

                If the order submission is in OnMarketData, or OnMarketDepth, this can be triggered anytime data is received.

                http://www.ninjatrader.com/support/h...marketdata.htm
                http://www.ninjatrader.com/support/h...arketdepth.htm

                If an order is submitted in OnOrderUpdate, OnPositionUpdate, or OnExecution the order will be submitted just after another order is filled or has an order update such as being accepted. (This is all depending on your logic)

                http://www.ninjatrader.com/support/h...rderupdate.htm
                http://www.ninjatrader.com/support/h...tionupdate.htm
                http://www.ninjatrader.com/support/h...nexecution.htm

                (edited and corrected to say OnBarUpdate)
                If the order is submitted in OnBarUpdate with 'Calculate on bar close' set to True, the order will be filled when the bar closes.

                If the order is submitted in OnBarUpdate with 'Calculate on bar close' set to False, the order will be filled when a last tick is received.

                http://www.ninjatrader.com/support/h...nbarupdate.htm
                http://www.ninjatrader.com/support/h...onbarclose.htm
                Last edited by NinjaTrader_ChelseaB; 10-01-2014, 12:09 PM.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_ChelseaB View Post
                  Hello xTrader1,

                  When a strategy is run the strategy will process historical trade information before processing real time data. This option will apply to this historical trade information.

                  There is a Historical variable that will have the state of the strategy on whether the strategy is processing historical data or real time data.
                  http://www.ninjatrader.com/support/h...historical.htm

                  You can implicitly write logic into your strategy to not process historical data, but that will not gray out this setting.

                  When a strategy places an order depends on what method the script is, and the Calculate on bar close setting.

                  If the order submission is in OnMarketData, or OnMarketDepth, this can be triggered anytime data is received.

                  http://www.ninjatrader.com/support/h...marketdata.htm
                  http://www.ninjatrader.com/support/h...arketdepth.htm

                  If an order is submitted in OnOrderUpdate, OnPositionUpdate, or OnExecution the order will be submitted just after another order is filled or has an order update such as being accepted. (This is all depending on your logic)

                  http://www.ninjatrader.com/support/h...rderupdate.htm
                  http://www.ninjatrader.com/support/h...tionupdate.htm
                  http://www.ninjatrader.com/support/h...nexecution.htm

                  If the order is submitted in OnOrderUpdate with 'Calculate on bar close' set to True, the order will be filled when the bar closes.

                  If the order is submitted in OnOrderUpdate with 'Calculate on bar close' set to False, the order will be filled when a last tick is received.

                  http://www.ninjatrader.com/support/h...nbarupdate.htm
                  http://www.ninjatrader.com/support/h...onbarclose.htm
                  Did your penultimate 2 paragraphs really mean to reference OnBarUpdate(), rather than OnOrderUpdate()?

                  Comment


                    #10
                    Kognam,

                    You are correct. Thank you very much for catching that mistake!

                    Like a hawk!
                    Chelsea B.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Option Whisperer, Today, 09:55 AM
                    1 response
                    11 views
                    0 likes
                    Last Post bltdavid  
                    Started by port119, Today, 02:43 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post port119
                    by port119
                     
                    Started by Philippe56140, Today, 02:35 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post Philippe56140  
                    Started by 00nevest, Today, 02:27 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post 00nevest  
                    Started by Jonafare, 12-06-2012, 03:48 PM
                    5 responses
                    3,986 views
                    0 likes
                    Last Post rene69851  
                    Working...
                    X