Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order entry on simple strategy

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

    Order entry on simple strategy

    I wrote a simple strategy where I want to enter an order on the first bar that crosses an EMA. So far all I have managed to do is enter a long on the next bar.

    EnterLong enters one bar too late. Entering a limit order never executes.

    I am using day bars for the simulation.

    #2
    What is your CalculateOnBarClose set to? (I'm guessing TRUE).

    Comment


      #3
      Hello chartish,

      Thanks for your post.

      In addition to the question member sledge posed are you seeing this while back testing, market replay or live data?
      Paul H.NinjaTrader Customer Service

      Comment


        #4
        I have tried setting it to false and removing it altogether. No change.

        Comment


          #5
          I am Backtesting.

          Comment


            #6
            Hello chartish,

            Thanks for your replies.

            When backtesting CalculateOnbarClose will be true because historical data does not contain the tics that made up the bar, only the finished values of the bar (Open, High, Low and close). Your code is executed at the end of the bar, if the code says to place an order then that order will be placed on the next bar which explains your observations.

            To provide intrabar fills, for backtesting, you can add a secondary dataseries that has a shorter timeframe. Here is a reference to sample code that shows this: http://ninjatrader.com/support/forum...ead.php?t=6652
            Paul H.NinjaTrader Customer Service

            Comment


              #7
              So you have to have intraday data to do this?

              Comment


                #8
                Hello chartish,

                If you are using daily bars, in backtesting, your code will execute once, at the end of each bar. If you want your conditions to checked/executed sooner than the end of a daily bar then yes you will need intraday data.
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks. I appreciate you help.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by PaulMohn, Today, 05:00 AM
                  0 responses
                  8 views
                  0 likes
                  Last Post PaulMohn  
                  Started by ZenCortexAuCost, Today, 04:24 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by ZenCortexAuCost, Today, 04:22 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post ZenCortexAuCost  
                  Started by SantoshXX, Today, 03:09 AM
                  0 responses
                  16 views
                  0 likes
                  Last Post SantoshXX  
                  Started by DanielTynera, Today, 01:14 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post DanielTynera  
                  Working...
                  X