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

EnterLongLimit execution

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

    EnterLongLimit execution

    Hello!
    Help me, please, to understand.
    I've made a strategy in which opens positions with EnterLongLimit order.The strategygenerates signals on bar is closed. However, in the strategy tester (see attached screen)</SPAN>, when the strategy sends limit order, the position's enter occurs exactly at a given limit level (green line on the screen)</SPAN>even if the given level is more thancurrent candle opens. Why is this so? Is not the </SPAN>limit order should be executed at the best price? And in this situation the open price is better than the limit price.
    Attached Files
    Last edited by Lifat; 06-30-2017, 12:36 PM.

    #2
    Hello Lifat,

    Thank you for your note.

    Without the full code we're unable to test on our end.

    If you'd like to upload the full code I can take a look and see if anything jumps out. Or if you'd prefer to email a copy, send to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and the files.

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

    Comment


      #3
      Hello, NinjaTrader_AlanP! Thank You for quick replay!

      ///////////////////////////////////////////////////////////////

      Hello, NinjaTrader_AlanP! Thank You for quick replay!

      Here it is the code in the attached file. The code is very simple.

      I've got the limit level as value of my custom indicator and than need to close a position by stop loss order on another level - a value of the indicator.
      Attached Files
      Last edited by Lifat; 06-30-2017, 12:41 PM.

      Comment


        #4
        In addition the indicators I use
        Attached Files

        Comment


          #5
          Hello Lifat,

          Was the fill in question in real time, backtest, or historical fill?

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

          Comment


            #6
            AlanP, I use historical minute data loaded from TXT file on backtest. And the strategy is testing in strategy analyzer on minute bars as well.
            Last edited by Lifat; 07-01-2017, 01:49 AM.

            Comment


              #7
              Hello,

              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


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

              Comment


                #8
                AlanP, if "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. ", then why limit order does not fill at open price if this price is better than limit level price? That's what i'm talking about.

                Comment


                  #9
                  Hello Lifat,

                  To achieve the behavior you desire you would need to add a secondary data series of type tick to correctly plot your intrabar fill. With a secondary series your limit order would have been filled better the limit price, giving you a more realistic result.
                  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


                  You may also try using High Order Fill resolution for which I’ve provided a link to below.


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

                  Comment


                    #10
                    AlanP, thank you for the help! I'll try follow your recommendations.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GwFutures1988, Today, 02:48 PM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by ScottWalsh, 04-16-2024, 04:29 PM
                    6 responses
                    32 views
                    0 likes
                    Last Post ScottWalsh  
                    Started by frankthearm, Today, 09:08 AM
                    10 responses
                    36 views
                    0 likes
                    Last Post frankthearm  
                    Started by mmenigma, Today, 02:22 PM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by NRITV, Today, 01:15 PM
                    2 responses
                    10 views
                    0 likes
                    Last Post NRITV
                    by NRITV
                     
                    Working...
                    X