Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

EntriesPerDirection = 2 is not working. It only allows 1 entry per direction.

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

    EntriesPerDirection = 2 is not working. It only allows 1 entry per direction.

    My strategy won't allow more than one entry per direction in backtesting. It just ignore it, no error messages. My settings are shown below. Please help.

    OnStateChange()
    { if (State == State.SetDefaults)
    { EntriesPerDirection = 2;
    EntryHandling = EntryHandling.AllEntries;

    #2
    Hello JaeBSong,

    Welcome to the NinjaTrader forums!

    Did you modify this after adding an instance of the strategy?

    If so, did you remove the instance and add a new instance to pull the defaults? (Defaults are only pulled as the default values for new instances)

    Ignored orders, will be shown in the NinjaScript Output window when TraceOrders is enabled.

    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you so much for your reply Could you please tell me how to remove the instance and add a new instance?

      Comment


        #4
        Hello JaeBSong,

        Right-click the chart -> select Strategies
        In the Configured area select the active instance -> click remove
        In the Available area select the strategy name -> click add to add a new instance.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          I removed instance and added a new instance but it still ignores the additional orders. The ignored orders were not shown in the trace.
          Here are trace outputs.

          Enabling NinjaScript strategy 'myTrendLineT50Stg25/293079644' : On starting a real-time strategy - StartBehavior=WaitUntilFlat EntryHandling=All entries EntriesPerDirection=5 StopTargetHandling=Per entry execution ErrorHandling=Stop strategy, cancel orders, close positions ExitOnSessionClose=True / triggering 30 seconds before close SetOrderQuantityBy=Strategy ConnectionLossHandling=Recalculate DisconnectDelaySeconds=10 CancelEntriesOnStrategyDisable=False CancelExitsOnStrategyDisable=False Calculate=On each tick IsUnmanaged=False MaxRestarts=4 in 5 minutes

          4/24/2023 1:00:32 PM Strategy 'myTrendLineT50Stg25/293079644': Entered internal SubmitOrderManaged() method at 4/24/2023 1:00:32 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=100 LimitPrice=0 StopPrice=0 SignalName='' FromEntrySignal=''​​

          Comment


            #6
            Hello JaeBSong,

            Are you certain a second order with a different unique signalName is being submitted?

            If this is the complete TraceOrders output and you have not removed any, this would imply no second order has been submitted.

            Add a print one line above where the second order is submitted (within the condition action block) with the time of the bar and a message that the second order is being submitted.


            Do you see the print appearing?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              It's my coding error! My strategy places a buy order when the position is either flat or short. That's the reason there is no second buy order. Thank you for your advise on one print line before the order statement that help me to debug my coding error. Thank you so much for your help.

              Best Regards,
              Jae​

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by ETFVoyageur, Today, 02:08 AM
              0 responses
              3 views
              0 likes
              Last Post ETFVoyageur  
              Started by kujista, 04-22-2024, 07:46 AM
              3 responses
              12 views
              0 likes
              Last Post kujista
              by kujista
               
              Started by kujista, 04-23-2024, 06:23 AM
              7 responses
              57 views
              0 likes
              Last Post kujista
              by kujista
               
              Started by SentientDavid, Today, 01:34 AM
              0 responses
              6 views
              0 likes
              Last Post SentientDavid  
              Started by MrForgetful, Today, 01:28 AM
              0 responses
              6 views
              0 likes
              Last Post MrForgetful  
              Working...
              X