• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Stop Working after a while

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

    Strategy Stop Working after a while

    [IMG]file:///C:/Users/Sohail/AppData/Local/Temp/msohtmlclip1/01/clip_image001.png[/IMG][IMG]file:///C:/Users/Sohail/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png[/IMG]I apologize for my ignorance. I am new to ninjatrader and trying to understand the strategy builder. I have created a very basic strategy where bar cross below the upper bar of Keltner channel then strategy enters short. Profit target is 10 pips and there is no stop loss. When I enabled strategy in market replay environment then strategy starts working very smoothly but after a while, it stops making short entries when condition met. Entry per direction is set to 10. Start behavior is set to immediately submit. I have tried other start behavior as well but the results are the same. The strategy also checks before entering into a trade that last entered trade was at-least 10 bars ago. Please refer attached1 where condition met but the strategy did not enter short:[IMG]file:///C:/Users/Sohail/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png[/IMG]
    Please refer marked area in attached1.

    Please refer attached2 which shows the strategy position and account position.

    Thanks for help in advance.
    [IMG]file:///C:/Users/Sohail/AppData/Local/Temp/msohtmlclip1/01/clip_image006.png[/IMG]
    Attached Files

    #2
    Hello sohailashra,

    Are you hitting the limit of 10 entries in the same direction?

    What is the position when the orders stop?

    If you enable TraceOrders, do you see any messages appearing in the NinjaScript Output Window that orders are being ignored?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea B.

      Thanks for your reply. Limit of 10 is not reach. u can see in attached2 that position is 3000 (each trade is for 1000 units). Therefore there are 3 open trades in short direction which is less than 10.

      My understanding is that limit on direction trade means that strategy will keep trading until there are 10 open trades. After reaching the limit strategy will stop making trades until atleast 1 trade is closed and then strategy will start trading till open trades equals to 10 again. please correct my understanding if I am woring.

      For trace I can check it again but as far as I remember there was no message of order being ignored.

      Thanks,

      Comment


        #4
        Hello sohailashraf,

        Where you have mentioned:
        "My understanding is that limit on direction trade means that strategy will keep trading until there are 10 open trades"

        I want to clarify that these orders are based on the position. If you were to place 100 working orders all at the same time, this would be allowed. If 10 orders have filled and contributed to the open position, a new 11th order placed after this would be ignored.

        Below is a link to the help guide with a description.
        https://ninjatrader.com/support/help...rdirection.htm

        I was not able to confirm, is TraceOrders enabled?
        Do you see the orders are ignored or that this order was submitted with the traceorders in the output window? (You will see a message for one or the other if the condition to submit the order has evaluated as true)

        May I see the output so that I may see the time the condition is true and the trace orders information?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Please refer attached screenshot. Are you referring to this output. I do not see any order submitted message or order ignored message for that particular bar.

          If attached screen shot is not you are referring then please guide me where to get this trace.

          Thanks for your help in advance.
          Attached Files

          Comment


            #6
            Hello sohailashraf,

            TraceOrders and prints which are used to debug a script and understand behavior go to the NinjaScript Output Window.

            New > NinjaScript Output

            Below is a link to a forum post that discusses using Prints and TraceOrders to understand behavior.
            https://ninjatrader.com/support/foru...121#post791121

            Please enable TraceOrders and include the full output from the NinjaScript Output window. (Right-click the window > select Save As)
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Chelsea B.

              Thanks for your response. I enabled the trace and i found ignored submit order. However I am not able to understand that how it exceeded entry signal since I have put number of trade per direction as 10 and short position is just 3000.

              Per trade quantity is 1000. So if you divide 3000 by 1000 then trade per direction comes to 3.

              Following is the trace log.

              4/15/2019 9:17:46 PM Strategy 'zV1KCSell/89516685': Entered internal SubmitOrderManaged() method at 4/15/2019 9:17:46 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1,000 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''
              4/15/2019 9:17:46 PM Strategy 'zV1KCSell/89516685': Ignored SubmitOrderManaged() method at 4/15/2019 9:17:46 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1,000 LimitPrice=0 StopPrice=0 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'


              Regards,

              Comment


                #8
                Hello sohailashraf,

                From the output you are getting ignored orders because it is exceeding the entries per direction. This is why the strategy stops trading.

                4/15/2019 9:17:46 PM Strategy 'zV1KCSell/89516685': Ignored SubmitOrderManaged() method at 4/15/2019 9:17:46 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1,000 LimitPrice=0 StopPrice=0 SignalName='Sell short' FromEntrySignal='' Reason='Exceeded entry signals limit based on EntryHandling and EntriesPerDirection properties'

                Either increase the EntriesPerDirection, or reduce the number of trades that can be placed in a direction and contribute to the position.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by mohdhm, Today, 04:37 PM
                1 response
                17 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by trader14, Yesterday, 08:23 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by bigsurftrader, 02-24-2017, 12:23 AM
                4 responses
                1,162 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by svadukia, Yesterday, 01:56 AM
                2 responses
                25 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantrob, Today, 10:24 AM
                1 response
                7 views
                0 likes
                Last Post bltdavid  
                Working...
                X