Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trade entry command ignored

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

    Trade entry command ignored

    Hi,

    I have a really strange problem and I seem to be struggling to work out how to fix it.

    I have built a strategy piece by piece and I am at the stage where I would like to enter trades. So first off I just put something together to make sure that the code I wanted to use worked. So I have a program that just randomly enters trades in either direction with stop loss and targets and it worked fine. So now my strategy has the same code and when testing I can prove that the code would normally be executed via print statements but the command EnterShortLimit(Convert.ToInt32(DefaultQuantity), (Low[1] - 2) , @"ShortEntry"); is completely ignored.

    This is the exact line that works in the other program but not in the strategy I am currently working on ( I am using the equivalent statement and appropriate values for the long entry). I have checked the State == State.Setdefaults section in case maybe I had something set wrong, I have checked positions flat and other variables that may override an entry but I can't seem to find anything, are there any logs that track this on a sim account ?

    If anyone has any ideas/suggestions I would be extremely grateful!!

    Thanks in advance


    #2
    Hello Luckychip,

    Thank you for your post.

    To understand why the script is behaving as it is, such as placing orders or not placing orders when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

    In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.

    The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

    The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

    Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).


    Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

    After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.

    I am happy to assist you with analyzing the output from the output window.

    Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

    Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.

    https://support.ninjatrader.com/s/ar...nd-TraceOrders
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Hi Gaby,

      Thanks for your reply. I understand what you are saying and since posting I have been trying to solve it myself. So first off I only get a print in an output tab that the entry for a long or short has been taken. There is no error nothing regarding the entry command itself..... nothing in logs nothing. So the trade is not entered and no reason as to why.

      I even changed the code to just execute a straight out EntryLong() and it doesnt do that either. The other program I was using does enter trades, with the code I was using and the change. I can also enter a trade via the DOM so it would seem specific to the strategy but with no error messages to look at, I thought to ask here because maybe I am missing something or there is a log I missed.

      Thanks though for at least replying

      Comment


        #4
        Hello Luckychip,

        If you would like assistance with analyzing the output, please provide the output from prints and TraceOrders. You can save this by right-clicking the output window and selecting Save As... -> give the output file a name and save

        Without the output, it's hard to say what could be going on. Other than debugging, we would also recommend checking the Log tab of the Control Center for any runtime errors.
        Gaby V.NinjaTrader Customer Service

        Comment


          #5
          Hi Gaby,

          I did try the trace orders and checked the logs.... when doing manual trades I can see everything .. the program that works also shows up when orders are active but its blank for the strategy that doesnt work..... I will keep trying and update this thread when I can

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by dadarara, Today, 03:21 AM
          0 responses
          6 views
          0 likes
          Last Post dadarara  
          Started by rajeshks1988, 01-13-2021, 12:00 PM
          10 responses
          1,261 views
          0 likes
          Last Post konganda  
          Started by M_ichel, 04-22-2025, 02:21 PM
          7 responses
          60 views
          1 like
          Last Post brucerobinson  
          Started by michelz, 02-18-2025, 08:30 AM
          33 responses
          1,060 views
          0 likes
          Last Post MiCe1999  
          Started by volIQ, 04-23-2025, 05:43 PM
          4 responses
          38 views
          0 likes
          Last Post volIQ
          by volIQ
           
          Working...
          X