Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

EnterShort and EnterLong

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

    EnterShort and EnterLong

    Hi EV
    My strategy should enter long or short on current bar but it enters only on the next OnBarUpdate()
    The question is how to do that strategy enters Long/Short on current OnBarUpdate()
    Last edited by dv926844; 01-26-2017, 05:01 AM.

    #2
    Hello dv926844,

    Thanks for your post.

    Are your observations made on historical data or on live data trades?

    Is your Strategy run with Calculate On Bar Close set to true or false?

    Are you using EnterLong()/EnterShort() or other entry methods?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      hi, Paul thank you for reply.
      1) Live
      2) false
      3) EnterLong() and EnterShort()

      Comment


        #4
        Hello dv926844,

        Thanks for your reply.

        Please post a screenshot that shows some example entries on the chart. Need to be able to see both the price scale and the time base of the chart.

        Thank-you.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello, Paul

          Here is a screenshot
          Attached Files

          Comment


            #6
            Hello dv926844,

            I would expect to the trade to enter on the bar prior with Calculate on bar close set to false.
            Would you be able to upload the script so I may test on our end?

            To export a NinjaScript from NinjaTrader 7 do the following:
            From the Control Center window select File -> Utilities-> Export NinjaScript...
            Select the file in the left column then click “>”, then press export and name the file.
            Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              I was using a SampleMACrossOver for a test(it's built in strategy) to show exapmle on screenshot and I tried CalculateOnBarClose with both true or false. Result is the same

              Comment


                #8
                Hello dv926844,

                Thank you for writing in.

                When using backtesting the strategy will run exactly the same as if CalculateOnBarClose is set to true. This is true whenever the strategy runs on historical type data. The reason for this is because the only info known historically is the Bar open, High, Low and close and not all of the ticks that make up the bar. You can also get extremely misleading results if you are using a bar that changes shape such as renko bar type as the finished bar does not show the true range of price movement.

                Please see Discrepancies: Real-Time vs Backtest section of our helpguide.



                Adding a secondary data series of a smaller time duration would allow your strategy to enter/exit intra bar and give you results closer to market replay.

                Please see Backtesting NinjaScript Strategies with an intrabar granularity for a reference example on how you’d set this up.

                You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by


                Historical Trade Performance is just a backtest. If they are using Real-time & Historical then the backtest is thrown in with any real-time trades made on the account from the strategy.

                Please let us know if you need further assistance.
                Alan P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bmartz, 03-12-2024, 06:12 AM
                4 responses
                31 views
                0 likes
                Last Post bmartz
                by bmartz
                 
                Started by Aviram Y, Today, 05:29 AM
                4 responses
                12 views
                0 likes
                Last Post Aviram Y  
                Started by algospoke, 04-17-2024, 06:40 PM
                3 responses
                28 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by cls71, Today, 04:45 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X